Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Graphical Modeling Framework/Models/GenModel

GMF GenModel is data model used by GMF to generate diagramming code. Intention of this model is pretty similar to EMF GenModel. GMF GenModel could be treated as a set of parameters for JET templates used to generate the code.

This page contains a list of GMF GenModel parameters designed to be changed by user. Generated code could be fine-tuned by adjusting corresponding values. If any of these parameters was modified by user and stored in GMF GenModel, new value should be preserved on next transformation from GMF MapModel to GMF GenModel.

GenEditorGenerator

Copyright Text - multi-line text property. Specified text will be included as a top-level comment into the generated .java and plugin.xml files. Be careful – due to the current java merge settings top-level comments will not be changed for existing files - only newly generated .java files will be adornment with this comment. To change copyright text in existing .java files we suggest to remove all the sources and re-generating code from GMF GenModel.


Diagram File Extension - string property holding extension for diagram file.


Domain File Extension - string property holding extension for domain model file.


Dynamic Templates - boolean property switching on user-defined templates processing on generating code from this model (see Template Directory property).


Model ID – string property identifying generated diagram. Value of this property will be derived form EMF meta-model name by default. This value should be unique among the generated diagramming plug-ins existing in any Eclipse installation. To create several GMF GenModels (diagrams) for the same meta-model this string should be changed to make it unique for each GMF GenModel instance.


Package Name Prefix – string property representing valid java package. This is a common super-package for all the generated java classes.


Same File For Diagram And Model – boolean property indicating that model elements should be stored in a diagram file, default value == false. GMF allows to generate code storing model elements in a two ways:

1. Single file keeping diagram visual information together with model structure (value == true)

2. Two different files - first for model contents and second for diagram-specific visual information (value == false). The structure of model file in this situation will corresponds to the file structure created by standard generated EMF editor for this domain model.

It is recommended to use separate file for storing diagram information (default value of this option) to utilize most of the GMF features for example - creating several diagrams for the same domain model.


Template Directory – string property indicating path to the root directory with user-defined code generation templates. This property will be used only if Dynamic Templates property was set to true. Value of this property could be either valid EMF URI specifying location of the folder with templates or platform-relative path written in a form: /project-name/path.

GMF is using JET templates for code generation. Original templates are located in a template directory inside org.eclipse.gmf.codegen plug-in. To customize generated code user can copy necessary template file(s) from this plug-in into the folder specified as Template Directory and change template(s) content. Modified template(s) will be used on next code generation.

Note: do not mix up template files with .java classes generated by JET while compiling these files. Templates are located in org.eclipse.gmf.codegen/templates directory and usually has .javajet or .jetinc extensions.

GenDiagram

Diagram group

Contains Shortcuts To – multi-value string property specifying a set of domain model file extensions. Generated code will show corresponding files while browsing workspace in dialog available via Create Shortcut… diagram popup menu action. This dialog allows expanding visible model files to browse model contents, selecting model element and creating shortcut to it on diagram.

It is necessary to specify at least one file extension in this property to get Create Shortcut… action generated.

It will be possible to create shortcut on a diagram of this type to the model elements from another model during runtime only if:

1. Executed Eclipse instance contains generated GMF diagramming plug-in feasible to visualize this element as a top-level diagram element.

2. That diagramming plug-in was generated with Shortcuts Provided For property set to allow shortcuts creation on the diagram of this type (see Shortcuts Provided For).

Example1: If two diagrams for two different domain models (domain1 and domain2) should be generated and domain1 diagram should allows shortcutting elements from the domain2 models, then Contains Shortcuts To of the domain1 diagram should contains domain2ModelFileExtension string.

Example2: If diagram should be generated for the domain1 domain model and this diagram should allows shortcutting elements from other domain1 models, then Contains Shortcuts To property of this diagram should contains domain1ModelFileExtension string.


Shortcuts Provided For – multi-value string property specifying a set of Model ID properties of GenDiagrams. Generated code will supply shortcuts for model element if:

1. It is an element of this diagram domain model.

2. Model ID of the diagram asking for a shortcut for this element present in Shortcuts Provided For values (see Model ID).

