Bug 84004 OpenCloseWorkingSetAction actions visible when no selection
Version: 3.1.0 Build id: I20050125-0800 When there is no selection in the package explorer (when you have collapsed a tree item for example) the context menu contains actions for "open project", "open projects" and "close projects". The only one that does anything is "open project", although it shouldn't be visible. OpenCloseWorkingSetAction#getProjects (both of them) are returning an empty array and the actions are enabled if the election is != null. Forcing the getProjects methods to return null when the list is empty fixed the problem for me. ie: if (selection.isEmpty()) return null; for the one that takes a structured selection and if (set.getElements().length == 0) return null; for the one taht takes a working set
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/workingsets/OpenCloseWorkingSetAction.java
}
			protected String getErrorTitle() {
				return WorkingSetMessages.getString("OpenCloseWorkingSetAction.close.error.title"); 
			}
			protected String getErrorMessage() {
				return WorkingSetMessages.getString("OpenCloseWorkingSetAction.close.error.message"); 
			}
		};
	}
	public static OpenCloseWorkingSetAction createOpenAction(IWorkbenchSite site) {
		return new OpenCloseWorkingSetAction(site, WorkingSetMessages.getString("OpenCloseWorkingSetAction.open.label")) { 
			protected boolean validate(IProject project) {
				return !project.isOpen();
			}
 			protected void performOperation(IProject project, IProgressMonitor monitor) throws CoreException {
				project.open(monitor);
			}
			protected String getErrorTitle() {
				return WorkingSetMessages.getString("OpenCloseWorkingSetAction.open.error.title"); 
			}
			protected String getErrorMessage() {
				return WorkingSetMessages.getString("OpenCloseWorkingSetAction.open.error.message"); 
			}
		};
	}
	
	public void dispose() {
		ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
	}
	public void selectionChanged(IStructuredSelection selection) {