### Eclipse Workspace Patch 1.0 #P org.eclipse.ui.workbench Index: Eclipse UI/org/eclipse/ui/dialogs/FilteredItemsSelectionDialog.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredItemsSelectionDialog.java,v retrieving revision 1.42 diff -u -r1.42 FilteredItemsSelectionDialog.java --- Eclipse UI/org/eclipse/ui/dialogs/FilteredItemsSelectionDialog.java 15 May 2007 13:13:44 -0000 1.42 +++ Eclipse UI/org/eclipse/ui/dialogs/FilteredItemsSelectionDialog.java 16 May 2007 18:01:21 -0000 @@ -893,7 +893,7 @@ */ public void scheduleProgressMessageRefresh() { if (refreshProgressMessageJob.cancel()) - refreshProgressMessageJob.schedule(); + refreshProgressMessageJob.schedulePrgressRefresh(false); } /* @@ -1278,7 +1278,8 @@ */ private class RefreshProgressMessageJob extends UIJob { - private boolean cancelling = false; + private boolean cancelling= true; + private boolean cyclical=false; /** * Creates a new instance of the class @@ -1293,14 +1294,15 @@ public IStatus runInUIThread(IProgressMonitor monitor) { - cancelling = false; - if (FilteredItemsSelectionDialog.this != null) { FilteredItemsSelectionDialog.this.updateProgressLabel(); } - - if (cancelling) - refreshProgressMessageJob.schedule(); + + if (cancelling) + return new Status(IStatus.CANCEL, PlatformUI.PLUGIN_ID, IStatus.CANCEL, EMPTY_STRING, null); + + if (cyclical) + schedule(200); return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, EMPTY_STRING, null); @@ -1313,8 +1315,21 @@ */ protected void canceling() { super.canceling(); - this.cancelling = true; + this.cancelling= true; + this.cyclical= false; + } + + /** + * Schedule progress refresh job + * @param cyclical if true refresh is cyclical with 300 milliseconds deley + * if false it will be schedule only once + */ + public void schedulePrgressRefresh(boolean cyclical) { + this.cancelling= false; + this.cyclical= cyclical; + schedule(); } + } /** @@ -1358,7 +1373,7 @@ if (FilteredItemsSelectionDialog.this != null) { GranualProgressMonitor wrappedMonitor = new GranualProgressMonitor( - monitor, contentProvider, true); + monitor, true); FilteredItemsSelectionDialog.this.reloadCache(true, wrappedMonitor); } @@ -1700,9 +1715,7 @@ * * @see GranualProgressMonitor#internalWorked(double) */ - private static class GranualProgressMonitor extends ProgressMonitorWrapper { - - private ContentProvider contentProvider; + private class GranualProgressMonitor extends ProgressMonitorWrapper { private String name; @@ -1730,9 +1743,8 @@ * from a non-filtering job will not be displayed on UI. */ public GranualProgressMonitor(IProgressMonitor monitor, - ContentProvider contentProvider, boolean isFiltering) { + boolean isFiltering) { super(monitor); - this.contentProvider = contentProvider; this.isFiltering = isFiltering; } @@ -1770,7 +1782,8 @@ if (this.name == null) this.name = name; this.totalWork = totalWork; - updateProgressMessage(); + if (refreshProgressMessageJob.cancel()) + refreshProgressMessageJob.schedulePrgressRefresh(true); } /* @@ -1792,6 +1805,7 @@ done = true; contentProvider.setProgressMessage("", isFiltering); //$NON-NLS-1$ super.done(); + refreshProgressMessageJob.cancel(); } /* @@ -1811,8 +1825,8 @@ */ public void internalWorked(double work) { worked = worked + work; - if ((((int) (((worked - work) * 10) / totalWork)) < ((int) ((worked * 10) / totalWork))) - || (((int) ((worked * 10) / totalWork)) == 0)) + if ((((int) (((worked - work)) / totalWork)) < ((int) ((worked) / totalWork))) + || (((int) ((worked) / totalWork)) == 0)) if (!isCanceled()) updateProgressMessage(); } @@ -1886,7 +1900,7 @@ */ protected final IStatus run(IProgressMonitor parent) { GranualProgressMonitor monitor = new GranualProgressMonitor(parent, - contentProvider, true); + true); return doRun(monitor); } @@ -2555,7 +2569,6 @@ if (!isFiltering && filterJob.getState() == Job.RUNNING) return; this.progressMessage = progressMessage; - scheduleProgressMessageRefresh(); } /**