Bug 71695 [WorkingSets]Removed Working Set is still shown under the menu item when it is the recentlly used working set
Create a project Go to the Project + Build Working Set + Select Working Set menu item Create a new working set "test" Reopen the Select Working Set window Remove the "test" working set Go to the Project + Build Working Set menu item Result: the "test" working set is still shown It will be removed when we change the current working set to a differrent one, or restart eclipse. I have fixed it in /org.eclipse.ui.ide/src- ide/org/eclipse/ui/internal/ide/actions/BuildSetMenu.java /** * Fills the menu with Show View actions. */ private void fillMenu(Menu menu) { boolean isAutoBuilding = ResourcesPlugin.getWorkspace ().isAutoBuilding(); //build MRU list of recently built working sets: IWorkingSet[] sets = window.getWorkbench().getWorkingSetManager ().getRecentWorkingSets(); BuildSetAction last = BuildSetAction.lastBuilt; IWorkingSet lastSet = null; //add build action for the last working set that was built int accel = 1; if (last != null) { + // add it only if it has not been removed + boolean found = false; + for (int i = 0; i < sets.length; i++) { + if (sets[i].equals(last.getWorkingSet())){ + found = true; + break; + } + } + if (found == true) { last.setChecked(true); last.setEnabled(!isAutoBuilding); last.setActionDefinitionId ("org.eclipse.ui.project.buildLast"); //$NON-NLS-1$ addMnemonic(last, accel++); new ActionContributionItem(last).fill(menu, -1); lastSet = last.getWorkingSet(); + } } //add build actions for the most recently used working sets for (int i = 0; i < sets.length; i++) { if (lastSet != null && lastSet.equals(sets[i])) continue; BuildSetAction action = new BuildSetAction(sets[i], window, actionBars); addMnemonic(action, accel++); action.setEnabled(!isAutoBuilding); new ActionContributionItem(action).fill(menu, -1); } //add the action to select a different working set new Separator().fill(menu, -1); selectBuildWorkingSetAction.setEnabled(!isAutoBuilding); new ActionContributionItem(selectBuildWorkingSetAction).fill (menu, -1); }
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/actions/BuildSetMenu.java
label.append(action.getWorkingSet().getName());
        action.setText(label.toString());
    }
    /* (non-Javadoc)
     * @see org.eclipse.jface.action.IContributionItem#fill(org.eclipse.swt.widgets.Menu, int)
     */
    public void fill(Menu menu, int index) {
        if (getParent() instanceof MenuManager)
            ((MenuManager) getParent()).addMenuListener(menuListener);
        if (!dirty)
            return;
        fillMenu(menu);
        dirty = false;
    }
    /**
     * Fills the menu with Show View actions.
     */
    private void fillMenu(Menu menu) {
        boolean isAutoBuilding = ResourcesPlugin.getWorkspace()
                .isAutoBuilding();
        
        IWorkingSet[] sets = window.getWorkbench().getWorkingSetManager()
                .getRecentWorkingSets();
        BuildSetAction last = BuildSetAction.lastBuilt;
        IWorkingSet lastSet = null;
        
        int accel = 1;
        if (last != null) {
            last.setChecked(true);
            last.setEnabled(!isAutoBuilding);