| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
IdeCommandManager is responsible for creating new command items
and inserting them into command item containers.
Every item has its own ID assigned to it by the user at the moment of creation of this item, and a string displaying as a popup text for toolbar command item or as a name of this item in menus.
createItem method creates a new IdeCommandItem.
createGroup method creates a new IdeCommandGroup item which can be used as a container for
other command items.
Current IdeCommandManager can be obtained via
IdeCommandManagerAccess.getCommandManager method:
IdeCommandManager commandManager = IdeCommandManagerAccess.getCommandManager();
IdeCommandItem can be inserted into IdeCommandGroup item using the constraints
mechanism, see an example in the description of createItem method.
The control over the item's appearance (for example, a decision whether the item should be made enabled or visible for specific element) can be performed in the IdeCommandCheckListener.checkStatus method.
| Method Summary | |
IdeCommandGroup | createGroup(String itemId, IdeCommandConstraints constraints, IdeCommandCheckListener l)Creates a new command item which can be used as a container for other command items. |
IdeCommandItem | createItem(String itemId, IdeCommandConstraints constraints, IdeCommandListener l)Creates a new command item. |
| Method Detail |
public IdeCommandGroup createGroup(String itemId, IdeCommandConstraints constraints, IdeCommandCheckListener l)
IdeCommandContstraints. See createItem for examples.IdeCommandCheckListener used to control whether this group should be made
visible/invisible or enabled/disabled.public IdeCommandItem createItem(String itemId, IdeCommandConstraints constraints, IdeCommandListener l)
IdeCommandConstraints instance. Defines the domain of
applicability for this command item.
Examples:
createItem("ItemID", new IdeCommandConstraints("context=element, shapetype = "+RwiShapeType.CLASS_DIAGRAM+", location=mainToolbar"), new IdeCommandAdapter());
(Creates IdeCommandItem in the the main toolbar for class diagrams. See RwiShapeType interface)
createItem("ItemID", new IdeCommandConstraints("context = element, location=popupMenu"), new IdeCommandAdapter());
(Creates IdeCommandItem in the popup menu for all elements)
createItem("ItemID", new IdeCommandConstraints("context = file, location=popupMenu"), new IdeCommandAdapter());
(Creates IdeCommandItem in the popup menu for all files)
createItem("ItemID", new IdeCommandConstraints("context = textEditor, fileCategory = java_source, location=popupMenu"), new IdeCommandAdapter());
(Creates IdeCommandItem in the text editor's popup menu for java source files)
IdeCommandManager cman=IdeCommandManagerAccess.getCommandManager();
IdeCommandGroup myGroup=cman.createGroup("IDOfTheGroup",new IdeCommandConstraints("context = element, location=popupMenu"), new IdeCommandAdapter());
IdeCommandItem myItem=cman.createItem("IDOfTheItem",new IdeCommandConstraints("context = element, parent=IDOfTheGroup, location=popupMenu"),new IdeCommandAdapter());
myItem.setText("Generate code");
myGroup.setText("My menu");
(This code creates an item "My menu" with a submenu "Generate code" in a popup menu for elements.)
IdeCommandListener
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||