summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorPatrick Chuong2013-04-05 15:19:38 (EDT)
committer Gerrit Code Review @ Eclipse.org2013-04-08 09:18:25 (EDT)
commitc62a3ef10e498c7866dc395bfbf81c1ed8fe20fe (patch)
tree91d666fae66df58e8226612c88e447ad7552431b
parentbef4ce9767b8076dd7a5fa8f468ac93ecbaa8ce0 (diff)
downloadeclipse.platform.ui-c62a3ef10e498c7866dc395bfbf81c1ed8fe20fe.zip
eclipse.platform.ui-c62a3ef10e498c7866dc395bfbf81c1ed8fe20fe.tar.gz
eclipse.platform.ui-c62a3ef10e498c7866dc395bfbf81c1ed8fe20fe.tar.bz2
Bug 391481 - Contributing perspectiveExtension, hiddenMenuItem removes arefs/changes/94/11694/3
menu from multiple perspectives Change-Id: I7acbde5625fab23aa7fbe8932970773dc9c07a51
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
index f2b1e47..249455d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -8,6 +8,8 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Zhongwei Zhao - Bug 379495 - Two "Run" on top menu
+ * Patrick Chuong - Bug 391481 - Contributing perspectiveExtension, hiddenMenuItem
+ * removes a menu from multiple perspectives
*******************************************************************************/
package org.eclipse.ui.internal;
@@ -86,6 +88,7 @@ import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.StatusLineManager;
+import org.eclipse.jface.action.SubContributionItem;
import org.eclipse.jface.commands.ActionHandler;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.internal.provisional.action.CoolBarManager2;
@@ -1274,9 +1277,31 @@ public class WorkbenchWindow implements IWorkbenchWindow {
}
/**
+ * Mark contributions dirty for future update.
+ */
+ private void allowUpdates(IMenuManager menuManager) {
+ menuManager.markDirty();
+ final IContributionItem[] items = menuManager.getItems();
+ for (int i = 0; i < items.length; i++) {
+ if (items[i] instanceof IMenuManager) {
+ allowUpdates((IMenuManager) items[i]);
+ } else if (items[i] instanceof SubContributionItem) {
+ final IContributionItem innerItem = ((SubContributionItem) items[i]).getInnerItem();
+ if (innerItem instanceof IMenuManager) {
+ allowUpdates((IMenuManager) innerItem);
+ }
+ }
+ }
+ }
+
+ /**
* Fires perspective activated
*/
void firePerspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
+ IMenuManager windowManager = ((WorkbenchPage) page).getActionBars().getMenuManager();
+ allowUpdates(windowManager);
+ windowManager.update(false);
+
UIListenerLogging.logPerspectiveEvent(this, page, perspective,
UIListenerLogging.PLE_PERSP_ACTIVATED);
perspectiveListeners.firePerspectiveActivated(page, perspective);