Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/menus/LayoutNode.java1
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/menus/SMenuLayout.java2
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/menus/SMenuManager.java2
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/menus/SPartMenuLayout.java1
-rwxr-xr-xbundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuService.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IMenuService.java4
6 files changed, 8 insertions, 6 deletions
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/menus/LayoutNode.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/menus/LayoutNode.java
new file mode 100644
index 00000000000..827a7da7378
--- /dev/null
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/menus/LayoutNode.java
@@ -0,0 +1 @@
+/******************************************************************************* * Copyright (c) 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.jface.menus; import java.util.Collection; import java.util.HashMap; import java.util.Map; /** * A node within a menu layout. A node has contains a menu element and some * child nodes. * <p> * This class is only intended to be used from within the * <code>org.eclipse.jface</code> plug-in. * </p> * <p> * <strong>EXPERIMENTAL</strong>. This class or interface has been added as * part of a work in progress. There is a guarantee neither that this API will * work nor that it will remain the same. Please do not use this API without * consulting with the Platform/UI team. * </p> * * @since 3.2 * */ final class LayoutNode { /** * The children of this node indexed by their identifiers. This map is never * <code>null</code> */ private final Map childrenById; /** * The element this node represents. This value may be <code>null</code> * if this is a top-level node in some menu layout structure, or if the * element is implied. */ private MenuElement element; /** * The identifier for this layout node. This is used for implied elements to * provide something meaningful. */ private final String id; /** * The identifiers of the children, but in the order indicating by their * ordering constraints. This list is lazily generated. TODO This isn't * needed yet. */ // private List orderedChildIds; /** * Constructs a new <code>SMenuLayout</code>. * * @param id * The identifier for this layout node; may be <code>null</code>. */ LayoutNode(final String id) { this.id = id; childrenById = new HashMap(11); } /** * Retrieves the child node with the given identifier. If no such node * exists yet, it is created. * * @param id * The identifier of the child node to retrieve; must not be * <code>null</code>. * @return The child node; never <code>null</code>. */ final LayoutNode getChildNode(final String id) { if (id == null) { throw new NullPointerException( "A child node cannot have a null identifier"); //$NON-NLS-1$ } LayoutNode childNode = (LayoutNode) childrenById.get(id); if (childNode == null) { childNode = new LayoutNode(id); childrenById.put(id, childNode); } return childNode; } /** * Returns the children of this node, if any. * * @return The children; never <code>null</code>, but may be empty. */ final Collection getChildren() { return childrenById.values(); } /** * Returns the menu element for this node. * * @return The menu element; may be <code>null</code>. */ final MenuElement getMenuElement() { return element; } /** * Returns the identifier for this node. * * @return The node identifier; may be <code>null</code>. */ final String getId() { if (element != null) { return element.getId(); } return id; } /** * Sets the menu element for this node. * * @param element * The element to set; must not be <code>null</code>. */ final void setElement(final MenuElement element) { if (element == null) { throw new NullPointerException( "A node cannot be given a null element"); //$NON-NLS-1$ } this.element = element; } } \ No newline at end of file
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/menus/SMenuLayout.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/menus/SMenuLayout.java
index e04b4669120..24f38d4d271 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/menus/SMenuLayout.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/menus/SMenuLayout.java
@@ -1 +1 @@
-/******************************************************************************* * Copyright (c) 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.jface.menus; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.StringTokenizer; import org.eclipse.core.commands.common.NotDefinedException; /** * <p> * The layout of various menu elements. A layout includes all menus, groups, * items and widgets -- regardless of whether they are currently visible. * </p> * <p> * There are three basic types of menu elements: part, popup and bar. Each of * these fundamental types has a map of subelements -- indexed by some string. * </p> * <p> * Clients may instantiate, but must not extend. * </p> * <p> * <strong>EXPERIMENTAL</strong>. This class or interface has been added as * part of a work in progress. There is a guarantee neither that this API will * work nor that it will remain the same. Please do not use this API without * consulting with the Platform/UI team. * </p> * * @since 3.2 */ public final class SMenuLayout { /** * A node within a menu layout. A node has contains a menu element and some * child nodes. */ private static final class Node { /** * The children of this node indexed by their identifiers. This map is * never <code>null</code> */ private final Map childrenById; /** * The element this node represents. This value may be <code>null</code> * iff this is a top-level node in some menu layout structure. */ private MenuElement element; /** * The identifiers of the children, but in the order indicating by their * ordering constraints. This list is lazily generated. TODO This isn't * needed yet. */ // private List orderedChildIds; /** * Constructs a new <code>SMenuLayout</code>. */ private Node() { childrenById = new HashMap(11); } /** * Retrieves the child node with the given identifier. If no such node * exists yet, it is created. * * @param id * The identifier of the child node to retrieve; must not be * <code>null</code>. * @return The child node; never <code>null</code>. */ private final Node getChildNode(final String id) { if (id == null) { throw new NullPointerException( "A child node cannot have a null identifier"); //$NON-NLS-1$ } Node childNode = (Node) childrenById.get(id); if (childNode == null) { childNode = new Node(); childrenById.put(id, childNode); } return childNode; } /** * Returns the children of this node, if any. * * @return The children; never <code>null</code>, but may be empty. */ private final Collection getChildren() { return childrenById.values(); } /** * Returns the menu element for this node. * * @return The menu element; may be <code>null</code>. */ private final MenuElement getMenuElement() { return element; } /** * Sets the menu element for this node. * * @param element * The element to set; must not be <code>null</code>. */ private final void setElement(final MenuElement element) { if (element == null) { throw new NullPointerException( "A node cannot be given a null element"); //$NON-NLS-1$ } this.element = element; } } /** * <p> * Each character in this string represents a path delimiter that is * understood by this layout class when parsing paths. This can be passed * directly to a string tokenizer for parsing, or the first character can be * used for programmatically generating paths. * </p> * <p> * The character "<code>/</code>" is guaranteed to be a path delimiter. * </p> */ public static final String PATH_DELIMITERS = "/"; //$NON-NLS-1$ /** * Adds an entry into one of the top-level bars. A bar can be a menu bar, a * tool bar, or a status line. * * @param element * The element to insert into the node; must not be * <code>null</code>. * @param bar * The location in a bar; must not be <code>null</code>. * @param barsByType * The bars indexed by type; never <code>null</code>. */ private static final void addBarIntoMap(final MenuElement element, final SBar bar, final Map barsByType) { final String type = bar.getType(); Node node = (Node) barsByType.get(type); if (node == null) { node = new Node(); barsByType.put(type, node); } final String path = bar.getPath(); insertElementIntoNode(element, path, node); } /** * Adds an entry into a part-level menu layout. A part can contain a menu * bar or a tool bar. * * @param element * The element to insert into the node; must not be * <code>null</code>. * @param part * The part indicator; must not be <code>null</code> * @param partsById * The parts indexed by identifier or by type; never * <code>null</code>. */ private static final void addPartIntoMap(final MenuElement element, final SPart part, final Map partsById) { final String partId = part.getPart(); Map partMap = (Map) partsById.get(partId); if (partMap == null) { partMap = new HashMap(); partsById.put(partId, partMap); } // final LeafLocationElement location = part.getLocation(); // TODO The part layout } /** * Adds an entry into a popup menu. * * @param element * The element to insert into the popup; must not be * <code>null</code>. * @param popup * The popup indicator; must not be <code>null</code>. * @param popupsById * The popup menus indexed by identifier; never <code>null</code>. */ private static final void addPopupIntoMap(final MenuElement element, final SPopup popup, final Map popupsById) { final String popupId = popup.getId(); Node node = (Node) popupsById.get(popupId); if (node == null) { node = new Node(); popupsById.put(popupId, node); } final String path = popup.getPath(); insertElementIntoNode(element, path, node); } /** * Generates a menu layout based on a collection of menu elements. This * layout will take into account ordering constraints. * * @param menuElements * The menu elements to be sorted into a menu layout; must not * <code>null</code>. * @return The menu layout corresponding to the menu elements; never * <code>null</code>. */ static final SMenuLayout computeLayout(final Collection menuElements) { final Map barsByType = new HashMap(); final Map partsById = new HashMap(); final Map popupById = new HashMap(); final Iterator elementItr = menuElements.iterator(); while (elementItr.hasNext()) { final MenuElement element = (MenuElement) elementItr.next(); try { final SLocation[] locations = element.getLocations(); for (int i = 0; i < locations.length; i++) { final SLocation location = locations[i]; final LocationElement locationElement = location.getPath(); if (locationElement instanceof SBar) { final SBar bar = (SBar) locationElement; addBarIntoMap(element, bar, barsByType); } else if (locationElement instanceof SPopup) { final SPopup popup = (SPopup) locationElement; addPopupIntoMap(element, popup, popupById); } else if (locationElement instanceof SPart) { final SPart part = (SPart) locationElement; addPartIntoMap(element, part, partsById); } } } catch (final NotDefinedException e) { // This menu element is not defined. Just skip it. } } return new SMenuLayout(barsByType, partsById, popupById); } /** * Inserts a particular path into a map. The layout is represented by a * nesting structure of maps. * * @param element * The element to insert into the node; must not be * <code>null</code>. * @param path * The path to insert; may be <code>null</code>. * @param node * The top-level node representing the layout; must not be * <code>null</code>. */ private static final void insertElementIntoNode(final MenuElement element, final String path, Node node) { if ((path != null) && (path.length() > 0)) { final StringTokenizer tokenizer = new StringTokenizer(path, PATH_DELIMITERS); while (tokenizer.hasMoreTokens()) { final String token = tokenizer.nextToken(); node = node.getChildNode(token); } } final String elementId = element.getId(); final Node newNode = node.getChildNode(elementId); newNode.setElement(element); } /** * The top-level bars for this menu layout, indexed by type ({@link String}). * Each bar is represented by a top-level {@link Node} with no menu element. */ private final Map barsByType; /** * The menu layouts for the various parts, indexed by identifier and type ({@link String}). * TODO Figure out the real structure for this item. */ private final Map partsById; /** * The menu layout for the context menus, indexed by the context menu * identifiers ({@link String}). Each menu is represented by a top-level * {@link Node} with no menu element. */ private final Map popupById; /** * Constructs a new instance of <code>SMenuLayout</code>. */ SMenuLayout(final Map barsByType, final Map partsById, final Map popupById) { this.barsByType = barsByType; this.partsById = partsById; this.popupById = popupById; } /** * This is a debugging method for printing node information. The method is * recursive. * * @param node * The node which should be printed (along with its children) to * the buffer; must not be <code>null</code> * @param buffer * The buffer to which to print; must not be <code>null</code>. * @param indent * The identation level for the node; must be a whole number. */ private final void printNode(final Node node, final StringBuffer buffer, final int indent) { final MenuElement element = node.getMenuElement(); for (int i = 0; i < indent; i++) { buffer.append(' '); } buffer.append(element); buffer.append('\n'); final Collection children = node.getChildren(); final Iterator childItr = children.iterator(); while (childItr.hasNext()) { final Node childNode = (Node) childItr.next(); printNode(childNode, buffer, indent + 2); } } /** * Prints out some debugging information about the entire menu layout. This * information is quite large. */ public final String toString() { final StringBuffer buffer = new StringBuffer(); Iterator entryItr; // Print out the bars. buffer.append(" ***** TOP-LEVEL BARS ***** \n"); //$NON-NLS-1$ entryItr = barsByType.entrySet().iterator(); while (entryItr.hasNext()) { final Map.Entry entry = (Map.Entry) entryItr.next(); final String type = (String) entry.getKey(); Node node = (Node) entry.getValue(); buffer.append(type); buffer.append('\n'); printNode(node, buffer, 2); } // Print out the parts. buffer.append(" ***** PART-SPECIFIC BARS ***** \n"); //$NON-NLS-1$ entryItr = partsById.entrySet().iterator(); while (entryItr.hasNext()) { final Map.Entry entry = (Map.Entry) entryItr.next(); final String partId = (String) entry.getKey(); buffer.append(partId); buffer.append('\n'); // TODO Print out part information. } // Print out the context menus. buffer.append(" ***** CONTEXT MENUS ***** \n"); //$NON-NLS-1$ entryItr = popupById.entrySet().iterator(); while (entryItr.hasNext()) { final Map.Entry entry = (Map.Entry) entryItr.next(); final String id = (String) entry.getKey(); Node node = (Node) entry.getValue(); buffer.append(id); buffer.append('\n'); printNode(node, buffer, 2); } return buffer.toString(); } } \ No newline at end of file
+/******************************************************************************* * Copyright (c) 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.jface.menus; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.StringTokenizer; /** * <p> * A menu layout that includes the bars and the context menus. * </p> * <p> * Clients must not instantiate, and must not extend. * </p> * <p> * <strong>EXPERIMENTAL</strong>. This class or interface has been added as * part of a work in progress. There is a guarantee neither that this API will * work nor that it will remain the same. Please do not use this API without * consulting with the Platform/UI team. * </p> * * @since 3.2 */ class SMenuLayout { /** * The layout node identifier to use for root nodes. */ private static final String ROOT_ID = "root"; //$NON-NLS-1$ /** * <p> * Each character in this string represents a path delimiter that is * understood by this layout class when parsing paths. This can be passed * directly to a string tokenizer for parsing, or the first character can be * used for programmatically generating paths. * </p> * <p> * The character "<code>/</code>" is guaranteed to be a path delimiter. * </p> */ public static final String PATH_DELIMITERS = "/"; //$NON-NLS-1$ /** * Inserts a particular path into a map. The layout is represented by a * nesting structure of maps. * * @param element * The element to insert into the node; must not be * <code>null</code>. * @param path * The path to insert; may be <code>null</code>. * @param node * The top-level node representing the layout; must not be * <code>null</code>. */ protected static final void insertElementIntoNode( final MenuElement element, final String path, LayoutNode node) { if ((path != null) && (path.length() > 0)) { final StringTokenizer tokenizer = new StringTokenizer(path, PATH_DELIMITERS); while (tokenizer.hasMoreTokens()) { final String token = tokenizer.nextToken(); node = node.getChildNode(token); } } final String elementId = element.getId(); final LayoutNode newNode = node.getChildNode(elementId); newNode.setElement(element); } /** * The top-level bars for this menu layout, indexed by type ({@link String}). * Each bar is represented by a top-level {@link LayoutNode} with no menu * element. Never <code>null</code>. */ private final Map barsByType; /** * The menu layout for the context menus, indexed by the context menu * identifiers ({@link String}). Each menu is represented by a top-level * {@link LayoutNode} with no menu element. Never <code>null</code>. */ private final Map popupsById; /** * Constructs a new instance of <code>SMenuLayout</code>. */ protected SMenuLayout() { this.barsByType = new HashMap(); this.popupsById = new HashMap(); } /** * Adds an entry into one of the top-level bars. A bar can be a menu bar, a * tool bar, or a status line. * * @param element * The element to insert into the node; must not be * <code>null</code>. * @param bar * The location in a bar; must not be <code>null</code>. */ protected final void addBar(final MenuElement element, final SBar bar) { final String type = bar.getType(); LayoutNode node = (LayoutNode) barsByType.get(type); if (node == null) { node = new LayoutNode(ROOT_ID); barsByType.put(type, node); } final String path = bar.getPath(); insertElementIntoNode(element, path, node); } /** * Adds an entry into a popup menu. * * @param element * The element to insert into the popup; must not be * <code>null</code>. * @param popup * The popup indicator; must not be <code>null</code>. */ protected final void addPopup(final MenuElement element, final SPopup popup) { final String popupId = popup.getId(); LayoutNode node = (LayoutNode) popupsById.get(popupId); if (node == null) { node = new LayoutNode(ROOT_ID); popupsById.put(popupId, node); } final String path = popup.getPath(); insertElementIntoNode(element, path, node); } /** * Returns the bars indexed by type. Generally, a bar will be a menu bar, a * tool bar or a status line. * * @return The map of bar nodes ({@link LayoutNode} indexed by type; never * <code>null</code>; */ protected final Map getBarsByType() { return barsByType; } /** * Returns the popup menus indexed by identifiers. * * @return The map of context menu nodes ({@link LayoutNode}) indexed by * context menu identifier. */ protected final Map getPopupsById() { return popupsById; } /** * This is a debugging method for printing node information. The method is * recursive. * * @param node * The node which should be printed (along with its children) to * the buffer; must not be <code>null</code> * @param buffer * The buffer to which to print; must not be <code>null</code>. * @param indent * The identation level for the node; must be a whole number. */ protected final void printNode(final LayoutNode node, final StringBuffer buffer, final int indent) { for (int i = 0; i < indent; i++) { buffer.append(' '); } buffer.append(node.getId()); buffer.append('\n'); final Collection children = node.getChildren(); final Iterator childItr = children.iterator(); while (childItr.hasNext()) { final LayoutNode childNode = (LayoutNode) childItr.next(); printNode(childNode, buffer, indent + 2); } } /** * Prints out some debugging information about the entire menu layout. This * information is quite large. */ public String toString() { final StringBuffer buffer = new StringBuffer(); Iterator entryItr; // Print out the bars. buffer.append(" ___ top-level bars ___ \n"); //$NON-NLS-1$ entryItr = getBarsByType().entrySet().iterator(); while (entryItr.hasNext()) { final Map.Entry entry = (Map.Entry) entryItr.next(); final String type = (String) entry.getKey(); buffer.append(' '); buffer.append(' '); buffer.append(type); buffer.append('\n'); LayoutNode node = (LayoutNode) entry.getValue(); printNode(node, buffer, 4); } // Print out the context menus. buffer.append(" ___ context menus ___ \n"); //$NON-NLS-1$ entryItr = getPopupsById().entrySet().iterator(); while (entryItr.hasNext()) { final Map.Entry entry = (Map.Entry) entryItr.next(); final String id = (String) entry.getKey(); buffer.append(' '); buffer.append(' '); buffer.append(id); buffer.append('\n'); LayoutNode node = (LayoutNode) entry.getValue(); printNode(node, buffer, 4); } return buffer.toString(); } } \ No newline at end of file
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/menus/SMenuManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/menus/SMenuManager.java
index 92ed1f819b0..69776c57ed0 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/menus/SMenuManager.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/menus/SMenuManager.java
@@ -1 +1 @@
-/******************************************************************************* * Copyright (c) 2005 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.jface.menus; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.eclipse.core.commands.common.HandleObjectManager; /** * <p> * Manages a group of menu elements. These menu elements include things like * menus, groups, and items. The manager is responsible for handling the layout * of these items with respect to each other. Visibility is controlled * externally by updating the visibility of the menu elements themselves. The * painting of these menu elements on the application window(s) is handler by a * renderer. * </p> * <p> * Clients may instantiate, but must not extend. * </p> * <p> * <strong>EXPERIMENTAL</strong>. This class or interface has been added as * part of a work in progress. There is a guarantee neither that this API will * work nor that it will remain the same. Please do not use this API without * consulting with the Platform/UI team. * </p> * * @since 3.2 */ public final class SMenuManager extends HandleObjectManager implements IActionSetListener, IGroupListener, IItemListener, IMenuListener, IWidgetListener { /** * The map of action set identifiers (<code>String</code>) to action set ( * <code>SActionSet</code>). This collection may be empty, but it is * never <code>null</code>. */ private final Map actionSetsById = new HashMap(); /** * The set of action sets that are defined. This value may be empty, but it * is never <code>null</code>. */ private final Set definedActionSets = new HashSet(); /** * The set of groups that are defined. This value may be empty, but it is * never <code>null</code>. */ private final Set definedGroups = new HashSet(); /** * The set of identifiers for those menus that are defined. This value may * be empty, but it is never <code>null</code>. */ private final Set definedMenus = new HashSet(); /** * The set of identifiers for those widgets that are defined. This value may * be empty, but it is never <code>null</code>. */ private final Set definedWidgets = new HashSet(); /** * The layout for this menu manager. This layout is <code>null</code> if * the menu manager has changed since the last layout was built. */ private SMenuLayout layout = null; /** * The map of group identifiers (<code>String</code>) to groups ( * <code>SGroup</code>). This collection may be empty, but it is never * <code>null</code>. */ private final Map groupsById = new HashMap(); /** * The map of menu identifiers (<code>String</code>) to menus ( * <code>SMenu</code>). This collection may be empty, but it is never * <code>null</code>. */ private final Map menusById = new HashMap(); /** * The map of widget identifiers (<code>String</code>) to widgets ( * <code>SWidget</code>). This collection may be empty, but it is never * <code>null</code>. */ private final Map widgetsById = new HashMap(); public final void actionSetChanged(final ActionSetEvent actionSetEvent) { if (actionSetEvent.isDefinedChanged()) { final SActionSet actionSet = actionSetEvent.getActionSet(); final boolean actionSetIdAdded = actionSet.isDefined(); if (actionSetIdAdded) { definedActionSets.add(actionSet); } else { definedActionSets.remove(actionSet); } if (isListenerAttached()) { final String actionSetId = actionSet.getId(); fireMenuManagerChanged(new MenuManagerEvent(this, null, false, null, false, null, false, null, false, actionSetId, actionSetIdAdded)); } } } /** * Adds a listener to this menu manager that will be notified when this * manager's state changes. * * @param listener * The listener to be added; must not be <code>null</code>. */ public final void addListener(final IMenuManagerListener listener) { addListenerObject(listener); } /** * Notifies listeners to this menu manager that it has changed in some way. * * @param event * The event to fire; may be <code>null</code>. */ private final void fireMenuManagerChanged(final MenuManagerEvent event) { if (event == null) { return; } final Object[] listeners = getListeners(); for (int i = 0; i < listeners.length; i++) { final IMenuManagerListener listener = (IMenuManagerListener) listeners[i]; listener.menuManagerChanged(event); } } /** * Gets the action set with the given identifier. If no such action set * currently exists, then the action set will be created (but will be * undefined). * * @param actionSetId * The identifier to find; must not be <code>null</code> and * must not be zero-length. * @return The action set with the given identifier; this value will never * be <code>null</code>, but it might be undefined. * @see SActionSet */ public final SActionSet getActionSet(final String actionSetId) { checkId(actionSetId); SActionSet actionSet = (SActionSet) actionSetsById.get(actionSetId); if (actionSet == null) { actionSet = new SActionSet(actionSetId); actionSetsById.put(actionSetId, actionSet); actionSet.addListener(this); } return actionSet; } /** * Returns those action sets that are defined. * * @return The defined action sets; this value may be empty, but it is never * <code>null</code>. */ public final SActionSet[] getDefinedActionSets() { return (SActionSet[]) definedActionSets .toArray(new SActionSet[definedActionSets.size()]); } /** * Returns those groups that are defined. * * @return The defined groups; this value may be empty, but it is never * <code>null</code>. */ public final SGroup[] getDefinedGroups() { return (SGroup[]) definedGroups .toArray(new SGroup[definedGroups.size()]); } /** * Returns those items that are defined. * * @return The defined items; this value may be empty, but it is never * <code>null</code>. */ public final SItem[] getDefinedItems() { return (SItem[]) definedHandleObjects .toArray(new SItem[definedHandleObjects.size()]); } /** * Returns those menus that are defined. * * @return The defined menus; this value may be empty, but it is never * <code>null</code>. */ public final SMenu[] getDefinedMenus() { return (SMenu[]) definedMenus.toArray(new SMenu[definedMenus.size()]); } /** * Returns those widgets that are defined. * * @return The defined widgets; this value may be empty, but it is never * <code>null</code>. */ public final SWidget[] getDefinedWidgets() { return (SWidget[]) definedWidgets.toArray(new SWidget[definedWidgets .size()]); } /** * Gets the group with the given identifier. If no such group currently * exists, then the group will be created (but will be undefined). * * @param groupId * The identifier to find; must not be <code>null</code> and * must not be zero-length. * @return The group with the given identifier; this value will never be * <code>null</code>, but it might be undefined. * @see SGroup */ public final SGroup getGroup(final String groupId) { checkId(groupId); SGroup group = (SGroup) groupsById.get(groupId); if (group == null) { group = new SGroup(groupId); groupsById.put(groupId, group); group.addListener(this); } return group; } /** * Gets the item with the given identifier. If no such item currently * exists, then the item will be created (but will be undefined). * * @param itemId * The identifier to find; must not be <code>null</code> and * must not be zero-length. * @return The item with the given identifier; this value will never be * <code>null</code>, but it might be undefined. * @see SItem */ public final SItem getItem(final String itemId) { checkId(itemId); SItem item = (SItem) handleObjectsById.get(itemId); if (item == null) { item = new SItem(itemId); handleObjectsById.put(itemId, item); item.addListener(this); } return item; } /** * <p> * Retrieves the layout for the menu elements held by this menu manager. * This layout does not consider visibility or whether the elements are * currently shown. It is simply the layout if everything was visible and * showing. It also does not consider dynamic menu elements, which will be * asked to make changes to the layout before the menu element is shown. * </p> * <p> * The result of this computation is cached between subsequent calls. So, if * no changes are made to the menu elements, the layout can be retrieved in * constant time. Otherwise, it will take <code>O(n)</code> time to * compute, where <code>n</code> is the number of menu elements held by * this manager. * </p> * * @return The menu layout; never <code>null</code>. */ public final SMenuLayout getLayout() { if (layout == null) { // Generate the layout final Collection menuElements = new ArrayList(definedMenus.size() + definedGroups.size() + definedHandleObjects.size() + definedWidgets.size()); menuElements.addAll(definedMenus); menuElements.addAll(definedGroups); menuElements.addAll(definedHandleObjects); menuElements.addAll(definedWidgets); layout = SMenuLayout.computeLayout(menuElements); } return layout; } /** * Gets the menu with the given identifier. If no such menu currently * exists, then the menu will be created (but will be undefined). * * @param menuId * The identifier to find; must not be <code>null</code> and * must not be zero-length. * @return The menu with the given identifier; this value will never be * <code>null</code>, but it might be undefined. * @see SMenu */ public final SMenu getMenu(final String menuId) { checkId(menuId); SMenu menu = (SMenu) menusById.get(menuId); if (menu == null) { menu = new SMenu(menuId); menusById.put(menuId, menu); menu.addListener(this); } return menu; } /** * Gets the widget with the given identifier. If no such widget currently * exists, then the widget will be created (but will be undefined). * * @param widgetId * The identifier to find; must not be <code>null</code> and * must not be zero-length. * @return The item with the given identifier; this value will never be * <code>null</code>, but it might be undefined. * @see SWidget */ public final SWidget getWidget(final String widgetId) { checkId(widgetId); SWidget widget = (SWidget) widgetsById.get(widgetId); if (widget == null) { widget = new SWidget(widgetId); widgetsById.put(widgetId, widget); widget.addListener(this); } return widget; } public final void groupChanged(final GroupEvent groupEvent) { if (groupEvent.isDefinedChanged()) { final SGroup group = groupEvent.getGroup(); final boolean groupIdAdded = group.isDefined(); if (groupIdAdded) { definedGroups.add(group); } else { definedGroups.remove(group); } layout = null; if (isListenerAttached()) { final String groupId = group.getId(); fireMenuManagerChanged(new MenuManagerEvent(this, groupId, groupIdAdded, null, false, null, false, null, false, null, false)); } } } public final void itemChanged(final ItemEvent itemEvent) { if (itemEvent.isDefinedChanged()) { final SItem item = itemEvent.getItem(); final boolean itemIdAdded = item.isDefined(); if (itemIdAdded) { definedHandleObjects.add(item); } else { definedHandleObjects.remove(item); } layout = null; if (isListenerAttached()) { final String itemId = item.getId(); fireMenuManagerChanged(new MenuManagerEvent(this, null, false, itemId, itemIdAdded, null, false, null, false, null, false)); } } } public final void menuChanged(final MenuEvent menuEvent) { if (menuEvent.isDefinedChanged()) { final SMenu menu = menuEvent.getMenu(); final boolean menuIdAdded = menu.isDefined(); if (menuIdAdded) { definedMenus.add(menu); } else { definedMenus.remove(menu); } layout = null; if (isListenerAttached()) { final String menuId = menu.getId(); fireMenuManagerChanged(new MenuManagerEvent(this, null, false, null, false, menuId, menuIdAdded, null, false, null, false)); } } } /** * Removes a listener from this menu manager. * * @param listener * The listener to be removed; must not be <code>null</code>. */ public final void removeListener(final IMenuManagerListener listener) { removeListenerObject(listener); } public final void widgetChanged(final WidgetEvent widgetEvent) { if (widgetEvent.isDefinedChanged()) { final SWidget widget = widgetEvent.getWidget(); final boolean widgetIdAdded = widget.isDefined(); if (widgetIdAdded) { definedWidgets.add(widget); } else { definedWidgets.remove(widget); } layout = null; if (isListenerAttached()) { final String widgetId = widget.getId(); fireMenuManagerChanged(new MenuManagerEvent(this, null, false, null, false, null, false, widgetId, widgetIdAdded, null, false)); } } } } \ No newline at end of file
+/******************************************************************************* * Copyright (c) 2005 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.jface.menus; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.eclipse.core.commands.common.HandleObjectManager; /** * <p> * Manages a group of menu elements. These menu elements include things like * menus, groups, and items. The manager is responsible for handling the layout * of these items with respect to each other. Visibility is controlled * externally by updating the visibility of the menu elements themselves. The * painting of these menu elements on the application window(s) is handler by a * renderer. * </p> * <p> * Clients may instantiate, but must not extend. * </p> * <p> * <strong>EXPERIMENTAL</strong>. This class or interface has been added as * part of a work in progress. There is a guarantee neither that this API will * work nor that it will remain the same. Please do not use this API without * consulting with the Platform/UI team. * </p> * * @since 3.2 */ public final class SMenuManager extends HandleObjectManager implements IActionSetListener, IGroupListener, IItemListener, IMenuListener, IWidgetListener { /** * The map of action set identifiers (<code>String</code>) to action set ( * <code>SActionSet</code>). This collection may be empty, but it is * never <code>null</code>. */ private final Map actionSetsById = new HashMap(); /** * The set of action sets that are defined. This value may be empty, but it * is never <code>null</code>. */ private final Set definedActionSets = new HashSet(); /** * The set of groups that are defined. This value may be empty, but it is * never <code>null</code>. */ private final Set definedGroups = new HashSet(); /** * The set of identifiers for those menus that are defined. This value may * be empty, but it is never <code>null</code>. */ private final Set definedMenus = new HashSet(); /** * The set of identifiers for those widgets that are defined. This value may * be empty, but it is never <code>null</code>. */ private final Set definedWidgets = new HashSet(); /** * The layout for this menu manager. This layout is <code>null</code> if * the menu manager has changed since the last layout was built. */ private SPartMenuLayout layout = null; /** * The map of group identifiers (<code>String</code>) to groups ( * <code>SGroup</code>). This collection may be empty, but it is never * <code>null</code>. */ private final Map groupsById = new HashMap(); /** * The map of menu identifiers (<code>String</code>) to menus ( * <code>SMenu</code>). This collection may be empty, but it is never * <code>null</code>. */ private final Map menusById = new HashMap(); /** * The map of widget identifiers (<code>String</code>) to widgets ( * <code>SWidget</code>). This collection may be empty, but it is never * <code>null</code>. */ private final Map widgetsById = new HashMap(); public final void actionSetChanged(final ActionSetEvent actionSetEvent) { if (actionSetEvent.isDefinedChanged()) { final SActionSet actionSet = actionSetEvent.getActionSet(); final boolean actionSetIdAdded = actionSet.isDefined(); if (actionSetIdAdded) { definedActionSets.add(actionSet); } else { definedActionSets.remove(actionSet); } if (isListenerAttached()) { final String actionSetId = actionSet.getId(); fireMenuManagerChanged(new MenuManagerEvent(this, null, false, null, false, null, false, null, false, actionSetId, actionSetIdAdded)); } } } /** * Adds a listener to this menu manager that will be notified when this * manager's state changes. * * @param listener * The listener to be added; must not be <code>null</code>. */ public final void addListener(final IMenuManagerListener listener) { addListenerObject(listener); } /** * Notifies listeners to this menu manager that it has changed in some way. * * @param event * The event to fire; may be <code>null</code>. */ private final void fireMenuManagerChanged(final MenuManagerEvent event) { if (event == null) { return; } final Object[] listeners = getListeners(); for (int i = 0; i < listeners.length; i++) { final IMenuManagerListener listener = (IMenuManagerListener) listeners[i]; listener.menuManagerChanged(event); } } /** * Gets the action set with the given identifier. If no such action set * currently exists, then the action set will be created (but will be * undefined). * * @param actionSetId * The identifier to find; must not be <code>null</code> and * must not be zero-length. * @return The action set with the given identifier; this value will never * be <code>null</code>, but it might be undefined. * @see SActionSet */ public final SActionSet getActionSet(final String actionSetId) { checkId(actionSetId); SActionSet actionSet = (SActionSet) actionSetsById.get(actionSetId); if (actionSet == null) { actionSet = new SActionSet(actionSetId); actionSetsById.put(actionSetId, actionSet); actionSet.addListener(this); } return actionSet; } /** * Returns those action sets that are defined. * * @return The defined action sets; this value may be empty, but it is never * <code>null</code>. */ public final SActionSet[] getDefinedActionSets() { return (SActionSet[]) definedActionSets .toArray(new SActionSet[definedActionSets.size()]); } /** * Returns those groups that are defined. * * @return The defined groups; this value may be empty, but it is never * <code>null</code>. */ public final SGroup[] getDefinedGroups() { return (SGroup[]) definedGroups .toArray(new SGroup[definedGroups.size()]); } /** * Returns those items that are defined. * * @return The defined items; this value may be empty, but it is never * <code>null</code>. */ public final SItem[] getDefinedItems() { return (SItem[]) definedHandleObjects .toArray(new SItem[definedHandleObjects.size()]); } /** * Returns those menus that are defined. * * @return The defined menus; this value may be empty, but it is never * <code>null</code>. */ public final SMenu[] getDefinedMenus() { return (SMenu[]) definedMenus.toArray(new SMenu[definedMenus.size()]); } /** * Returns those widgets that are defined. * * @return The defined widgets; this value may be empty, but it is never * <code>null</code>. */ public final SWidget[] getDefinedWidgets() { return (SWidget[]) definedWidgets.toArray(new SWidget[definedWidgets .size()]); } /** * Gets the group with the given identifier. If no such group currently * exists, then the group will be created (but will be undefined). * * @param groupId * The identifier to find; must not be <code>null</code> and * must not be zero-length. * @return The group with the given identifier; this value will never be * <code>null</code>, but it might be undefined. * @see SGroup */ public final SGroup getGroup(final String groupId) { checkId(groupId); SGroup group = (SGroup) groupsById.get(groupId); if (group == null) { group = new SGroup(groupId); groupsById.put(groupId, group); group.addListener(this); } return group; } /** * Gets the item with the given identifier. If no such item currently * exists, then the item will be created (but will be undefined). * * @param itemId * The identifier to find; must not be <code>null</code> and * must not be zero-length. * @return The item with the given identifier; this value will never be * <code>null</code>, but it might be undefined. * @see SItem */ public final SItem getItem(final String itemId) { checkId(itemId); SItem item = (SItem) handleObjectsById.get(itemId); if (item == null) { item = new SItem(itemId); handleObjectsById.put(itemId, item); item.addListener(this); } return item; } /** * <p> * Retrieves the layout for the menu elements held by this menu manager. * This layout does not consider visibility or whether the elements are * currently shown. It is simply the layout if everything was visible and * showing. It also does not consider dynamic menu elements, which will be * asked to make changes to the layout before the menu element is shown. * </p> * <p> * The result of this computation is cached between subsequent calls. So, if * no changes are made to the menu elements, the layout can be retrieved in * constant time. Otherwise, it will take <code>O(n)</code> time to * compute, where <code>n</code> is the number of menu elements held by * this manager. * </p> * * @return The menu layout; never <code>null</code>. */ public final SPartMenuLayout getLayout() { if (layout == null) { // Generate the layout final Collection menuElements = new ArrayList(definedMenus.size() + definedGroups.size() + definedHandleObjects.size() + definedWidgets.size()); menuElements.addAll(definedMenus); menuElements.addAll(definedGroups); menuElements.addAll(definedHandleObjects); menuElements.addAll(definedWidgets); layout = SPartMenuLayout.computeLayout(menuElements); } return layout; } /** * Gets the menu with the given identifier. If no such menu currently * exists, then the menu will be created (but will be undefined). * * @param menuId * The identifier to find; must not be <code>null</code> and * must not be zero-length. * @return The menu with the given identifier; this value will never be * <code>null</code>, but it might be undefined. * @see SMenu */ public final SMenu getMenu(final String menuId) { checkId(menuId); SMenu menu = (SMenu) menusById.get(menuId); if (menu == null) { menu = new SMenu(menuId); menusById.put(menuId, menu); menu.addListener(this); } return menu; } /** * Gets the widget with the given identifier. If no such widget currently * exists, then the widget will be created (but will be undefined). * * @param widgetId * The identifier to find; must not be <code>null</code> and * must not be zero-length. * @return The item with the given identifier; this value will never be * <code>null</code>, but it might be undefined. * @see SWidget */ public final SWidget getWidget(final String widgetId) { checkId(widgetId); SWidget widget = (SWidget) widgetsById.get(widgetId); if (widget == null) { widget = new SWidget(widgetId); widgetsById.put(widgetId, widget); widget.addListener(this); } return widget; } public final void groupChanged(final GroupEvent groupEvent) { if (groupEvent.isDefinedChanged()) { final SGroup group = groupEvent.getGroup(); final boolean groupIdAdded = group.isDefined(); if (groupIdAdded) { definedGroups.add(group); } else { definedGroups.remove(group); } layout = null; if (isListenerAttached()) { final String groupId = group.getId(); fireMenuManagerChanged(new MenuManagerEvent(this, groupId, groupIdAdded, null, false, null, false, null, false, null, false)); } } } public final void itemChanged(final ItemEvent itemEvent) { if (itemEvent.isDefinedChanged()) { final SItem item = itemEvent.getItem(); final boolean itemIdAdded = item.isDefined(); if (itemIdAdded) { definedHandleObjects.add(item); } else { definedHandleObjects.remove(item); } layout = null; if (isListenerAttached()) { final String itemId = item.getId(); fireMenuManagerChanged(new MenuManagerEvent(this, null, false, itemId, itemIdAdded, null, false, null, false, null, false)); } } } public final void menuChanged(final MenuEvent menuEvent) { if (menuEvent.isDefinedChanged()) { final SMenu menu = menuEvent.getMenu(); final boolean menuIdAdded = menu.isDefined(); if (menuIdAdded) { definedMenus.add(menu); } else { definedMenus.remove(menu); } layout = null; if (isListenerAttached()) { final String menuId = menu.getId(); fireMenuManagerChanged(new MenuManagerEvent(this, null, false, null, false, menuId, menuIdAdded, null, false, null, false)); } } } /** * Removes a listener from this menu manager. * * @param listener * The listener to be removed; must not be <code>null</code>. */ public final void removeListener(final IMenuManagerListener listener) { removeListenerObject(listener); } public final void widgetChanged(final WidgetEvent widgetEvent) { if (widgetEvent.isDefinedChanged()) { final SWidget widget = widgetEvent.getWidget(); final boolean widgetIdAdded = widget.isDefined(); if (widgetIdAdded) { definedWidgets.add(widget); } else { definedWidgets.remove(widget); } layout = null; if (isListenerAttached()) { final String widgetId = widget.getId(); fireMenuManagerChanged(new MenuManagerEvent(this, null, false, null, false, null, false, widgetId, widgetIdAdded, null, false)); } } } } \ No newline at end of file
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/menus/SPartMenuLayout.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/menus/SPartMenuLayout.java
new file mode 100644
index 00000000000..191bf64646a
--- /dev/null
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/menus/SPartMenuLayout.java
@@ -0,0 +1 @@
+/******************************************************************************* * Copyright (c) 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.jface.menus; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.eclipse.core.commands.common.NotDefinedException; /** * <p> * The layout of various menu elements. A layout includes all menus, groups, * items and widgets -- regardless of whether they are currently visible. * </p> * <p> * There are three basic types of menu elements: part, popup and bar. Each of * these fundamental types has a map of subelements -- indexed by some string. * </p> * <p> * Clients must not instantiate, and must not extend. * </p> * <p> * <strong>EXPERIMENTAL</strong>. This class or interface has been added as * part of a work in progress. There is a guarantee neither that this API will * work nor that it will remain the same. Please do not use this API without * consulting with the Platform/UI team. * </p> * * @since 3.2 */ public final class SPartMenuLayout extends SMenuLayout { /** * Generates a menu layout based on a collection of menu elements. This * layout will take into account ordering constraints. * * @param menuElements * The menu elements to be sorted into a menu layout; must not * <code>null</code>. * @return The menu layout corresponding to the menu elements; never * <code>null</code>. */ static final SPartMenuLayout computeLayout(final Collection menuElements) { final SPartMenuLayout layout = new SPartMenuLayout(); final Iterator elementItr = menuElements.iterator(); while (elementItr.hasNext()) { final MenuElement element = (MenuElement) elementItr.next(); try { final SLocation[] locations = element.getLocations(); for (int i = 0; i < locations.length; i++) { final SLocation location = locations[i]; final LocationElement locationElement = location.getPath(); if (locationElement instanceof SBar) { final SBar bar = (SBar) locationElement; layout.addBar(element, bar); } else if (locationElement instanceof SPopup) { final SPopup popup = (SPopup) locationElement; layout.addPopup(element, popup); } else if (locationElement instanceof SPart) { final SPart part = (SPart) locationElement; layout.addPart(element, part); } } } catch (final NotDefinedException e) { // This menu element is not defined. Just skip it. } } return layout; } /** * The menu layouts for the various parts, indexed by identifier and type ({@link String}). * TODO Figure out the real structure for this item. */ private final Map partsById; /** * Constructs a new instance of <code>SMenuLayout</code>. */ SPartMenuLayout() { this.partsById = new HashMap(); } /** * Adds an entry into a part-level menu layout. A part can contain a menu * bar or a tool bar. * * @param element * The element to insert into the node; must not be * <code>null</code>. * @param part * The part indicator; must not be <code>null</code>. */ private final void addPart(final MenuElement element, final SPart part) { final String partIdOrType = part.getPart(); SMenuLayout layout = (SMenuLayout) partsById.get(partIdOrType); if (layout == null) { layout = new SMenuLayout(); partsById.put(partIdOrType, layout); } final LeafLocationElement location = part.getLocation(); if (location instanceof SBar) { final SBar bar = (SBar) location; layout.addBar(element, bar); } else if (location instanceof SPopup) { final SPopup popup = (SPopup) location; layout.addPopup(element, popup); } } /** * Prints out some debugging information about the entire menu layout. This * information is quite large. */ public final String toString() { final StringBuffer buffer = new StringBuffer(); Iterator entryItr; // Print out the bars. buffer.append(" ***** TOP-LEVEL BARS ***** \n"); //$NON-NLS-1$ entryItr = getBarsByType().entrySet().iterator(); while (entryItr.hasNext()) { final Map.Entry entry = (Map.Entry) entryItr.next(); final String type = (String) entry.getKey(); buffer.append(type); buffer.append('\n'); LayoutNode node = (LayoutNode) entry.getValue(); printNode(node, buffer, 2); } // Print out the parts. buffer.append(" ***** PART-SPECIFIC BARS ***** \n"); //$NON-NLS-1$ entryItr = partsById.entrySet().iterator(); while (entryItr.hasNext()) { final Map.Entry entry = (Map.Entry) entryItr.next(); final String partId = (String) entry.getKey(); buffer.append(partId); buffer.append('\n'); final SMenuLayout layout = (SMenuLayout) entry.getValue(); buffer.append(layout.toString()); } // Print out the context menus. buffer.append(" ***** CONTEXT MENUS ***** \n"); //$NON-NLS-1$ entryItr = getPopupsById().entrySet().iterator(); while (entryItr.hasNext()) { final Map.Entry entry = (Map.Entry) entryItr.next(); final String id = (String) entry.getKey(); buffer.append(id); buffer.append('\n'); LayoutNode node = (LayoutNode) entry.getValue(); printNode(node, buffer, 2); } return buffer.toString(); } } \ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuService.java
index 622f5916605..ade27ecc10f 100755
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuService.java
@@ -20,7 +20,7 @@ import org.eclipse.jface.menus.SActionSet;
import org.eclipse.jface.menus.SGroup;
import org.eclipse.jface.menus.SItem;
import org.eclipse.jface.menus.SMenu;
-import org.eclipse.jface.menus.SMenuLayout;
+import org.eclipse.jface.menus.SPartMenuLayout;
import org.eclipse.jface.menus.SMenuManager;
import org.eclipse.jface.menus.SWidget;
import org.eclipse.ui.ISourceProvider;
@@ -132,7 +132,7 @@ public final class MenuService implements IMenuService {
return menuManager.getItem(itemId);
}
- public final SMenuLayout getLayout() {
+ public final SPartMenuLayout getLayout() {
return menuManager.getLayout();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IMenuService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IMenuService.java
index 3dfe2d25978..5f57d56760f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IMenuService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IMenuService.java
@@ -18,7 +18,7 @@ import org.eclipse.jface.menus.SActionSet;
import org.eclipse.jface.menus.SGroup;
import org.eclipse.jface.menus.SItem;
import org.eclipse.jface.menus.SMenu;
-import org.eclipse.jface.menus.SMenuLayout;
+import org.eclipse.jface.menus.SPartMenuLayout;
import org.eclipse.jface.menus.SWidget;
import org.eclipse.ui.services.IServiceWithSources;
@@ -190,7 +190,7 @@ public interface IMenuService extends IServiceWithSources {
*
* @return The menu layout; never <code>null</code>.
*/
- public SMenuLayout getLayout();
+ public SPartMenuLayout getLayout();
/**
* Retrieves the menu with the given identifier. If no such menu exists,

Back to the top