mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 15:15:25 +02:00
[230821] [api][breaking] IRemoteFileSubsystem is inconsistent with IFileService
https://bugs.eclipse.org/bugs/show_bug.cgi?id=230821
This commit is contained in:
parent
ee511dba34
commit
788cece9b2
3 changed files with 27 additions and 89 deletions
|
@ -32,12 +32,10 @@ import java.util.Vector;
|
|||
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
|
||||
import org.eclipse.rse.core.filters.ISystemFilter;
|
||||
|
@ -48,13 +46,9 @@ import org.eclipse.rse.core.model.IHost;
|
|||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||
import org.eclipse.rse.files.ui.dialogs.SystemRemoteFolderDialog;
|
||||
import org.eclipse.rse.internal.files.ui.Activator;
|
||||
import org.eclipse.rse.internal.files.ui.FileResources;
|
||||
import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
|
||||
import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
|
||||
import org.eclipse.rse.internal.ui.SystemResources;
|
||||
import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
|
||||
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||
|
@ -265,30 +259,14 @@ implements IValidatorRemoteSelection
|
|||
if (targetConnection == srcConnection)
|
||||
{
|
||||
ss = targetFolder.getParentRemoteFileSubSystem();
|
||||
try {
|
||||
ss.copy(srcFileOrFolder, targetFolder, newName, null);
|
||||
ok = true;
|
||||
} catch (Exception e) {
|
||||
SystemBasePlugin.logError("Exception occurred during copy", e); //$NON-NLS-1$
|
||||
}
|
||||
if (!ok)
|
||||
{
|
||||
String msgTxt = NLS.bind(FileResources.FILEMSG_COPY_FILE_FAILED, srcFileOrFolder.getName());
|
||||
String msgDetails = FileResources.FILEMSG_COPY_FILE_FAILED_DETAILS;
|
||||
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
ISystemFileConstants.FILEMSG_COPY_FILE_FAILED,
|
||||
IStatus.ERROR, msgTxt, msgDetails);
|
||||
throw new SystemMessageException(msg);
|
||||
}
|
||||
ss.copy(srcFileOrFolder, targetFolder, newName, null);
|
||||
ok = true;
|
||||
String sep = targetFolder.getSeparator();
|
||||
String targetFolderName = targetFolder.getAbsolutePath();
|
||||
if (!targetFolderName.endsWith(sep))
|
||||
copiedFiles.addElement(targetFolderName+sep+newName);
|
||||
else
|
||||
{
|
||||
String sep = targetFolder.getSeparator();
|
||||
String targetFolderName = targetFolder.getAbsolutePath();
|
||||
if (!targetFolderName.endsWith(sep))
|
||||
copiedFiles.addElement(targetFolderName+sep+newName);
|
||||
else
|
||||
copiedFiles.addElement(targetFolderName+newName);
|
||||
}
|
||||
copiedFiles.addElement(targetFolderName+newName);
|
||||
}
|
||||
// DKM - for cross system copy
|
||||
else
|
||||
|
|
|
@ -46,20 +46,19 @@ import org.eclipse.rse.core.subsystems.ISubSystem;
|
|||
import org.eclipse.rse.internal.files.ui.Activator;
|
||||
import org.eclipse.rse.internal.files.ui.FileResources;
|
||||
import org.eclipse.rse.internal.files.ui.ISystemFileConstants;
|
||||
import org.eclipse.rse.internal.ui.dialogs.CopyRunnable;
|
||||
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemBasePlugin;
|
||||
import org.eclipse.rse.ui.actions.SystemBaseCopyAction;
|
||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||
import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
|
||||
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.rse.internal.ui.dialogs.CopyRunnable;
|
||||
|
||||
/**
|
||||
* Move selected files and folders action.
|
||||
|
@ -239,46 +238,25 @@ public class SystemMoveRemoteFileAction extends SystemCopyRemoteFileAction
|
|||
* @param monitor Usually not needed
|
||||
* @see SystemBaseCopyAction#doCopy(Object, Object, String, IProgressMonitor)
|
||||
*/
|
||||
protected boolean doCopy(Object targetContainer, Object oldObject, String newName, IProgressMonitor monitor)
|
||||
throws Exception
|
||||
{
|
||||
IRemoteFile targetFolder = (IRemoteFile)targetContainer;
|
||||
IRemoteFile srcFileOrFolder = (IRemoteFile)oldObject;
|
||||
protected boolean doCopy(Object targetContainer, Object oldObject, String newName, IProgressMonitor monitor) throws Exception {
|
||||
IRemoteFile targetFolder = (IRemoteFile) targetContainer;
|
||||
IRemoteFile srcFileOrFolder = (IRemoteFile) oldObject;
|
||||
|
||||
IRemoteFileSubSystem ss = targetFolder.getParentRemoteFileSubSystem();
|
||||
|
||||
boolean ok = false;
|
||||
try {
|
||||
ss.move(srcFileOrFolder, targetFolder, newName, monitor);
|
||||
ok = true;
|
||||
} catch (Exception e) {
|
||||
SystemBasePlugin.logError("Exception occurred during a move operation", e); //$NON-NLS-1$
|
||||
}
|
||||
if (!ok)
|
||||
{
|
||||
String msgTxt = NLS.bind(FileResources.FILEMSG_MOVE_FILE_FAILED, srcFileOrFolder.getName());
|
||||
String msgDetails = FileResources.FILEMSG_MOVE_FILE_FAILED_DETAILS;
|
||||
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
ISystemFileConstants.FILEMSG_MOVE_FILE_FAILED,
|
||||
IStatus.ERROR, msgTxt, msgDetails);
|
||||
throw new SystemMessageException(msg);
|
||||
}
|
||||
|
||||
ss.move(srcFileOrFolder, targetFolder, newName, monitor);
|
||||
String sep = targetFolder.getSeparator();
|
||||
String targetFolderName = targetFolder.getAbsolutePath();
|
||||
String resultPath = null;
|
||||
|
||||
if (!targetFolderName.endsWith(sep))
|
||||
resultPath = targetFolderName + sep + newName;
|
||||
else
|
||||
{
|
||||
String sep = targetFolder.getSeparator();
|
||||
String targetFolderName = targetFolder.getAbsolutePath();
|
||||
String resultPath = null;
|
||||
|
||||
if (!targetFolderName.endsWith(sep))
|
||||
resultPath = targetFolderName+sep+newName;
|
||||
else
|
||||
resultPath = targetFolderName+newName;
|
||||
resultPath = targetFolderName + newName;
|
||||
|
||||
copiedFiles.addElement(resultPath);
|
||||
movedFiles.add(srcFileOrFolder);
|
||||
}
|
||||
|
||||
return ok;
|
||||
copiedFiles.addElement(resultPath);
|
||||
movedFiles.add(srcFileOrFolder);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2806,7 +2806,6 @@ public class SystemViewRemoteFileAdapter
|
|||
*/
|
||||
public boolean doDeleteBatch(Shell shell, List resourceSet, IProgressMonitor monitor) throws Exception
|
||||
{
|
||||
boolean ok;
|
||||
IRemoteFileSubSystem ss = null;
|
||||
IRemoteFile[] files = new IRemoteFile[resourceSet.size()];
|
||||
for (int i = 0; i < resourceSet.size(); i++)
|
||||
|
@ -2834,7 +2833,6 @@ public class SystemViewRemoteFileAdapter
|
|||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
ok = false;
|
||||
String msgTxt = NLS.bind(FileResources.FILEMSG_DELETE_FILE_FAILED, file.toString());
|
||||
String msgDetails = FileResources.FILEMSG_DELETE_FILE_FAILED_DETAILS;
|
||||
|
||||
|
@ -2846,19 +2844,9 @@ public class SystemViewRemoteFileAdapter
|
|||
}
|
||||
if (ss != null)
|
||||
{
|
||||
try {
|
||||
ss.deleteBatch(files, monitor);
|
||||
ok = true;
|
||||
} catch (Exception e) {
|
||||
SystemBasePlugin.logError("Exception occurred during batch delete", e); //$NON-NLS-1$
|
||||
ok = false;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
ss.deleteBatch(files, monitor);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// FOR COMMON RENAME ACTIONS
|
||||
/**
|
||||
|
@ -2936,7 +2924,6 @@ public class SystemViewRemoteFileAdapter
|
|||
*/
|
||||
public boolean doRename(Shell shell, Object element, String newName, IProgressMonitor monitor) throws Exception
|
||||
{
|
||||
boolean ok = true;
|
||||
IRemoteFile file = (IRemoteFile) element;
|
||||
IRemoteFileSubSystem ss = file.getParentRemoteFileSubSystem();
|
||||
|
||||
|
@ -2948,12 +2935,7 @@ public class SystemViewRemoteFileAdapter
|
|||
localResource = UniversalFileTransferUtility.getTempFileFor(file);
|
||||
}
|
||||
|
||||
try {
|
||||
ss.rename(file, newName, monitor);
|
||||
} catch (Exception e) {
|
||||
SystemBasePlugin.logError("Exception occurred during rename", e); //$NON-NLS-1$
|
||||
ok = false;
|
||||
}
|
||||
ss.rename(file, newName, monitor);
|
||||
if (localResource != null && localResource.exists())
|
||||
{
|
||||
|
||||
|
@ -2976,7 +2958,7 @@ public class SystemViewRemoteFileAdapter
|
|||
// //sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, file, file.getParentRemoteFile(), file.getParentRemoteFileSubSystem(), null, null);
|
||||
// }
|
||||
// file.markStale(true);
|
||||
return ok;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue