001: /*******************************************************************************
002: * Copyright (c) 2000, 2005 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui.commands;
011:
012: /**
013: * <p>
014: * A category is a grouping of commands by functional area. For example, in the
015: * Eclipse workbench, "Text Editing" is a category containing various commands
016: * related to text editing. A category's primary functionality is to control the
017: * display of commands to the user. When appropriate, commands displayed to the
018: * user (e.g., keys preference page) will be grouped by category.
019: * </p>
020: * <p>
021: * An instance of <code>ICategory</code> is a handle representing a category
022: * as defined by the extension point <code>org.eclipse.ui.commands</code>.
023: * The identifier of the handle is identifier of the category being represented.
024: * </p>
025: * <p>
026: * An instance of <code>ICategory</code> can be obtained from an instance of
027: * <code>ICommandManager</code> for any identifier, whether or not a category
028: * with that identifier defined in the plugin registry.
029: * </p>
030: * <p>
031: * The handle-based nature of this API allows it to work well with runtime
032: * plugin activation and deactivation, which causes dynamic changes to the
033: * plugin registry, and therefore, potentially, dynamic changes to the set of
034: * category definitions.
035: * </p>
036: * <p>
037: * This interface is not intended to be extended or implemented by clients.
038: * </p>
039: *
040: * @since 3.0
041: * @see ICategoryListener
042: * @see ICommandManager
043: * @see org.eclipse.core.commands.Category
044: * @deprecated Please use the "org.eclipse.core.commands" plug-in instead.
045: */
046: public interface ICategory extends Comparable {
047:
048: /**
049: * Registers an instance of <code>ICategoryListener</code> to listen for
050: * changes to attributes of this instance.
051: *
052: * @param categoryListener
053: * the instance of <code>ICategoryListener</code> to register.
054: * Must not be <code>null</code>. If an attempt is made to
055: * register an instance of <code>ICategoryListener</code>
056: * which is already registered with this instance, no operation
057: * is performed.
058: */
059: void addCategoryListener(ICategoryListener categoryListener);
060:
061: /**
062: * <p>
063: * Returns the description of the category represented by this handle,
064: * suitable for display to the user.
065: * </p>
066: * <p>
067: * Notification is sent to all registered listeners if this attribute
068: * changes.
069: * </p>
070: *
071: * @return the description of the category represented by this handle.
072: * Guaranteed not to be <code>null</code>.
073: * @throws NotDefinedException
074: * if the category represented by this handle is not defined.
075: */
076: String getDescription() throws NotDefinedException;
077:
078: /**
079: * Returns the identifier of this handle.
080: *
081: * @return the identifier of this handle. Guaranteed not to be <code>null</code>.
082: */
083: String getId();
084:
085: /**
086: * <p>
087: * Returns the name of the category represented by this handle, suitable
088: * for display to the user.
089: * </p>
090: * <p>
091: * Notification is sent to all registered listeners if this attribute
092: * changes.
093: * </p>
094: *
095: * @return the name of the category represented by this handle. Guaranteed
096: * not to be <code>null</code>.
097: * @throws NotDefinedException
098: * if the category represented by this handle is not defined.
099: */
100: String getName() throws NotDefinedException;
101:
102: /**
103: * <p>
104: * Returns whether or not the category represented by this handle is
105: * defined.
106: * </p>
107: * <p>
108: * Notification is sent to all registered listeners if this attribute
109: * changes.
110: * </p>
111: *
112: * @return <code>true</code>, iff the category represented by this
113: * handle is defined.
114: */
115: boolean isDefined();
116:
117: /**
118: * Unregisters an instance of <code>ICategoryListener</code> listening
119: * for changes to attributes of this instance.
120: *
121: * @param categoryListener
122: * the instance of <code>ICategoryListener</code> to
123: * unregister. Must not be <code>null</code>. If an attempt
124: * is made to unregister an instance of <code>ICategoryListener</code>
125: * which is not already registered with this instance, no
126: * operation is performed.
127: */
128: void removeCategoryListener(ICategoryListener categoryListener);
129: }
|