View | Details | Raw Unified | Return to bug 374017
Collapse All | Expand All

(-)a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/RefreshAction.java (+11 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Brett Randall <javabrett@gmail.com> - Bug 374017 https://bugs.eclipse.org/374017
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.ui.actions;
12
package org.eclipse.ui.actions;
12
13
Lines 190-195 public class RefreshAction extends WorkspaceAction { Link Here
190
	}
191
	}
191
192
192
	/**
193
	/**
194
	 * Overrides {@link WorkspaceAction#updateSelected(IResource)} so that {@link IProject}
195
	 * instances are always considered refreshable.
196
	 *
197
	 * @see org.eclipse.ui.actions.WorkspaceAction#updateSelected(org.eclipse.core.resources.IResource)
198
	 */
199
	protected boolean updateSelected(IResource resource) {
200
		return (resource instanceof IProject || super.updateSelected(resource));
201
	}
202
203
	/**
193
	 * Handle the key release.
204
	 * Handle the key release.
194
	 * 
205
	 * 
195
	 * @param event
206
	 * @param event
(-)a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/WorkspaceAction.java (-1 / +19 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Brett Randall <javabrett@gmail.com> - Bug 374017 https://bugs.eclipse.org/374017
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.ui.actions;
12
package org.eclipse.ui.actions;
12
13
Lines 392-398 public abstract class WorkspaceAction extends SelectionListenerAction { Link Here
392
		}
393
		}
393
		for (Iterator i = getSelectedResources().iterator(); i.hasNext();) {
394
		for (Iterator i = getSelectedResources().iterator(); i.hasNext();) {
394
			IResource r = (IResource) i.next();
395
			IResource r = (IResource) i.next();
395
			if (!r.isAccessible()) {
396
			if (!updateSelected(r)) {
396
				return false;
397
				return false;
397
			}
398
			}
398
		}
399
		}
Lines 400-405 public abstract class WorkspaceAction extends SelectionListenerAction { Link Here
400
	}
401
	}
401
402
402
	/**
403
	/**
404
	 * Called by {@link #updateSelection(IStructuredSelection)} to test each
405
	 * selected resource. If any resource returns false, the selection update
406
	 * will result in a disabled action.
407
	 *
408
	 * This implementation returns true if a resource is accessible, otherwise
409
	 * it returns false. Subclasses may override this behaviour with a more
410
	 * specific resource test.
411
	 *
412
	 * @param resource
413
	 * @return true if the current resource is selectable for this action
414
	 * @since 3.8
415
	 */
416
	protected boolean updateSelected(IResource resource) {
417
		return resource.isAccessible();
418
	}
419
420
	/**
403
	 * Returns the elements that the action is to be performed on. By default
421
	 * Returns the elements that the action is to be performed on. By default
404
	 * return the selected resources.
422
	 * return the selected resources.
405
	 * <p>
423
	 * <p>
(-)a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/views/navigator/WorkspaceActionGroup.java (-1 / +2 lines)
Lines 8-13 Link Here
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Sebastian Davids <sdavids@gmx.de> - Images for menu items (27481)
10
 *     Sebastian Davids <sdavids@gmx.de> - Images for menu items (27481)
11
 *     Brett Randall <javabrett@gmail.com> - Bug 374017 https://bugs.eclipse.org/374017
11
 *******************************************************************************/
12
 *******************************************************************************/
12
package org.eclipse.ui.views.navigator;
13
package org.eclipse.ui.views.navigator;
13
14
Lines 142-148 public class WorkspaceActionGroup extends ResourceNavigatorActionGroup { Link Here
142
            buildAction.selectionChanged(selection);
143
            buildAction.selectionChanged(selection);
143
            menu.add(buildAction);
144
            menu.add(buildAction);
144
        }
145
        }
145
        if (!hasClosedProjects) {
146
        if (hasOpenProjects) {
146
            refreshAction.selectionChanged(selection);
147
            refreshAction.selectionChanged(selection);
147
            menu.add(refreshAction);
148
            menu.add(refreshAction);
148
        }
149
        }
(-)a/bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmtActionProvider.java (-2 / +2 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Brett Randall <javabrett@gmail.com> - Bug 374017 https://bugs.eclipse.org/374017
10
 *******************************************************************************/
11
 *******************************************************************************/
11
12
12
package org.eclipse.ui.internal.navigator.resources.actions;
13
package org.eclipse.ui.internal.navigator.resources.actions;
Lines 152-158 public class ResourceMgmtActionProvider extends CommonActionProvider { Link Here
152
			buildAction.selectionChanged(selection);
153
			buildAction.selectionChanged(selection);
153
			menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, buildAction);
154
			menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, buildAction);
154
		}
155
		}
155
		if (!hasClosedProjects) {
156
		if (hasOpenProjects) {
156
			refreshAction.selectionChanged(selection);
157
			refreshAction.selectionChanged(selection);
157
			menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, refreshAction);
158
			menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, refreshAction);
158
		}
159
		}
159
- 

Return to bug 374017