1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 15:45:25 +02:00

[214378] [dstore] remote search doesn't display results sometimes

This commit is contained in:
David McKnight 2008-01-04 18:35:28 +00:00
parent 4692095642
commit 72d794af7a
3 changed files with 35 additions and 16 deletions

View file

@ -15,6 +15,7 @@
* Michael Berger (IBM) - Bug 147791 - symbolic links can cause circular search.
* David McKnight (IBM) - [190010] cancelling search
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
* David McKnight (IBM) - [214378] canonical path not required - problem is in the client
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@ -133,8 +134,9 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
// to status refresh. As a result client thinks
// search isn't finished.
// _miner.statusDone(_status);
_status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
_status.setAttribute(DE.A_NAME, "done"); //$NON-NLS-1$
_dataStore.refresh(_status, true); // true indicates refresh immediately
}
}
@ -171,16 +173,8 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
// is it an archive?
boolean isArchive = ArchiveHandlerManager.getInstance().isArchive(theFile);
// use canonical path since sometimes we have symbolic links
String absPath = null;
try
{
absPath = theFile.getCanonicalPath();
}
catch (Exception e)
{
absPath = theFile.getAbsolutePath();
}
String absPath = absPath = theFile.getAbsolutePath();
String compareStr = theFile.getName();
@ -247,7 +241,6 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
}
// otherwise, search the file
else {
if (!isArchive) {
deObj = _dataStore.createObject(null, _deFile, compareStr);
}
@ -343,7 +336,6 @@ public class UniversalSearchHandler extends Thread implements ICancellableHandle
}
protected boolean internalSearchWithinFile(DataElement remoteFile, String absPath, File theFile) {
// if search string is empty, no need to look for matches within file
if (_isFileSearch) {
return true;

View file

@ -14,6 +14,7 @@
* Contributors:
* {Name} (company) - description of contribution.
* David McKnight (IBM) [190010] commented why we don't need status monitor
* David McKnight (IBM) - [214378] [dstore] remote search doesn't display results sometimes
*******************************************************************************/
package org.eclipse.rse.internal.services.dstore.search;
@ -38,7 +39,7 @@ public abstract class DStoreSearchResultConfiguration extends AbstractSearchResu
{
_status = status;
// no need for a domain listner because we check the status via status monitor
// _status.getDataStore().getDomainNotifier().addDomainListener(this);
_status.getDataStore().getDomainNotifier().addDomainListener(this);
}
public DataElement getStatusObject()

View file

@ -17,6 +17,7 @@
* Kevin Doyle (IBM) - [190010] Added cancel() method that will call the search service to cancel
* David McKnight (IBM) - [190010] performance improvement to use caching for dstore search
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
* David McKnight (IBM) - [214378] [dstore] remote search doesn't display results sometimes
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.files.dstore;
@ -167,8 +168,10 @@ public class DStoreFileSubSystemSearchResultConfiguration extends DStoreSearchRe
if (_status.getValue().equals("done")) //$NON-NLS-1$
{
setStatus(IHostSearchConstants.FINISHED);
_status.getDataStore().getDomainNotifier().removeDomainListener(this);
// need to wait for the results though
DelayedDomainListenerRemover remover = new DelayedDomainListenerRemover(this, _status);
remover.start();
// _status.getDataStore().getDomainNotifier().removeDomainListener(this);
}
else if (_status.getValue().equals("cancelled")) //$NON-NLS-1$
{
@ -186,4 +189,27 @@ public class DStoreFileSubSystemSearchResultConfiguration extends DStoreSearchRe
getSearchService().cancelSearch(this, new NullProgressMonitor());
}
}
private class DelayedDomainListenerRemover extends Thread
{
private DStoreFileSubSystemSearchResultConfiguration _config;
private DataElement _status;
public DelayedDomainListenerRemover(DStoreFileSubSystemSearchResultConfiguration config, DataElement status)
{
_status = status;
_config = config;
}
public void run()
{
try
{
sleep(1000);
}
catch (Exception e)
{
}
_status.getDataStore().getDomainNotifier().removeDomainListener(_config);
}
}
}