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

[190010] search cancellation issues

This commit is contained in:
David McKnight 2007-07-13 19:32:16 +00:00
parent f640ab5508
commit 3757b2c830
5 changed files with 30 additions and 10 deletions

View file

@ -122,6 +122,8 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
_isDone = true;
if (_isCancelled) {
_status.removeNestedData();
_dataStore.createObject(_status,"error", "cancelled");
_miner.statusCancelled(_status);
}
else {

View file

@ -13,7 +13,7 @@
*
* Contributors:
* {Name} (company) - description of contribution.
* David McKnight (IBM) [190010] need domain lister to keep uptodate with changed status
* David McKnight (IBM) [190010] commented why we don't need status monitor
*******************************************************************************/
package org.eclipse.rse.internal.services.dstore.search;
@ -37,8 +37,8 @@ public abstract class DStoreSearchResultConfiguration extends AbstractSearchResu
public void setStatusObject(DataElement status)
{
_status = status;
// need this to keep track of updated status
_status.getDataStore().getDomainNotifier().addDomainListener(this);
// no need for a domain listner because we check the status via status monitor
// _status.getDataStore().getDomainNotifier().addDomainListener(this);
}
public DataElement getStatusObject()

View file

@ -13,6 +13,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Kevin Doyle (IBM) - [187640] Removed setting status to finish when search not finished
* David McKnight [190010] Set the status to finish or cancelled depending on dstore status.
********************************************************************************/
package org.eclipse.rse.internal.services.dstore.search;
@ -84,6 +85,15 @@ public class DStoreSearchService extends AbstractDStoreService implements ISearc
try
{
getStatusMonitor(ds).waitForUpdate(status, monitor);
String statusStr = status.getName();
if (statusStr.equals("done"))
{
config.setStatus(IHostSearchConstants.FINISHED);
}
else if (statusStr.equals("cancelled"))
{
config.setStatus(IHostSearchConstants.CANCELLED);
}
}
catch (Exception e)
{

View file

@ -13,6 +13,7 @@
*
* Contributors:
* David McKnight (IBM) - [190803] Canceling a long-running dstore job prints "InterruptedException" to stdout
* David McKnight (IBM) - [190010] When status is "cancelled" the wait should complete
*******************************************************************************/
package org.eclipse.rse.services.dstore.util;
@ -174,7 +175,9 @@ public class DStoreStatusMonitor implements IDomainListener
*/
public boolean determineStatusDone(DataElement status)
{
return status.getAttribute(DE.A_VALUE).equals("done") || status.getAttribute(DE.A_NAME).equals("done"); //$NON-NLS-1$ //$NON-NLS-2$
return status.getAttribute(DE.A_VALUE).equals("done") || //$NON-NLS-1$
status.getAttribute(DE.A_NAME).equals("done") ||//$NON-NLS-1$
status.getAttribute(DE.A_NAME).equals("cancelled"); //$NON-NLS-1$
}
/**

View file

@ -20,6 +20,7 @@
package org.eclipse.rse.internal.subsystems.files.dstore;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -48,6 +49,7 @@ public class DStoreFileSubSystemSearchResultConfiguration extends DStoreSearchRe
private FileServiceSubSystem _fileSubSystem;
private IRemoteFile _searchObject;
private HashMap _parentCache;
private List _convertedResults;
public DStoreFileSubSystemSearchResultConfiguration(IHostSearchResultSet set, Object searchObject, SystemSearchString searchString, ISearchService searchService, IHostFileToRemoteFileAdapter fileAdapter)
{
@ -55,6 +57,7 @@ public class DStoreFileSubSystemSearchResultConfiguration extends DStoreSearchRe
_searchObject = (IRemoteFile)searchObject;
_fileSubSystem = (FileServiceSubSystem)_searchObject.getParentRemoteFileSubSystem();
_parentCache = new HashMap();
_convertedResults = new ArrayList();
}
/**
@ -78,12 +81,13 @@ public class DStoreFileSubSystemSearchResultConfiguration extends DStoreSearchRe
List results = getStatusObject().getNestedData();
if (results != null)
{
IProgressMonitor monitor = new NullProgressMonitor();
IRemoteFile[] convertedResults = new IRemoteFile[results.size()];
if (results.size() > _convertedResults.size())
{
IProgressMonitor monitor = new NullProgressMonitor();
for (int i = 0; i < results.size(); i++)
{
DataElement fileNode = (DataElement)results.get(i);
if (fileNode != null)
if (fileNode != null && !fileNode.getType().equals("error"))
{
IRemoteFile parentRemoteFile = null;
try
@ -95,7 +99,7 @@ public class DStoreFileSubSystemSearchResultConfiguration extends DStoreSearchRe
_parentCache.put(fileNode.getValue(), parentRemoteFile);
if (!parentRemoteFile.hasContents(RemoteChildrenContentsType.getInstance()))
if (parentRemoteFile != null && !parentRemoteFile.hasContents(RemoteChildrenContentsType.getInstance()))
{
// query all files to save time (so we can retrieve cached files
IRemoteFile[] children = _fileSubSystem.listFoldersAndFiles(parentRemoteFile, monitor);
@ -122,7 +126,7 @@ public class DStoreFileSubSystemSearchResultConfiguration extends DStoreSearchRe
}
remoteFile.setContents(RemoteSearchResultsContentsType.getInstance(), getSearchString().getTextString(), searchResults);
}
convertedResults[i] = remoteFile;
_convertedResults.add(remoteFile);
}
catch (SystemMessageException e)
{
@ -134,7 +138,8 @@ public class DStoreFileSubSystemSearchResultConfiguration extends DStoreSearchRe
}
}
}
return convertedResults;
}
return (IRemoteFile[])_convertedResults.toArray(new IRemoteFile[_convertedResults.size()]);
}
else
{