public void performSearch(final BulkEditorQuery bulkEditorQuery, IStructuredSelection selection) {
//cancel previous search job
if(searchJob!=null && searchJob.getState()!=Job.NONE){
- searchJob.cancel();
+ boolean isCanceled = searchJob.cancel();
+ if (!isCanceled){
+ while (!isCanceled){
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ }
+ isCanceled = searchJob.cancel();
+ }
+ }
searchJob = null;
- /*
- * wait for a little while for the job to finish
- * to avoid asynchronously loaded results of the
- * previous search being shown in the next search
- * (not critical but explicitly waiting for the job to finish
- * could run into an endless loop by mistake)
- */
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- }
+// /*
+// * wait for a little while for the job to finish
+// * to avoid asynchronously loaded results of the
+// * previous search being shown in the next search
+// * (not critical but explicitly waiting for the job to finish
+// * could run into an endless loop by mistake)
+// */
+// try {
+// Thread.sleep(500);
+// } catch (InterruptedException e) {
+// }
}
model.clear();
markedMergeCandidates.clear();