Project: JDT
Bug 84004 OpenCloseWorkingSetAction actions visible when no selection
Reported: 2005-01-30 03:43:31 | Status: resolved fixed

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

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/workingsets/OpenCloseWorkingSetAction.java