Example1: If two diagrams for two different domain models (domain1 and domain2) should be generated and domain1 diagram should allows shortcutting elements from the domain2 models, then Shortcuts Provided For property of the domain2 diagram should contains domain1 diagram Model ID.

Example2: If diagram should be generated for the domain1 domain model and this diagram should allows shortcutting elements from other domain1 models, then Shortcuts Provided For property of this diagram should contains its Model ID.


Synchronized – boolean property indicating that synchronized diagram code should be generated (another option is non-synchronized diagram).

Content of the synchronized diagram should always reflect actual state of the model. For example, if the diagram visualizes some part of the model (package) then content of this diagram should be updated on adding/removing element to/from this package.

non-synchronized diagram contains only those elements which were explicitly created on this diagram by user. Synchronization with the model will be performed for such a diagram only once - on creation time if Initialize Diagram File Action was used. This means, Initialize Diagram File Action will populate such a kind of diagrams with all valid model elements below the model element selected as diagram root on creation time. Due to the specification, UML diagrams are views to the shared model, so could be implemented as non-synchronized diagrams in this case diagram content will not be updated on adding/removing any elements to/from the model, but user will be able to add/remove some elements to these diagrams manually.

Known issue: For synchronized diagrams GMF does not generate the code handling external changes i.e. if the model was changed outside of the diagram EditingDomain then user should take care on triggering update process for this diagram. The easiest way is to reopen it.


Units – string property holding name of the constant from MeasurementUnit class described in notation.ecore model (see org.eclipse.gmf.runtime.notation. MeasurementUnit). Valid values: Himetric, Pixel. Default value is Pixel – size of the diagram nodes will be measured in pixels.

In case of Himetric units, diagram element dimensions will be measured in some logical coordinates. One Himetric unit is equal to 1/100 mm on any screen, so diagram elements will have equal visible bounds on different kind of monitors with different resolution. Usually one display pixel is equal to several logical units, but actual coefficient depends on screen resolution for my display this coefficient is about 20 logical unit = 1 pixel.


Validation Decorators – boolean property indicating that ValidationDecoratorProvider should be generated for this diagram. Generated provider will handle creation of validation violation decorators for diagram elements. (see Validation Enabled)


Validation Enabled – boolean property indicating that ValidationProvider and MarkerNavigationProvider should be generated. These classes are responsible for execution of EMFT validation process for an instance of user domain model and collecting all the validation rules violations. Violations are represented as diagram resource problem markers.

Editor group

Creation Wizard Category ID – string property holding identifier of the category where generated NewDiagramFileWizard will be registered. Default value is org.eclipse.ui.Examples.

Note: generator supposes that specified category is already registered from some other plugin.xml so take care on registering category from another plug-in or patching generated plugin.xml by adding category registeration.


Creation Wizard Icon Path – string representing relative path to the icon for NewDiargamFileWizard.


Editing Domain ID – string identifier of an EditingDomain attached to this type of the diagram. To make generated diagram working properly, Editing Domain ID should be unique – i.e. there should be no other diagramming plug-ins working with an editing domain with the same ID.

Providers group

Edit Part Provider Priority, Icon Provider Priority, Marker Navigation Provider Priority, Metric Provider Priority, Modeling Assistant Provider Priority, Notation View Provider Priority, Palette Provider Priority, Parser Provider Priority, Property Provider Priority, Shortcuts Decorator Provider Priority, Validation Decorator Provider Priority, Validation Provider Priority.

These properties are holding provider priorities for the corresponding type of the generated providers. Priority could be one of the following enumeration literals: Lowest, Low, Medium, High, Highest. By specifying correct provider priority user can override generated provider functionality by hand-written one with higher priority.

GenPlugin

ID - string id of the generated plug-in. Same string will be used as a name of plug-in project creates in the workspace with all the generated code, so this string should be valid Eclipse plugin project name.


Name – string name of the generated plug-in could contains any characters.


Printing Enabled – boolean property reflecting the fact that Print and Print Preview actions should be generated for this diagram.


Provider – string description of generated plug-in manufacturer.


Version - string property reflecting the version of generated plugin.

GenEditorView

Back to the top