1 /******************************************************************************* 2 * Copyright (c) 2005, 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 org.eclipse.core.commands.common.NotDefinedException; 15 16 /** 17 * <p> 18 * A collection of menu elements. This is given to an implementation of 19 * <code>IDynamicMenu</code> to modify. 20 * </p> 21 * <p> 22 * Clients must not implement or extend. 23 * </p> 24 * <p> 25 * <strong>PROVISIONAL</strong>. This class or interface has been added as 26 * part of a work in progress. There is a guarantee neither that this API will 27 * work nor that it will remain the same. Please do not use this API without 28 * consulting with the Platform/UI team. 29 * </p> 30 * <p> 31 * This class will eventually exist in <code>org.eclipse.jface.menus</code>. 32 * </p> 33 * 34 * @since 3.2 35 * @see org.eclipse.ui.internal.menus.IDynamicMenu 36 */ 37 public interface IMenuCollection { 38 39 /** 40 * Adds a menu element to the collection. Any menu element contributed 41 * through this method must contain exactly one location. Ordering 42 * constraints are respected; the item will appear in the position indicated 43 * by the ordering constraints. 44 * 45 * @param element 46 * The element to append. Must not be null, and must be of the 47 * appropriate type for the type of collection. 48 * @throws NotDefinedExcpetion 49 * If the provided element is not defined. 50 * @see MenuElement#getLocations() 51 * @see SLocation#getOrderings() 52 */ 53 public void add(MenuElement element) throws NotDefinedException; 54 55 /** 56 * Removes all elements from the collection. 57 */ 58 public void clear(); 59 60 /** 61 * Removes the given menu element, if it exists. 62 * 63 * @param element 64 * The element to remove. 65 * @return true if the object was removed; false if it could not be found. 66 */ 67 public boolean remove(MenuElement element); 68 } 69