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
/**********************************************************************
 * Copyright (c) 2004 IBM Corporation and others. All rights reserved.   This
 * program and the accompanying materials are made available under the terms of
 * the Common Public License v1.0 which accompanies this distribution, and is
 * available at http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors: 
 * IBM - Initial API and implementation
 **********************************************************************/
package org.eclipse.ui.internal.ide.actions;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.application.IActionBarConfigurer;
/**
 * Sub-menu off project menu for showing MRU list of working set builds.
 * 
 * @since 3.0
 */
public class BuildSetMenu extends ContributionItem {