From 377604c842f18890c12023ba507ffb1fd728702d Mon Sep 17 00:00:00 2001 From: David McKnight Date: Thu, 4 Dec 2008 18:00:14 +0000 Subject: [PATCH] [255390] don't assume one update means the search is done --- .../dstore/search/DStoreSearchService.java | 49 ++++++++++++------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/search/DStoreSearchService.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/search/DStoreSearchService.java index 5585291bca9..10255bbc47f 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/search/DStoreSearchService.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/search/DStoreSearchService.java @@ -18,6 +18,7 @@ * David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup * David McKnight (IBM) - [214378] don't mark as finished until we have the results - sleep instead of wait * David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage() + * David McKnight (IBM) - [255390] don't assume one update means the search is done *******************************************************************************/ package org.eclipse.rse.internal.services.dstore.search; @@ -91,27 +92,39 @@ public class DStoreSearchService extends AbstractDStoreService implements ISearc try { - getStatusMonitor(ds).waitForUpdate(status, monitor); - String statusStr = status.getName(); - if (statusStr.equals("done")) //$NON-NLS-1$ - { - if (status.getNestedSize() > 0){ - config.setStatus(IHostSearchConstants.FINISHED); - } - else { // need to wait until we have all results on client - try - { - Thread.sleep(2000); + boolean working = true; + while (working){ + getStatusMonitor(ds).waitForUpdate(status, monitor); + String statusStr = status.getName(); + if (statusStr.equals("done")) //$NON-NLS-1$ + { + if (status.getNestedSize() > 0){ + config.setStatus(IHostSearchConstants.FINISHED); } - catch (Exception e) - { + else { // need to wait until we have all results on client + try + { + Thread.sleep(2000); + } + catch (Exception e) + { + } + config.setStatus(IHostSearchConstants.FINISHED); + } + working = false; + } + else if (statusStr.equals("cancelled")) //$NON-NLS-1$ + { + config.setStatus(IHostSearchConstants.CANCELLED); + working = false; + } + else if (statusStr.equals("working")){ //$NON-NLS-1$ + // still searching + if (monitor.isCanceled()){ + config.setStatus(IHostSearchConstants.CANCELLED); + working = false; } - config.setStatus(IHostSearchConstants.FINISHED); } - } - else if (statusStr.equals("cancelled")) //$NON-NLS-1$ - { - config.setStatus(IHostSearchConstants.CANCELLED); } } catch (Exception e)