From 5e319c192c350c92199297fabc71d8efe940f1b0 Mon Sep 17 00:00:00 2001 From: Daniel Rolka Date: Wed, 18 Sep 2013 17:12:30 +0200 Subject: Bug 384354 - Compatibility: Editor actions registered via extension point org.eclipse.ui.editorActions are shown twice in the toolbar Change-Id: I9cdba5c4407ae40a9e41c11c15ef3a85ab81e835 Signed-off-by: Daniel Rolka --- .../Eclipse UI/org/eclipse/ui/internal/menus/ActionSet.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ActionSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ActionSet.java index 9a8f17e51a8..178453a68b7 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ActionSet.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ActionSet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2012 IBM Corporation and others. + * Copyright (c) 2010, 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 @@ -307,9 +307,10 @@ public class ActionSet { ArrayList trimContributions, IConfigurationElement element, String parentId) { String tpath = MenuHelper.getToolBarPath(element); - if (tpath == null) { + if (tpath == null || isEditorAction(element)) { return; } + if (tpath.endsWith("/")) { //$NON-NLS-1$ tpath += IWorkbenchActionConstants.MB_ADDITIONS; } @@ -319,6 +320,7 @@ public class ActionSet { if (action == null) { return; } + action.getTransientData().put("Name", MenuHelper.getLabel(element)); //$NON-NLS-1$ action.getTransientData().put("ActionSet", id); //$NON-NLS-1$ @@ -368,11 +370,16 @@ public class ActionSet { toolBarContribution.setPositionInParent(positionInParent); toolBarContribution.setVisibleWhen(createVisibleWhen()); - toolBarContribution.getChildren().add(action); + contributions.add(toolBarContribution); } + private boolean isEditorAction(IConfigurationElement element) { + return IWorkbenchRegistryConstants.EXTENSION_EDITOR_ACTIONS.equals(element + .getDeclaringExtension().getExtensionPointUniqueIdentifier()); + } + private void addTrimContribution(String idContrib, ArrayList contributions, ArrayList trimContributions, IConfigurationElement element, -- cgit v1.2.3