1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-23 00:03:53 +02:00

no shells cause this happens on worker thread

This commit is contained in:
David McKnight 2006-05-31 17:00:18 +00:00
parent a4591b7bc2
commit afba103bf3
2 changed files with 43 additions and 44 deletions

View file

@ -556,7 +556,7 @@ public class UniversalFileTransferUtility
* @param indicates whether to check for colllisions or not * @param indicates whether to check for colllisions or not
* @return the resulting remote objects * @return the resulting remote objects
*/ */
public static SystemRemoteResourceSet copyWorkspaceResourcesToRemote(SystemWorkspaceResourceSet workspaceSet, IRemoteFile targetFolder, IProgressMonitor monitor, Shell shell, boolean checkForCollisions) public static SystemRemoteResourceSet copyWorkspaceResourcesToRemote(SystemWorkspaceResourceSet workspaceSet, IRemoteFile targetFolder, IProgressMonitor monitor, boolean checkForCollisions)
{ {
boolean doSuperTransferPreference = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemPreferencesConstants.DOSUPERTRANSFER) boolean doSuperTransferPreference = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemPreferencesConstants.DOSUPERTRANSFER)
&& targetFolder.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemFactory().supportsArchiveManagement(); && targetFolder.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemFactory().supportsArchiveManagement();
@ -641,7 +641,7 @@ public class UniversalFileTransferUtility
String oldPath = newPathBuf.toString() + name; String oldPath = newPathBuf.toString() + name;
if (checkForCollisions) if (checkForCollisions)
{ {
name = checkForCollision(shell, existingFiles, targetFolder, name, oldPath); name = checkForCollision(existingFiles, targetFolder, name, oldPath);
if (name == null) if (name == null)
{ {
continue; continue;
@ -730,7 +730,7 @@ public class UniversalFileTransferUtility
{ {
IResource[] children = directory.members(); IResource[] children = directory.members();
SystemWorkspaceResourceSet childSet = new SystemWorkspaceResourceSet(directory.members()); SystemWorkspaceResourceSet childSet = new SystemWorkspaceResourceSet(directory.members());
SystemRemoteResourceSet childResults = copyWorkspaceResourcesToRemote(childSet, newTargetFolder, monitor, shell, checkForCollisions); SystemRemoteResourceSet childResults = copyWorkspaceResourcesToRemote(childSet, newTargetFolder, monitor, checkForCollisions);
if (childResults == null) if (childResults == null)
{ {
return null; return null;
@ -1484,7 +1484,7 @@ public class UniversalFileTransferUtility
return remotePath; return remotePath;
} }
protected static String checkForCollision(Shell shell, SystemRemoteResourceSet existingFiles, IRemoteFile targetFolder, String oldName, String oldPath) protected static String checkForCollision(SystemRemoteResourceSet existingFiles, IRemoteFile targetFolder, String oldName, String oldPath)
{ {
String newName = oldName; String newName = oldName;

View file

@ -62,6 +62,7 @@ import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
import org.eclipse.rse.files.ui.resources.SystemIFileProperties; import org.eclipse.rse.files.ui.resources.SystemIFileProperties;
import org.eclipse.rse.files.ui.resources.SystemRemoteEditManager; import org.eclipse.rse.files.ui.resources.SystemRemoteEditManager;
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility; import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility.RenameRunnable;
import org.eclipse.rse.filters.ISystemFilterReference; import org.eclipse.rse.filters.ISystemFilterReference;
import org.eclipse.rse.filters.SystemFilterReference; import org.eclipse.rse.filters.SystemFilterReference;
import org.eclipse.rse.model.IHost; import org.eclipse.rse.model.IHost;
@ -1601,6 +1602,31 @@ public class SystemViewRemoteFileAdapter
public static class RenameRunnable implements Runnable
{
private IRemoteFile _targetFileOrFolder;
private String _newName;
public RenameRunnable(IRemoteFile targetFileOrFolder)
{
_targetFileOrFolder = targetFileOrFolder;
}
public void run() {
ValidatorFileUniqueName validator = null;
SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(null, true, _targetFileOrFolder, validator); // true => copy-collision-mode
dlg.open();
if (!dlg.wasCancelled())
_newName = dlg.getNewName();
else
_newName = null;
}
public String getNewName()
{
return _newName;
}
}
/** /**
* Perform drop from the "fromSet" of objects to the "to" object * Perform drop from the "fromSet" of objects to the "to" object
@ -1656,15 +1682,6 @@ public class SystemViewRemoteFileAdapter
{ {
if (fromSet instanceof SystemWorkspaceResourceSet) if (fromSet instanceof SystemWorkspaceResourceSet)
{ {
Shell shell = null;
try
{
shell = getShell();
}
catch (Exception e)
{
}
boolean doSuperTransferProperty = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemPreferencesConstants.DOSUPERTRANSFER); boolean doSuperTransferProperty = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemPreferencesConstants.DOSUPERTRANSFER);
if (!doSuperTransferProperty) if (!doSuperTransferProperty)
{ {
@ -1677,11 +1694,11 @@ public class SystemViewRemoteFileAdapter
monitor.beginTask(_uploadMessage.getLevelOneText(), size); monitor.beginTask(_uploadMessage.getLevelOneText(), size);
} }
// back to hierarchy // back to hierarchy
return UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)fromSet, targetFolder, monitor, shell, true); return UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)fromSet, targetFolder, monitor, true);
} }
else else
{ {
return UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)fromSet, targetFolder, monitor, shell, true); return UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)fromSet, targetFolder, monitor, true);
} }
} }
else if (fromSet instanceof SystemRemoteResourceSet) else if (fromSet instanceof SystemRemoteResourceSet)
@ -1780,13 +1797,10 @@ public class SystemViewRemoteFileAdapter
IRemoteFile existingFileOrFolder = ((IRemoteFileSubSystem)srcSubSystem).getRemoteFileObject(targetFolder, name); IRemoteFile existingFileOrFolder = ((IRemoteFileSubSystem)srcSubSystem).getRemoteFileObject(targetFolder, name);
if (existingFileOrFolder.exists()) if (existingFileOrFolder.exists())
{ {
ValidatorFileUniqueName validator = null; RenameRunnable rr = new RenameRunnable(existingFileOrFolder);
SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(getShell(), true, existingFileOrFolder, validator); Display.getDefault().syncExec(rr);
dlg.open(); name = rr.getNewName();
if (!dlg.wasCancelled())
name = dlg.getNewName();
else
name = null;
if (name != null) if (name != null)
{ {
toCopy.add(srcFileOrFolder); toCopy.add(srcFileOrFolder);
@ -2027,14 +2041,9 @@ public class SystemViewRemoteFileAdapter
if (existingFileOrFolder.exists()) if (existingFileOrFolder.exists())
{ {
RenameRunnable rr = new RenameRunnable(existingFileOrFolder);
ValidatorFileUniqueName validator = null; Display.getDefault().syncExec(rr);
SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(getShell(), true, existingFileOrFolder, validator); name = rr.getNewName();
dlg.open();
if (!dlg.wasCancelled())
name = dlg.getNewName();
else
name = null;
} }
if (name != null) if (name != null)
@ -2175,19 +2184,9 @@ public class SystemViewRemoteFileAdapter
//RSEUIPlugin.logInfo("...target.exists()? "+tgtFileOrFolder.exists()); //RSEUIPlugin.logInfo("...target.exists()? "+tgtFileOrFolder.exists());
if (targetFileOrFolder.exists()) if (targetFileOrFolder.exists())
{ {
//monitor.setVisible(false); wish we could! RenameRunnable rr = new RenameRunnable(targetFileOrFolder);
Display.getDefault().syncExec(rr);
// we no longer have to set the validator here... the common rename dialog we all now use queries the input newName = rr.getNewName();
// object's system view adaptor for its name validator. See getNameValidator in SystemViewRemoteFileAdapter. phil
ValidatorFileUniqueName validator = null; // new ValidatorFileUniqueName(shell, targetFolder, srcFileOrFolder.isDirectory());
//SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, targetFileOrFolder, validator); // true => copy-collision-mode
dlg.open();
if (!dlg.wasCancelled())
newName = dlg.getNewName();
else
newName = null;
} }
} }
catch (SystemMessageException e) catch (SystemMessageException e)