Difference between revisions of "Graphical Modeling Framework/Versions/GMF 2.1"
(→2.0 M7 (May 18, 2007))
(→New label text format options)
|Line 307:||Line 307:|
=== New label text format options ===
=== New label text format options ===
Revision as of 08:21, 23 May 2007
Graphical Modeling Framework 2.0 New and Noteworthy items
...broken down by milestones, (see GMF Project Plan for more details)
Back to Graphical Modeling Framework
- 1 GMF Release 1.0 (June 30, 2006)
- 2 2.0 M1 (September 04, 2006)
- 3 2.0 M2
- 4 2.0 M3
- 5 2.0 M4
- 6 2.0 M5
- 7 2.0 M6/RC0
- 7.1 Domain Model Content Navigator
- 7.2 Diagram & Domain Model Navigator refresh
- 7.3 Generating proper ???CanonicalEditPolicy.shouldDeleteView()
- 7.4 Reconciler for GenNavigator
- 7.5 Links to Links
- 7.6 Graphdef visual editor (org.eclipse.gmf.graphdef.editor) enhanced
- 7.7 Links Rerouting
- 7.8 Dynamic GMFGraph templates
- 8 2.0 M7 (May 18, 2007)
GMF Release 1.0 (June 30, 2006)
2.0 M1 (September 04, 2006)
Merging for plugin.xml and plugin.properties
Protected region is defined in plugin.xml where users may add their extensions. These extensions will be preserved on diagram editor regeneration. Properties file plugin.properties is merged using EMF merger for property files.
Add custom edit policies in gmfgen model
Custom behaviour may be added to diagram element using CustomBehaviour object. In generated code this means inserting custom edit policy in edit part of diagram element.
Default mapping creation wizard creates canvas mapping
Mapping wizard generated by EMF is enhanced by adding pages to select domain model, diagram canvas and palette. If specified domain, graphical and tooling definition models are loaded and canvas mapping that binds them is added.
Unit-tests covering following parts of generated code were implemented:
- toolbar tools
- diagram and model resources saving
- diagram node hierarchy creation
- compilation test for user models with “instance class name” property specified
Wizards to reconcile graphical and tooling definition models
Wizards that infer graphical and tooling definitions from domain model now can reconcile results with existing models. One may start such wizards explicitly using File -> New -> Other menu or use GMF Dashboard where 'Derive' actions switch wizards to reconcile mode if graphical and tooling definitions are selected for the project.
Diagram content could be provided below diagram file node in standard Project Explorer Eclipse view. Read-only properties of underlying semantic element available for single-element selection.
GenNavigator metaclass was added to GMF GenModel. Default Navigator structure will be created automatically by GMF MapModel - GMF GenModel transformer, so it is necessary to run this transformation and regenerate the code from newly created GMF GenModel to get Navigator generated.
ILinkHelper implementation generated
Project Explorer selection could be synchronized with open diagram selection if "Link open editors with content in the Navigator" button pressed on Project Explorer toolbar. To implement this functionality additional class <DiagramPrefix>NavigatorLinkHelper will be generated.
Option to create a GenModel if it's missing
If during transformation appropriate .genmodel was not detected, toolsmith could browse for existing with an option to either create a new blank model with regular defaults or to launch EMF wizard to create .genmodel manually.
Basic support for diagram partitioning
GMFMap's MappingEntry has a link to other CanvasMappings now. Once it's defined, transofrmation attaches OpenDiagramBehaviour to appropriate GenNode, and there's OpenDiagramEditPolicy generated that tries to open editor for the diagram.
Do not generate superfluous code in few particular cases
CanonicalEditPolicy is no longer generated for elements without immediate children to be updated. GraphicalNodeEditPolicy is generated only when there are links with inverted direction. You may notice that these policies are no longer registered within node's createDefaultEditPolicies() method after regeneration and remove respective classes. Alternatively, if you didn't change the edit policies' code, you may remove all classes extending CanonicalEditPolicy and GraphicalNodeEditPolicy in your plug-in and regenerate the code. This will leave only those policies that are needed.
Corresponding diagram will be opened in editor (activated if already opened) on double-clicking to the diagram node in diagram file content sub-tree provided to the Project Explorer Eclipse view. Useful for the situation then several diagrams are stored in the same diagram file (see Basic support for diagram partitioning).
Mapping Model Visual Editor
Diagram editor that uses GMF mapping model as domain model. In other words now you may design diagram editor in diagram editor ))) You need org.eclipse.gmf.map.editor plugin.
Automatic diagram editor refresh
Generated diagram editor will be automatically refreshed on any changes in the eclipse resource subsystem made outside of the editor without reopening. Examples of such changes are:
- modifications made in domain model inside EMF-generated tree editor
- modifications made on another diagram created in the same diagram resource using diagram partitioning feature
- diagram/domain model resource rename/move in the workspace
- changes in diagram/domain resource downloaded from version control
Corresponding dialogs will appear on following editor activation/saving if editor state was dirty at the moment of changes in the eclipse resources subsystem.
Xpand Template Engine
JET alternative which is much more handy for complex template we've got in GMF is now part of SDK. Figure generation (org.eclipse.gmf.graphdef.codegen) has been rewritten with Xpand. For more details on Xpand read the [paper] from Eclipse Summit Europe.
Merge for plugin.xml
Protected regions added in M1 were replaced with per-extension 'generated' marker in form of XML processing instruction. Any tag not marked as generated will be preserved during merging. Extensions marked as generated are matched using respective point id (note, multiple extensions for same point may have merging issues, we are going to further refine matching using extension ids or additional attribute in the processing instruction).
It's possible to generate diagram editor as RCP application based on full GMF runtime:
TypeLink creation commands are generated as separate classes
Separate class implementing link creation command will be generated for each TypeLink. This is first part of the fix for request #157683 significantly simplifying generated code modification in case of TypeLinks connecting abstract super-class(es) of several domain elements.
Since in previous version of generator link creation commands were generated as inner-classes inside source/target ???NodeItemSemanticEditPolicy, these classes will be removed by next code generation. If some of the link creation commands were marked as "@generated NOT" and customized by user then corresponding code should be manually stored prior to the code generation and then moved into the newly generated ???TypeLinkCreateCommands.
You have to re-transform .gmfgen model from .gmfmap model to generate correct code.
Compartment Scrolling Thumbs
To resolve compartment scrolling issues request #110971, transparent compartment scrolling thumbs have been added to make the scrollbars more usable on compartments:
SemanticNode creation commands are generated as separate classes
Separate class implementing node creation command will be generated for each SemanticNode (not pure design one). This is a second part of the fix for request #157683. It reduces a number of generated inner-classes then the same GenNode references as a child node from several containers as a result simplifying generated code modifications.
Since in previous version of generator node creation commands were generated as inner-classes inside ???NodeItemSemanticEditPolicy, these classes will be removed by next code generation. If some of the link creation commands were marked as "@generated NOT" and customized by user then corresponding code should be manually stored prior to the code generation and then moved into the newly generated ???CreateCommands.
You have to re-transform .gmfgen model from .gmfmap model to generate correct code.
Fully qualified names in templates are organized as imports after generation
Organization of import statements was added recently to gmf generator (request #165864). So now most of qualified names you use in templates will be moved to java-imports after generation. Therefore there is no need in importManager calls from JET anymore, and it is supposed to be a good style using the fully qualified names right as they are. Besides, being a post-generator facility, this applies to xPand templates as well as JET ones.
Diagram editor genmodel (gmfgen) now describes default diagram preferences (GenDiagramPreferences class) and preference pages.
Default diagram preferences are reflected in generated DiagramPreferenceHint class that records them in preference store.
Preference page may be one of the standard preference pages (Appearance, Connections, etc.) or custom one with class name specified in gmfgen model.
RCP Menu And Toolbar
Menu and toolbar of RCP diagram editor are fully described in gmfgen model so only desired items are available. When gmfmap model is transformed to gmfgen model reasonable set of default items is created.
Greate Generator Model Wizard
"Greate generator model" wizard helps to collect information to create gmfgen model. It starts from standard "Create new file" and "Load Mapping model" pages and then allows toolsmith to either load existing .genmodel or recreate it with EMF facilities as well as reload stale .genmodel if required.
Other transformation options could be also specified here.
Path Maps Preference Page
The Path Maps preference page is significantly revamped for 2.0.
Path Variables can now be managed within this page, without having first to visit the Linked Resources page to create/remove them, close the Preferences dialog, and launch it again. Now, it's just as easy as pressing the "New..." button, entering the variable name, and browsing for a folder.
Path maps that are registered on the
org.eclipse.gmf.runtime.emf.core.PathMaps extension point are
shown as locked; they cannot be unchecked, edited, or removed. The "New..." and "Edit..." dialogs
provide other convenient validation, including:
- verifying that the path variable name is a valid URI segment
- verifying that the location is a folder (not a file)
- warning when specifying a location that is already defined by a different path variable
Stop using *EditorInputProxy
Generated code will not use URI/FileEditorInputProxy classes anymore. From now standard URI/FileEditorInput are used by tooling.
Domain model content could be visualized below domain model file node in standard Project Explorer Eclipse view by generated code. Read-only properties are available for single-element selection.
Set of properties suitable for generation domain model structure providers for common Project Explorer were added to GenNavigator. Domain model navigator will be generated if GenNavigator.generateDomainModelNavigator == true. In case of several diagrams generated for the same domain model from different .gmfgen models this property should be true for the only one GenNavigator instance in one selected .gmfgen model.
Generated Diagram and Domain model navigator content will be automatically updated on any changes in underlying eclipse resources. From now all the modifications made on diagram/in EMF tree editor will be reflected in Navigator. Request #167983
Generating proper ???CanonicalEditPolicy.shouldDeleteView()
There was a lot of complains concerning generated ???CanonicalEditPolicy.shouldDeleteView() method. All these problems should be fixed with closing request #157148. From not it is not necessary to override .shouldDeleteView() with some custom patches - try to replace "@generated NOT" with "@generated" for this method and regenerating the code.
If the following properties of GenNavigator were modified by user then corresponding values will be preserved on next .gmfmap -> .gmfgen model transformation:
In addition, once removed GenNavigator will never be created by .gmfmap -> .gmfgen model transformation. If you decided to return back GenNavigator you should create new empty one and execute .gmfmap -> .gmfgen model transformation – default GenNavigator content will be initialized for you.
Links to Links
From now it is possible to draw links to/from other links in the generated diagram editor. Each link represented by LinkMapping with specified Domain Model Element can be source/target of another link. Another link should either has target feature pointing to the corresponding Domain Model Element of first link or source/containment feature pointing to/contained in the corresponding Domain Model Element.
Known issue: currently it is impossible re-create diagram with links to links from the domain model file. This problem is covered in the separate feature request: link #180786
Graphdef visual editor (org.eclipse.gmf.graphdef.editor) enhanced
First, bootstrapping Graphdef editor have been completely rewritten to xPand to conform the latest GMF state and behavior. Then it was significantly enhanced with new rich customized properties editing.
Graphdef editor itself can serve as some real world complicated example of customization gmf code best practices. Property tabs UI is completely generated with the help of aspect-oriented customization of gmf codegen templates. Moreover, and what is most fascinating, this complicated UI is actually written in our provided property-widgets (our domain) specific language using the concept of custom joint metamodel, referencing the base gmf genmodel ones. Look at the way it is described now:
Therefore, additionally we have provided a small framework with metamodel for describing custom tabbed property sheet UI which is able to operate any domain metamodel. See our tutorial for How To Customize Property Sheet For Your GMF Editor if you want to know more.
Links may be rerouted between acceptable sources and targets. Link constraints that apply to link creation are considered during rerouting.
Dynamic GMFGraph templates
One can specify path to dynamic templates to be used for generation of GEF figures from gmfgraph model (bugzilla 171782)
2.0 M7 (May 18, 2007)
META-INF/MANIFEST.MF is no longer overwritten during while generating diagram code. Any new header, value or attribute (e.g. visibility:=reexport, or bundle-version="[2.3.0,3.0.0)" you might have added will survive now. Simple values (not comma-separated, multivalued, e.g. Bundle-Version) are still overwritten. New headers added by generator will get inserted as well. To further control merge behaviour, one can use GMF-IgnoreMerge header. Put name of the header you would like to keep intact as a value of this header and merge won't try neither to merge, replace or insert such headers (bugzilla 146774).
From now GMF is generating separate ???DiagramUpdater class. This class contains a number of static methods and is able to return:
- all semantic children of this diagram element
- all the links incoming/outgoing/contained in this diagram element
This class will be called from generated ???CanonicalEditPolicies and ???NewDiagramFileWizard (for non-synchronized diagrams) while reconstructing actual diagram contents from the domain model.
This class could be called by user-defined actions to query corresponding model elements (for example from “Add shortcut to link” action).
Generated ???VisualIDRegistry structure changed
Generated ???VisualIDRegistry will not have isNode*() and isLink*() methods anymore. These methods were originally created to provide user with possibility to put additional constraint for domain model elements manually written in java there. Currently GMF supports OCL, regexp and Java-based constraints so it’s not necessary to generate this bunch of methods anymore.
For those who used generated isNode*()/isLink*() methods by specifying “@generated NOT” comment and placing some custom code there migration path is:
- add constraint with language == Java, body = <nameOfTheGeneratedMethod> to the corresponding node in .gmfmap model
- transform .gmfmap to .gmfgen and regenerate the code
- review and copy existing implementation of isNode*()/isLink*() into the newly generated methods
- Remove obsolete isNode*()/isLink*() methods
Select source and select target action on any connection in the navigate context menu.
New Border Item Rectilinear router. This router will pick the side it connects to based on the border item location examples for the results with and without the new router:
New label text format options
In addition to MessageFormat toolsmith may choose native, regexp and printf options to format label text. New "editorPattern" attribute in feature label mapping allows to define text for inplace editor.
See http://wiki.eclipse.org/index.php/GMF_Labels for details.