View | Details | Raw Unified | Return to bug 189106 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/dialogs/FilteredItemsSelectionDialog.java (-14 / +26 lines)
Lines 196-204 Link Here
196
	private ItemsListSeparator itemsListSeparator;
196
	private ItemsListSeparator itemsListSeparator;
197
197
198
	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
198
	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
199
	
199
200
	private boolean refreshWithLastSelection = false ;
200
	private boolean refreshWithLastSelection = false;
201
	
202
201
203
	/**
202
	/**
204
	 * Creates a new instance of the class.
203
	 * Creates a new instance of the class.
Lines 852-858 Link Here
852
	 */
851
	 */
853
	public void refresh() {
852
	public void refresh() {
854
		if (list != null && !list.getTable().isDisposed()) {
853
		if (list != null && !list.getTable().isDisposed()) {
855
			
854
856
			List lastRefreshSelection = ((StructuredSelection) list
855
			List lastRefreshSelection = ((StructuredSelection) list
857
					.getSelection()).toList();
856
					.getSelection()).toList();
858
857
Lines 1343-1349 Link Here
1343
						IStatus.CANCEL, EMPTY_STRING, null);
1342
						IStatus.CANCEL, EMPTY_STRING, null);
1344
			}
1343
			}
1345
1344
1346
			//Schedule cyclical with 500 milliseconds delay
1345
			// Schedule cyclical with 500 milliseconds delay
1347
			schedule(500);
1346
			schedule(500);
1348
1347
1349
			return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK,
1348
			return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK,
Lines 1359-1365 Link Here
1359
		public void scheduleProgressRefresh(
1358
		public void scheduleProgressRefresh(
1360
				GranualProgressMonitor progressMonitor) {
1359
				GranualProgressMonitor progressMonitor) {
1361
			this.progressMonitor = progressMonitor;
1360
			this.progressMonitor = progressMonitor;
1362
			//Schedule with initial delay to avoid flickering when the user types quickly
1361
			// Schedule with initial delay to avoid flickering when the user
1362
			// types quickly
1363
			schedule(200);
1363
			schedule(200);
1364
		}
1364
		}
1365
1365
Lines 1906-1917 Link Here
1906
			this.itemsFilter = filter;
1906
			this.itemsFilter = filter;
1907
1907
1908
			contentProvider.reset();
1908
			contentProvider.reset();
1909
			
1909
1910
			refreshWithLastSelection = false;
1910
			refreshWithLastSelection = false;
1911
1911
1912
			contentProvider.addHistoryItems(itemsFilter);
1912
			contentProvider.addHistoryItems(itemsFilter);
1913
1913
1914
			contentProvider.refresh();
1914
			if (contentProvider.hasItems()
1915
					&& !(lastCompletedFilter != null && lastCompletedFilter
1916
							.isSubFilter(this.itemsFilter)))
1917
				contentProvider.refresh();
1915
1918
1916
			filterJob.schedule();
1919
			filterJob.schedule();
1917
1920
Lines 2513-2518 Link Here
2513
		}
2516
		}
2514
2517
2515
		/**
2518
		/**
2519
		 * Return whether or not there are any items.
2520
		 * 
2521
		 * @return
2522
		 */
2523
		public boolean hasItems() {
2524
			return !items.isEmpty();
2525
		}
2526
2527
		/**
2516
		 * Sets selection history.
2528
		 * Sets selection history.
2517
		 * 
2529
		 * 
2518
		 * @param selectionHistory
2530
		 * @param selectionHistory
Lines 2701-2712 Link Here
2701
		}
2713
		}
2702
2714
2703
		/**
2715
		/**
2704
		 * Gets filtered items.
2716
		 * Gets sorted items.
2705
		 * 
2717
		 * 
2706
		 * @return filtered items
2718
		 * @return sorted items
2707
		 */
2719
		 */
2708
		private Object[] getItems(boolean sort) {
2720
		private Object[] getSortedItems() {
2709
			if (sort || lastSortedItems.size() != items.size()) {
2721
			if (lastSortedItems.size() != items.size()) {
2710
				synchronized (lastSortedItems) {
2722
				synchronized (lastSortedItems) {
2711
					lastSortedItems.clear();
2723
					lastSortedItems.clear();
2712
					lastSortedItems.addAll(items);
2724
					lastSortedItems.addAll(items);
Lines 2723-2729 Link Here
2723
		 */
2735
		 */
2724
		public void rememberResult(ItemsFilter itemsFilter) {
2736
		public void rememberResult(ItemsFilter itemsFilter) {
2725
			List itemsList = Collections.synchronizedList(Arrays
2737
			List itemsList = Collections.synchronizedList(Arrays
2726
					.asList(getItems(false)));
2738
					.asList(getSortedItems()));
2727
			// synchronization
2739
			// synchronization
2728
			if (itemsFilter == filter) {
2740
			if (itemsFilter == filter) {
2729
				lastCompletedFilter = itemsFilter;
2741
				lastCompletedFilter = itemsFilter;
Lines 2882-2888 Link Here
2882
			}
2894
			}
2883
2895
2884
			// get already sorted array
2896
			// get already sorted array
2885
			Object[] filteredElements = getItems(false);
2897
			Object[] filteredElements = getSortedItems();
2886
2898
2887
			if (monitor != null) {
2899
			if (monitor != null) {
2888
				monitor.worked(ticks);
2900
				monitor.worked(ticks);

Return to bug 189106