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

[219792][importexport][ftp] RSE hangs on FTP import

This commit is contained in:
David McKnight 2008-03-13 21:02:59 +00:00
parent a06d60ce72
commit d2205e833c
2 changed files with 56 additions and 4 deletions

View file

@ -8,6 +8,7 @@
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
* David McKnight (IBM) - [219792][importexport][ftp] RSE hangs on FTP import
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.importexport.files; package org.eclipse.rse.internal.importexport.files;
@ -116,4 +117,9 @@ public class RemoteImportWizard extends AbstractSystemWizard implements IImportW
public boolean performFinish() { public boolean performFinish() {
return mainPage.finish(); return mainPage.finish();
} }
public boolean performCancel() {
mainPage.cancel();
return super.performCancel();
}
} }

View file

@ -13,6 +13,7 @@
* David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind * David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
* David McKnight (IBM) - [219792] use background query when doing import * David McKnight (IBM) - [219792] use background query when doing import
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
* David McKnight (IBM) - [219792][importexport][ftp] RSE hangs on FTP import
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.importexport.files; package org.eclipse.rse.internal.importexport.files;
@ -127,6 +128,9 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen
private Object _fileSystemObject; private Object _fileSystemObject;
private IImportStructureProvider _provider; private IImportStructureProvider _provider;
private MinimizedFileSystemElement _element; private MinimizedFileSystemElement _element;
private boolean _isActive = false;
private boolean _isCanceled = false;
public QueryAllJob(Object fileSystemObject, IImportStructureProvider provider, MinimizedFileSystemElement element){ public QueryAllJob(Object fileSystemObject, IImportStructureProvider provider, MinimizedFileSystemElement element){
super("Querying All"); //$NON-NLS-1$ super("Querying All"); //$NON-NLS-1$
_fileSystemObject = fileSystemObject; _fileSystemObject = fileSystemObject;
@ -136,11 +140,13 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen
public IStatus run(IProgressMonitor monitor){ public IStatus run(IProgressMonitor monitor){
_isActive = true;
query(_fileSystemObject, _element, monitor); query(_fileSystemObject, _element, monitor);
_isActive = false;
Display.getDefault().asyncExec(new Runnable(){ Display.getDefault().asyncExec(new Runnable(){
public void run(){ public void run(){
updateWidgetEnablements();
selectionGroup.setAllSelections(true); selectionGroup.setAllSelections(true);
} }
}); });
@ -148,7 +154,22 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen
return Status.OK_STATUS; return Status.OK_STATUS;
} }
public boolean isActive()
{
return _isActive;
}
protected void canceling() {
_isCanceled = true;
}
private void query(Object parent, MinimizedFileSystemElement element, IProgressMonitor monitor){ private void query(Object parent, MinimizedFileSystemElement element, IProgressMonitor monitor){
if (monitor.isCanceled() || _isCanceled){
return;
}
List children = _provider.getChildren(parent); List children = _provider.getChildren(parent);
if (children == null) children = new ArrayList(1); if (children == null) children = new ArrayList(1);
@ -221,6 +242,10 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen
protected Button deselectAllButton; protected Button deselectAllButton;
// a boolean to indicate if the user has typed anything // a boolean to indicate if the user has typed anything
private boolean entryChanged = false; private boolean entryChanged = false;
private QueryAllJob _queryAllJob;
private MinimizedFileSystemElement _fileSystemTree;
// input object // input object
protected Object inputObject = null; protected Object inputObject = null;
// flag to indicate whether initial selection was used to set source field // flag to indicate whether initial selection was used to set source field
@ -505,8 +530,10 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen
MinimizedFileSystemElement result = new MinimizedFileSystemElement(elementLabel, dummyParent, isContainer); MinimizedFileSystemElement result = new MinimizedFileSystemElement(elementLabel, dummyParent, isContainer);
result.setFileSystemObject(fileSystemObject); result.setFileSystemObject(fileSystemObject);
QueryAllJob query = new QueryAllJob(fileSystemObject, provider, result); if (_queryAllJob == null){
query.schedule(); _queryAllJob = new QueryAllJob(fileSystemObject, provider, result);
_queryAllJob.schedule();
}
////Get the files for the element so as to build the first level ////Get the files for the element so as to build the first level
//result.getFiles(provider); //result.getFiles(provider);
@ -673,7 +700,11 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen
protected MinimizedFileSystemElement getFileSystemTree() { protected MinimizedFileSystemElement getFileSystemTree() {
File sourceDirectory = getSourceDirectory(); File sourceDirectory = getSourceDirectory();
if (sourceDirectory == null) return null; if (sourceDirectory == null) return null;
return selectFiles(sourceDirectory, FileSystemStructureProvider.INSTANCE);
if (_fileSystemTree == null){
_fileSystemTree = selectFiles(sourceDirectory, FileSystemStructureProvider.INSTANCE);
}
return _fileSystemTree;
} }
/** /**
@ -1380,6 +1411,14 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen
return finish(); return finish();
} }
public void cancel() {
if (_queryAllJob != null && _queryAllJob.isActive()){
_queryAllJob.cancel();
}
}
/* (non-Javadoc) /* (non-Javadoc)
* @see com.ibm.etools.systems.core.ui.wizards.ISystemWizardPage#setHelp(java.lang.String) * @see com.ibm.etools.systems.core.ui.wizards.ISystemWizardPage#setHelp(java.lang.String)
*/ */
@ -1521,4 +1560,11 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen
pendingString = message; pendingString = message;
} }
} }
public boolean determinePageCompletion(){
if (_queryAllJob != null && _queryAllJob.isActive()){
return false;
}
return super.determinePageCompletion();
}
} }