| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.togethersoft.openapi.util.properties.DictionaryProperties | +--com.togethersoft.openapi.ide.command.IdeCommandConstraints
Defines the domain of applicability for the command item (IdeCommandItem or
IdeCommandGroup).
IdeCommandConstraints() constructor creates an "empty" constraint object which
doesn't define any constraints for the command item.
The string in IdeCommandConstraints(String) constructor contains the constraints separated
with a comma. A constraint is a string "nameOfTheConstraint = value" pair. This class contains a set
of constants with the possible names of constraints:
context constraint (this name is defined by the CONTEXT constant)
defines the kind of objects for which the command item will appear. Possible values for this constraint are:
element (defined in the ELEMENT_CONTEXT constant) - the command
item will appear for elements.
file (defined in the FILE_CONTEXT constant) - the command item will
appear for files.
textEditor (defined in the TEXT_EDITOR_CONTEXT constant) -
the command item will appear in text editor.
context constraint is element,
the shapeType constraint (this name is defined by the SHAPE_TYPE constant)
defines the shape type
of element the command item will appear for. For diagram toolbar command item this constraint
must contain the shape type of the diagram. Some of shape types values are defined in
RwiShapeType interface.
For example,
new IdeCommandConstraints("context=element, shapeType="+RwiShapeType.CLASS)
will create a constraint that makes command item appear only for elements with the shape types of CLASS.
context constraint is file
(this value is defined by the FILE_CONTEXT constant) or
textEditor (TEXT_EDITOR_CONTEXT constant), the
fileCategory constraint (this name is defined by the FILE_CATEGORY
constant) defines the
category of file the command item will appear for. The values should be taken from the resource.config file
(for example, java_class, java_source, cpp_source, cpp_header, diagram, project, config, text_file etc.)
For example,
new IdeCommandConstraints("context=file, fileCategory=java_source, fileCategory=text_file")
will create a constraint that makes command item appear only for java sources and all supported kinds of text files.
new IdeCommandConstraints("context=textEditor, fileCategory=java_source")
will create a constraint that makes command item appear in the text editor only for java sources.
placeBefore constraint (this name is defined by the PLACE_BEFORE constant)
specifies before which command item this command item will be inserted. The value is
the string ID of the anchor command item (the ID is assigned at the moment of creation in the method
IdeCommandManager.createItem).
placeAfter constraint (this name is defined by the PLACE_AFTER constant)
specifies after which command item this command item will be inserted. The value is
the string ID of the anchor command item.
parent constraint (this name is defined by the PARENT constant)
specifies the group this command item will be inserted into. The value is
the string ID of the group.For example:
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());
(this code creates an item "My menu" with a submenu "Generate code" in a popup menu for elements.)
location constraint (this name is defined by the LOCATION constant)
specifies where the command item will be located. Possible values are defined
in the constants MAIN_TOOLBAR_LOCATION (main toolbar),
MAIN_MENU_LOCATION (main menu), POPUP_MENU_LOCATION
(popup menu). For
example:
new IdeCommandConstraints("context=element, shapeType="+RwiShapeType.CLASS+", parent=IDOfTheParent, location=popupMenu")
In previous examples we directly used the values of constraints defined in this interface. Of course, it is possible to write it in the right style (the last example):
IdeCommandContraints rightWayIsTough = new IdeCommandConstraints(IdeCommandConstraints.CONTEXT+"="+IdeCommandConstraints.ELEMENT+","+IdeCommandConstraints.SHAPE_TYPE+"="+RwiShapeType.CLASS+","+IdeCommandConstraints.PARENT+"=IDOfTheParent,"+IdeCommandConstraints.LOCATION+"="+IdeCommandConstraints.POPUP_MENU_LOCATION); // 8=)| Field Summary | |
final static String | CONTEXTThe value is "context". |
final static String | ELEMENT_CONTEXTThe value is "element". |
final static String | EXTENSION |
final static String | FILE_CATEGORYThe value is "fileCategory". |
final static String | FILE_CONTEXTThe value is "file". |
final static String | LOCATIONThe value is "location". |
final static String | MAIN_MENU_LOCATIONThe value is "mainMenu". |
final static String | MAIN_TOOLBAR_LOCATIONThe value is "mainToolbar". |
final static String | PARENTThe value is "parent". |
final static String | PLACE_AFTERThe value is "placeAfter". |
final static String | PLACE_BEFOREThe value is "placeBefore". |
final static String | POPUP_MENU_LOCATIONThe value is "popupMenu". |
final static String | SHAPE_TYPEThe value is "shapeType". |
final static String | TEXT_EDITOR_CONTEXTThe value is "textEditor". |
| Constructor Summary | |
IdeCommandConstraints()IdeCommandConstraints() constructor creates an "empty" constraint object which
doesn't define any constraints for the command item. | |
IdeCommandConstraints(String values)Creates a constraint object. | |
| Methods inherited from class com.togethersoft.openapi.util.properties.DictionaryProperties |
addPropertyChangeListener, addVetoableChangeListener, clear, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getImplementation, getProperty, propertyNames, putProperty, removePropertyChangeListener, removeVetoableChangeListener |
| Field Detail |
public final static String CONTEXT
"context".public final static String ELEMENT_CONTEXT
"element".public final static String EXTENSION
public final static String FILE_CATEGORY
"fileCategory".public final static String FILE_CONTEXT
"file".public final static String LOCATION
"location".public final static String MAIN_MENU_LOCATION
"mainMenu".public final static String MAIN_TOOLBAR_LOCATION
"mainToolbar".public final static String PARENT
"parent".public final static String PLACE_AFTER
"placeAfter".public final static String PLACE_BEFORE
"placeBefore".public final static String POPUP_MENU_LOCATION
"popupMenu".public final static String SHAPE_TYPE
"shapeType".public final static String TEXT_EDITOR_CONTEXT
"textEditor".| Constructor Detail |
public IdeCommandConstraints()
IdeCommandConstraints() constructor creates an "empty" constraint object which
doesn't define any constraints for the command item.public IdeCommandConstraints(String values)
String of comma-delimited constraints| Association Links |
"location".to Class java.lang.String
"mainMenu".to Class java.lang.String
"mainToolbar".to Class java.lang.String
"popupMenu".to Class java.lang.String
"placeBefore".to Class java.lang.String
"placeAfter".to Class java.lang.String
"parent".to Class java.lang.String
"context".to Class java.lang.String
"element".to Class java.lang.String
"file".to Class java.lang.String
"textEditor".to Class java.lang.String
"shapeType".to Class java.lang.String
to Class java.lang.String
"fileCategory".
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||