1 /******************************************************************************* 2 * Copyright (c) 2006 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 ******************************************************************************/ 11 12 package org.eclipse.ui.internal.menus; 13 14 import java.util.List; 15 16 import org.eclipse.core.commands.common.IIdentifiable; 17 18 /** 19 * <p> 20 * A node within the menu layout. This holds information about the location, the 21 * corresponding menu element as well as some children. This layout is 22 * immutable. 23 * </p> 24 * <p> 25 * Clients must not extend or implement. 26 * </p> 27 * <p> 28 * <strong>PROVISIONAL</strong>. This class or interface has been added as 29 * part of a work in progress. There is a guarantee neither that this API will 30 * work nor that it will remain the same. Please do not use this API without 31 * consulting with the Platform/UI team. 32 * </p> 33 * <p> 34 * This class will eventually exist in <code>org.eclipse.jface.menus</code>. 35 * </p> 36 * 37 * @since 3.2 38 */ 39 public interface ILayoutNode extends IIdentifiable { 40 41 /** 42 * <p> 43 * Returns the children of this node, if any. This collection is sorted into 44 * the ordering, as specified in the ordering constraints. The sort order is 45 * broken into three blocks: beginning, middle and end. Within those blocks, 46 * items appear in alphabetical order by id. Without any ordering 47 * constraints, a menu element will appear in the middle block. 48 * {@link SOrder#POSITION_START} and {@link SOrder#POSITION_END} can be used 49 * to put a menu element in the beginning group or the end group, 50 * respectively. 51 * </p> 52 * <p> 53 * If an {@link SOrder#POSITION_BEFORE} or {@link SOrder#POSITION_AFTER} 54 * constraint is given, then the item appears in a position relative to 55 * other item. Note that the {@link SOrder#POSITION_BEFORE} and 56 * {@link SOrder#POSITION_AFTER} constraints have higher priority than the 57 * {@link SOrder#POSITION_START} and {@link SOrder#POSITION_END} 58 * constraints. As such, an item the specifies itself as being at the start 59 * can be pulled to the end of a menu collection by a 60 * {@link SOrder#POSITION_AFTER} constraint. 61 * </p> 62 * 63 * @return The children ({@link ILayoutNode}); never <code>null</code>, 64 * but may be empty. 65 */ 66 List getChildrenSorted(); 67 68 /** 69 * Returns the specific location for this node. Normally, a menu element can 70 * be associated with one or more locations. This location is one of the 71 * menu element's location, and represented this particular position within 72 * the menu layout. 73 * 74 * @return The location represented by this layout node; may be 75 * <code>null</code> if this is a top-level layout node or if the 76 * node is implicitly created. 77 */ 78 SLocation getLocation(); 79 80 /** 81 * Returns the menu element for this node. 82 * 83 * @return The menu element; may be <code>null</code>. 84 */ 85 MenuElement getMenuElement(); 86 87 /** 88 * Returns whether this node has no children. 89 * 90 * @return Whether this node is empty. 91 */ 92 boolean isEmpty(); 93 } 94