2.1.3 Graph Tool command reference
The Graph Tool menu bar contains a number of commands, many of
which are also available in the toolbar. Most commands are also found in the
other metamodeling tools; the name of the first menu, Graph, will change
appropriately in other tools.
New
To create a new object type, press the
New toolbar
button or select
Graph | New... from the menu
bar.
New Subtype...
By default, new Graph types are subtypes of the generic Graph
type. It is also possible, however, to organize Graph types into an inheritance
hierarchy. You can build such hierarchies below all of the metatypes.
Inheritance is mainly data inheritance, based on the property types in
non-property tools (i.e. in Graph Tool, Object Tool, Relationship Tool, Role
Tool and Port Tool) and according to the data type in Property Tool. The new
object, relationship, role or port type inherits all of the properties of its
supertype.
There is also some inheritance of behavior, e.g. an object
can take part in a binding which includes an supertype of that object’s
type (see Section
2.1.6). Similarly a
property whose data type is a given non-property type may also contain
non-properties whose types are subtypes of the given type.
To create a new object type as a subtype of another object
type, select
Graph | New Subtype... (or hold Shift down and press
New in the toolbar) and select the desired supertype from the list of
available object types. The name of the supertype for the current object type
will be shown in the read-only
Supertype
field.
Open
Graph | Open... will bring up a list of object types in
currently open projects. Selecting an object type from the list will load the
object type definition in the Graph Tool.
Save
Graph | Save and the Save and Save and Close
toolbar buttons save the changes to the object type; the latter also closes
the Graph Tool. The buttons are disabled until the user has changed some field
in the Graph Tool. Changes to dialogs and symbols are accepted in their
respective tools, and thus do not affect the state of these buttons. In a
non-Workbench version of MetaEdit+, these buttons are always disabled.
When saving, one of the following messages may appear:
 | You
are not authorized to metamodel! |
This means
that the current user is not one of the metamodelers set by the system
administrator. Contact your system administrator.
 | Could
not obtain the lock for metamodeling for the metatype in project xxx. Lock is
held by user xx. Current metamodeling security level is
exclusive/single. |
This only appears in the
multi-user version, and means that someone else is modeling or metamodeling at
the same time. If the metamodeling security level is exclusive, then you will
have to wait until all other users have logged out, and you have committed or
abandoned your transaction, before you can make type changes. If the
metamodeling security level is single, then you will have to wait until the
other metamodeler has logged out, and you have committed or abandoned your
transaction, before you can make changes.
Exit
Select
Graph | Exit or close the window to quit the
Graph Tool.
Generators
Tools | Generator Editor or the corresponding toolbar
button opens a Generator Editor, described in Section
5.3, on the generator definitions of this
Graph type.
Generators are defined in Graph types
and inherited from supertypes, including the Graph metatype.
Set Identifier Generator
As an alternative to having an identifying property, Tools
| Set Identifier Generator defines a generator for the object type
identifier. A separate editor to define the generator will be launched when this
menu item is selected.
As such generators are normally short and do not have a
name, they have no GeneratorName()
header (nor the older Report
'GeneratorName' and
EndReport). An identifier generator can
call subgenerators, but only those defined in Graph, not its subtypes. Note that
you must avoid using the generator id
command on this object during its identifier generator:
id will try to output the identifier
for this object, which will of course call this same generator, leading to an
infinite recursion. You can however safely use
id for other objects of this type or
others.
When the identifier is generated, no asterisk (*) will be
shown before any local name in the Properties list. If the object type
has no identifier at all, the name of the type is returned.
To remove an Identifier Generator and revert to displaying
one of the properties as the identifier, select that property in the property
list and choose
Set as Identifier from the pop-up menu (see
Figure 2–2 in Section
2.1.4).
 | As
identifiers are calculated to display objects in a textual format in many places
in MetaEdit+, errors when running identifier generators are handled by returning
the output so far, plus an error message – opening a normal error dialog
would be impractical. Infinite recursion within an identifier generator is
prevented by a timeout on such generators, returning an error in a similar
way. |
Property Dialogs
Tools | Generate Default Dialog
automatically defines a dialog for this object type, overriding any custom
dialog. This default dialog contains a label and entry field for each property,
arranged vertically in the order in which they appear in the property list. At
the bottom of the default dialog are
OK,
Cancel and
Info...
buttons.
Tools | Edit Dialog opens a
Dialog Editor for the properties of this object type. The default dialog can
thus be modified for your needs and taste with this operation. See Chapter
4 for
details.
Icon Editor
Tools | Icon Editor opens an Icon Editor where you can
draw the graphical icon to show in browsers etc. for the graph type and its
instances. Icons can only be edited for types that already exist, thus this
button is not available until the type has been saved. See Section
3.4 for details of using the Icon
Editor.
Info Tool
Tools | Info Tool displays an Info Tool for the type,
showing which types this type uses, and which other types use this
type.
Refactor types
Refactor | Choose New Supertype allows the type to be
moved to a different place in the hierarchy. Its metatype cannot change and nor
can its project (a type must be in the same project as its supertype). The
operation checks that the new supertype does not include a property slot with
the same internal id as one already in this type or its subtypes. Existing
instances have any new property slots filled with default values.
Refactor | Push Up Property allows to push a
property slot up to a supertype, keeping its values in existing instances of
this type and its subtypes. The property slot to move must be selected in the
property list. There must not be any other unsaved changes in the tool. The
default value of the property is added to any already loaded instances of the
supertype and its subtypes (except for instances of the current type and below,
which already have the property). The operation offers to replace custom dialogs
with default dialogs in the supertype and below (except in the current type and
below, which will still have the same properties; you may want to edit any
custom dialogs to move the property widget to be in the new order).
Sometimes when you want to use
Push Up Property,
there may already be multiple similar properties below the new supertype.
Similar here means they have the same internal slot id and property type. If
such matching types exist, you will be prompted, and can choose to merge all
into the new property slot in the supertype. If their local name or uniqueness
is different, a warning will be shown and you can open the types to inspect
them.
Help
Help | Object Tool displays help
about the Object
Tool.