Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 223976
Collapse All | Expand All

(-)extensions/org/eclipse/ui/model/WorkbenchContentProvider.java (-2 / +2 lines)
Lines 204-211 Link Here
204
		}
204
		}
205
		// Check the flags for changes the Navigator cares about.
205
		// Check the flags for changes the Navigator cares about.
206
		// See ResourceLabelProvider for the aspects it cares about.
206
		// See ResourceLabelProvider for the aspects it cares about.
207
		// Notice we don't care about F_MARKERS currently.
207
		// Notice we don't care about F_CONTENT or F_MARKERS currently.
208
		if ((changeFlags & (IResourceDelta.SYNC | IResourceDelta.CONTENT
208
		if ((changeFlags & (IResourceDelta.SYNC
209
				| IResourceDelta.TYPE | IResourceDelta.DESCRIPTION)) != 0) {
209
				| IResourceDelta.TYPE | IResourceDelta.DESCRIPTION)) != 0) {
210
			runnables.add(getUpdateRunnable(resource));
210
			runnables.add(getUpdateRunnable(resource));
211
		}
211
		}
(-)src/org/eclipse/ui/views/navigator/WorkspaceActionGroup.java (-2 / +60 lines)
Lines 11-29 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.ui.views.navigator;
12
package org.eclipse.ui.views.navigator;
13
13
14
import java.lang.reflect.InvocationTargetException;
14
import java.util.Iterator;
15
import java.util.Iterator;
15
16
16
import org.eclipse.core.resources.ICommand;
17
import org.eclipse.core.resources.ICommand;
17
import org.eclipse.core.resources.IProject;
18
import org.eclipse.core.resources.IProject;
18
import org.eclipse.core.resources.IncrementalProjectBuilder;
19
import org.eclipse.core.resources.IncrementalProjectBuilder;
19
import org.eclipse.core.resources.ResourcesPlugin;
20
import org.eclipse.core.resources.ResourcesPlugin;
21
import org.eclipse.core.resources.WorkspaceJob;
20
import org.eclipse.core.runtime.CoreException;
22
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.IAdaptable;
23
import org.eclipse.core.runtime.IAdaptable;
24
import org.eclipse.core.runtime.IProgressMonitor;
25
import org.eclipse.core.runtime.IStatus;
26
import org.eclipse.core.runtime.Status;
27
import org.eclipse.core.runtime.jobs.ISchedulingRule;
22
import org.eclipse.jface.action.IMenuManager;
28
import org.eclipse.jface.action.IMenuManager;
23
import org.eclipse.jface.viewers.IStructuredSelection;
29
import org.eclipse.jface.viewers.IStructuredSelection;
30
import org.eclipse.jface.viewers.TreeViewer;
24
import org.eclipse.jface.window.IShellProvider;
31
import org.eclipse.jface.window.IShellProvider;
32
import org.eclipse.osgi.util.NLS;
25
import org.eclipse.swt.SWT;
33
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.events.KeyEvent;
34
import org.eclipse.swt.events.KeyEvent;
35
import org.eclipse.swt.widgets.Shell;
27
import org.eclipse.ui.IActionBars;
36
import org.eclipse.ui.IActionBars;
28
import org.eclipse.ui.actions.ActionFactory;
37
import org.eclipse.ui.actions.ActionFactory;
29
import org.eclipse.ui.actions.BuildAction;
38
import org.eclipse.ui.actions.BuildAction;
Lines 31-37 Link Here
31
import org.eclipse.ui.actions.CloseUnrelatedProjectsAction;
40
import org.eclipse.ui.actions.CloseUnrelatedProjectsAction;
32
import org.eclipse.ui.actions.OpenResourceAction;
41
import org.eclipse.ui.actions.OpenResourceAction;
33
import org.eclipse.ui.actions.RefreshAction;
42
import org.eclipse.ui.actions.RefreshAction;
43
import org.eclipse.ui.actions.WorkspaceModifyOperation;
34
import org.eclipse.ui.ide.IDEActionFactory;
44
import org.eclipse.ui.ide.IDEActionFactory;
45
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
46
import org.eclipse.ui.internal.ide.StatusUtil;
35
47
36
/**
48
/**
37
 * This is the action group for workspace actions such as Build, Refresh Local,
49
 * This is the action group for workspace actions such as Build, Refresh Local,
Lines 181-191 Link Here
181
    }
193
    }
182
194
183
    protected void makeActions() {
195
    protected void makeActions() {
184
        IShellProvider provider = navigator.getSite();
196
        final IShellProvider provider = navigator.getSite();
185
        openProjectAction = new OpenResourceAction(provider);
197
        openProjectAction = new OpenResourceAction(provider);
186
        closeProjectAction = new CloseResourceAction(provider);
198
        closeProjectAction = new CloseResourceAction(provider);
187
        closeUnrelatedProjectsAction = new CloseUnrelatedProjectsAction(provider);
199
        closeUnrelatedProjectsAction = new CloseUnrelatedProjectsAction(provider);
188
        refreshAction = new RefreshAction(provider);
200
        refreshAction = new RefreshAction(provider) {
201
        	public void run() {
202
        		final IStatus[] errorStatus = new IStatus[1];
203
        		errorStatus[0] = Status.OK_STATUS;
204
        		final WorkspaceModifyOperation op = (WorkspaceModifyOperation) createOperation(errorStatus);
205
        		WorkspaceJob job = new WorkspaceJob("refresh") { //$NON-NLS-1$
206
207
        			public IStatus runInWorkspace(IProgressMonitor monitor)
208
        					throws CoreException {
209
        				try {
210
        					op.run(monitor);
211
        					Shell shell = provider.getShell();
212
							if (shell != null && !shell.isDisposed()) {
213
								shell.getDisplay().asyncExec(new Runnable() {
214
									public void run() {
215
										TreeViewer viewer = navigator
216
												.getViewer();
217
										if (viewer != null
218
												&& viewer.getControl() != null
219
												&& !viewer.getControl()
220
														.isDisposed()) {
221
											viewer.refresh();
222
										}
223
									}
224
								});
225
							}
226
        				} catch (InvocationTargetException e) {
227
        					String msg = NLS.bind(
228
        							IDEWorkbenchMessages.WorkspaceAction_logTitle, getClass()
229
        									.getName(), e.getTargetException());
230
        					throw new CoreException(StatusUtil.newStatus(IStatus.ERROR,
231
        							msg, e.getTargetException()));
232
        				} catch (InterruptedException e) {
233
        					return Status.CANCEL_STATUS;
234
        				}
235
        				return errorStatus[0];
236
        			}
237
        			
238
        		};
239
        		ISchedulingRule rule = op.getRule();
240
        		if (rule != null) {
241
        			job.setRule(rule);
242
        		}
243
        		job.setUser(true);
244
        		job.schedule();
245
        	}
246
        };
189
        refreshAction
247
        refreshAction
190
                .setDisabledImageDescriptor(getImageDescriptor("dlcl16/refresh_nav.gif"));//$NON-NLS-1$
248
                .setDisabledImageDescriptor(getImageDescriptor("dlcl16/refresh_nav.gif"));//$NON-NLS-1$
191
        refreshAction
249
        refreshAction
(-)src/org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmtActionProvider.java (-1 / +56 lines)
Lines 11-27 Link Here
11
11
12
package org.eclipse.ui.internal.navigator.resources.actions;
12
package org.eclipse.ui.internal.navigator.resources.actions;
13
13
14
import java.lang.reflect.InvocationTargetException;
14
import java.util.Iterator;
15
import java.util.Iterator;
15
16
16
import org.eclipse.core.resources.ICommand;
17
import org.eclipse.core.resources.ICommand;
17
import org.eclipse.core.resources.IProject;
18
import org.eclipse.core.resources.IProject;
18
import org.eclipse.core.resources.IncrementalProjectBuilder;
19
import org.eclipse.core.resources.IncrementalProjectBuilder;
19
import org.eclipse.core.resources.ResourcesPlugin;
20
import org.eclipse.core.resources.ResourcesPlugin;
21
import org.eclipse.core.resources.WorkspaceJob;
20
import org.eclipse.core.runtime.CoreException;
22
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.IAdaptable;
23
import org.eclipse.core.runtime.IAdaptable;
24
import org.eclipse.core.runtime.IProgressMonitor;
25
import org.eclipse.core.runtime.IStatus;
26
import org.eclipse.core.runtime.Status;
27
import org.eclipse.core.runtime.jobs.ISchedulingRule;
22
import org.eclipse.jface.action.IMenuManager;
28
import org.eclipse.jface.action.IMenuManager;
23
import org.eclipse.jface.resource.ImageDescriptor;
29
import org.eclipse.jface.resource.ImageDescriptor;
24
import org.eclipse.jface.viewers.IStructuredSelection;
30
import org.eclipse.jface.viewers.IStructuredSelection;
31
import org.eclipse.jface.viewers.StructuredViewer;
32
import org.eclipse.osgi.util.NLS;
25
import org.eclipse.swt.widgets.Shell;
33
import org.eclipse.swt.widgets.Shell;
26
import org.eclipse.ui.IActionBars;
34
import org.eclipse.ui.IActionBars;
27
import org.eclipse.ui.actions.ActionFactory;
35
import org.eclipse.ui.actions.ActionFactory;
Lines 30-37 Link Here
30
import org.eclipse.ui.actions.CloseUnrelatedProjectsAction;
38
import org.eclipse.ui.actions.CloseUnrelatedProjectsAction;
31
import org.eclipse.ui.actions.OpenResourceAction;
39
import org.eclipse.ui.actions.OpenResourceAction;
32
import org.eclipse.ui.actions.RefreshAction;
40
import org.eclipse.ui.actions.RefreshAction;
41
import org.eclipse.ui.actions.WorkspaceModifyOperation;
33
import org.eclipse.ui.ide.IDEActionFactory;
42
import org.eclipse.ui.ide.IDEActionFactory;
43
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
34
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
44
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
45
import org.eclipse.ui.internal.ide.StatusUtil;
35
import org.eclipse.ui.navigator.CommonActionProvider;
46
import org.eclipse.ui.navigator.CommonActionProvider;
36
import org.eclipse.ui.navigator.ICommonActionExtensionSite;
47
import org.eclipse.ui.navigator.ICommonActionExtensionSite;
37
import org.eclipse.ui.navigator.ICommonMenuConstants;
48
import org.eclipse.ui.navigator.ICommonMenuConstants;
Lines 187-193 Link Here
187
        
198
        
188
        closeUnrelatedProjectsAction = new CloseUnrelatedProjectsAction(shell);
199
        closeUnrelatedProjectsAction = new CloseUnrelatedProjectsAction(shell);
189
        
200
        
190
        refreshAction = new RefreshAction(shell);
201
        refreshAction = new RefreshAction(shell) {
202
        	public void run() {
203
        		final IStatus[] errorStatus = new IStatus[1];
204
        		errorStatus[0] = Status.OK_STATUS;
205
        		final WorkspaceModifyOperation op = (WorkspaceModifyOperation) createOperation(errorStatus);
206
        		WorkspaceJob job = new WorkspaceJob("refresh") { //$NON-NLS-1$
207
208
        			public IStatus runInWorkspace(IProgressMonitor monitor)
209
        					throws CoreException {
210
        				try {
211
        					op.run(monitor);
212
							if (shell != null && !shell.isDisposed()) {
213
								shell.getDisplay().asyncExec(new Runnable() {
214
									public void run() {
215
										StructuredViewer viewer = getActionSite().getStructuredViewer();
216
										if (viewer != null
217
												&& viewer.getControl() != null
218
												&& !viewer.getControl()
219
														.isDisposed()) {
220
											viewer.refresh();
221
										}
222
									}
223
								});
224
							}
225
        				} catch (InvocationTargetException e) {
226
        					String msg = NLS.bind(
227
        							IDEWorkbenchMessages.WorkspaceAction_logTitle, getClass()
228
        									.getName(), e.getTargetException());
229
        					throw new CoreException(StatusUtil.newStatus(IStatus.ERROR,
230
        							msg, e.getTargetException()));
231
        				} catch (InterruptedException e) {
232
        					return Status.CANCEL_STATUS;
233
        				}
234
        				return errorStatus[0];
235
        			}
236
        			
237
        		};
238
        		ISchedulingRule rule = op.getRule();
239
        		if (rule != null) {
240
        			job.setRule(rule);
241
        		}
242
        		job.setUser(true);
243
        		job.schedule();
244
        	}
245
        };
191
        refreshAction
246
        refreshAction
192
                .setDisabledImageDescriptor(getImageDescriptor("dlcl16/refresh_nav.gif"));//$NON-NLS-1$
247
                .setDisabledImageDescriptor(getImageDescriptor("dlcl16/refresh_nav.gif"));//$NON-NLS-1$
193
        refreshAction
248
        refreshAction

Return to bug 223976