com.togethersoft.openapi.ide.command
Interface IdeCommandManager


public interface IdeCommandManager

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.

Author:
TogetherSoft
Since: Together 3.0
See Also: IdeCommandManagerAccess.getCommandManager(), IdeCommandConstraints

Method Summary
 IdeCommandGroupcreateGroup(String itemId, IdeCommandConstraints constraints, IdeCommandCheckListener l)
          Creates a new command item which can be used as a container for other command items.
 IdeCommandItemcreateItem(String itemId, IdeCommandConstraints constraints, IdeCommandListener l)
          Creates a new command item.

Method Detail

createGroup

public IdeCommandGroup createGroup(String itemId, IdeCommandConstraints constraints, IdeCommandCheckListener l)
Creates a new command item which can be used as a container for other command items.
Parameters:
itemId The string with the ID for this command item. This ID can be used in the
constraints as an anchor or parent for inserting other command items.
constraints The IdeCommandContstraints. See createItem for examples.
l the IdeCommandCheckListener used to control whether this group should be made
visible/invisible or enabled/disabled.
See Also:
createItem(java.lang.String,com.togethersoft.openapi.ide.command.IdeCommandConstraints,com.togethersoft.openapi.ide.command.IdeCommandListener), IdeCommandCheckListener, IdeCommandConstraints

createItem

public IdeCommandItem createItem(String itemId, IdeCommandConstraints constraints, IdeCommandListener l)
Creates a new command item.
Parameters:
itemId The string with the ID for this command item. This ID can be used in the
constraints as an anchor for inserting other command items.
constraints The 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.)
l the IdeCommandListener
See Also:
IdeCommandListener, IdeCommandConstraints