Skip to content

Commit 4449476

Browse files
Refresh option only available for projects #1904
Further fixes, since the initial change didn't cover all cases
1 parent 2521210 commit 4449476

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmtActionProvider.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,12 @@ public void fillContextMenu(IMenuManager menu) {
117117
boolean isProjectSelection = true;
118118
boolean hasOpenProjects = false;
119119
boolean hasClosedProjects = false;
120-
boolean hasBuilder = true; // false if any project is closed or does not
121-
// have builder
120+
boolean hasBuilder = true; // false if any project is closed or does not have builder
121+
List<IProject> projects = selectionToProjects(selection);
122+
Iterator<IProject> projectIter = projects.iterator();
122123

123-
Iterator<IProject> projects = selectionToProjects(selection).iterator();
124-
125-
while (projects.hasNext() && (!hasOpenProjects || !hasClosedProjects || hasBuilder || isProjectSelection)) {
126-
IProject project = projects.next();
124+
while (projectIter.hasNext() && (!hasOpenProjects || !hasClosedProjects || hasBuilder || isProjectSelection)) {
125+
IProject project = projectIter.next();
127126

128127
if (project == null) {
129128
isProjectSelection = false;
@@ -146,9 +145,9 @@ public void fillContextMenu(IMenuManager menu) {
146145
menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, buildAction);
147146
}
148147
// Add the 'refresh' item if any selection is either (a) an open project, or (b)
149-
// a non-project selection (so the 'refresh' item is not shown if all selections
150-
// are closed projects)
151-
if (hasOpenProjects || !isProjectSelection) {
148+
// a non-project selection (so the 'refresh' item is not shown if all selections
149+
// are closed projects)
150+
if (hasOpenProjects || projects.size() < selection.size()) {
152151
refreshAction.selectionChanged(selection);
153152
menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, refreshAction);
154153
}

0 commit comments

Comments
 (0)