Bug 186344 [CommonNavigator] Project Explorer duplicates Working Set actions
M7 The Project Explorer sometimes creates duplicate Working Set related view menu items. This seems to be triggered by "Link with Editor" on startup where two instances of WorkingSetActionProvider are created and initialized. The following is a stack trace at the point where the WorkingSetActionProvider adds its actions. Note the recursion starting in NavigatorActionService.getActionProviderInstance() Thread [main] (Suspended (breakpoint at line 277 in WorkingSetActionProvider)) owns: HashMap<K,V> (id=142) owns: RunnableLock (id=143) WorkingSetActionProvider.fillActionBars(IActionBars) line: 277 NavigatorActionService.initialize(String, CommonActionProvider) line: 353 NavigatorActionService.getActionProviderInstance(CommonActionProviderDescriptor) line: 332 NavigatorActionService.fillActionBars(IActionBars) line: 236 CommonNavigatorManager.selectionChanged(SelectionChangedEvent) line: 217 Viewer$2.run() line: 162 SafeRunner.run(ISafeRunnable) line: 37 Platform.run(ISafeRunnable) line: 850 JFaceUtil$1.run(ISafeRunnable) line: 46 SafeRunnable.run(ISafeRunnable) line: 193 CommonViewer(Viewer).fireSelectionChanged(SelectionChangedEvent) line: 160 CommonViewer(StructuredViewer).updateSelection(ISelection) line: 2039 CommonViewer(StructuredViewer).handleInvalidSelection(ISelection, ISelection) line: 1102 CommonViewer(StructuredViewer).preservingSelection(Runnable, boolean) line: 1376 CommonViewer(TreeViewer).preservingSelection(Runnable, boolean) line: 377 CommonViewer(StructuredViewer).preservingSelection(Runnable) line: 1325 CommonViewer(AbstractTreeViewer).inputChanged(Object, Object) line: 1417 CommonViewer(ContentViewer).setInput(Object) line: 251 CommonViewer(StructuredViewer).setInput(Object) line: 1601 WorkingSetActionProvider.restoreState(IMemento) line: 237 NavigatorActionService.initialize(String, CommonActionProvider) line: 350 NavigatorActionService.getActionProviderInstance(CommonActionProviderDescriptor) line: 332 NavigatorActionService.fillActionBars(IActionBars) line: 236 CommonNavigatorManager.selectionChanged(SelectionChangedEvent) line: 217 Viewer$2.run() line: 162 SafeRunner.run(ISafeRunnable) line: 37 Platform.run(ISafeRunnable) line: 850 JFaceUtil$1.run(ISafeRunnable) line: 46 SafeRunnable.run(ISafeRunnable) line: 193 CommonViewer(Viewer).fireSelectionChanged(SelectionChangedEvent) line: 160 CommonViewer(StructuredViewer).updateSelection(ISelection) line: 2039 CommonViewer(StructuredViewer).setSelection(ISelection, boolean) line: 1636 CommonViewer(TreeViewer).setSelection(ISelection, boolean) line: 1031 CommonViewer.setSelection(ISelection, boolean) line: 325 CommonNavigator.selectReveal(ISelection) line: 313 LinkEditorAction$2.runInUIThread(IProgressMonitor) line: 91 UIJob$1.run() line: 94 [...]
bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/NavigatorActionService.java
/*******************************************************************************
 * Copyright (c) 2003, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.ui.navigator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.Assert;