GMF Diagram Navigator Use Cases
This page contains main use cases for generated model navigator visualizing diagram file contents and some details concerning current implementation of this functionality.
In addition to diagram surface, GMF should take care on providing diagram file contents for standard eclipse Project Explorer view (visible under General/Project Explorer category). This task consists of generating content, label, action providers and d&d interchange with diagram surface to operate on provided sub-tree below the diagram file node in Project Explorer.
Diagram contents should be provided below the diagram file node selected based on diagram file extension. Provided structure should corresponds with the diagram file content (notation model stored there) with some extensions described below. Generated code should be based on gmfgen model structure, so all the features described below should have a reflection in gmfgen model. Then we are talking about “selected set” of Views, this set should be selected based on visualID attribute attached to each View using an information stored in gmfgen.
It should be possible to provide modified notation model structure into the navigator, with following modifications:
- Show only selected subset of the Views existing in notation model.
Example: hide Views representing labels on diagram.
- Introduce additional group (category) below any View containing some set of child views. This additional group should has own name and icon specified in gmfgen model.
Example: should be able to create artificial group with name “classes” below package diagram and show all the classes from this package only below this group.
- Hide some Views existing in underlying notation model from the navigator tree, show all their child elements directly below their parents.
Example: Do not show compartments in navigator - show all the attributes just below the class node.
- Show selected subset of the Edges below any node in navigator. All Edges visible on diagram are stored in Diagram node inside notation model.
Example: All generalization links should be visible just below the Diagram node in navigator.
Example: Group called “association links” should be created below the Diagram node in navigator, all association links should go to this group.
- Show incoming/outgoing links below the corresponding View representation in navigator or in additional logical group.
Example: All outgoing association links should be located below the class node in navigator (/below the special group “association links”).
- Show child elements of the links. Edge contains sub-nodes in notation model so, corresponding child elements should be represented in a same way as for normal node.
- Show source/target elements of the links. Should be possible to show source/target node connected with the link either directly below the link node or below the group (something like “outgoing links”/“incoming links”).
- Show link destination as a child element of link source.
Example: If containment reference is visualized as link on diagram, user could ask to show two nodes connected with this link as parent and child in model navigator.
Each node provided into Package Explorer view below diagram file should has label and icon.
Should be created based on the corresponding underlying node type and associated semantic element using the following rules:
- for views representing GenNode or GenLink having some labels associated first label text should presented as Package Explorer label.
- GenLabel/GenChildLabelNode - label should be the same as on diagram
- GenCompartment – compartment title should be used
- GenNode/GenLinks without labels and GenDiagram – label feature of underlying semantic model element should be used.
- For Logical Groups the name of the group should be used as a label
User should be able to easily customize labels by specifying "@generated NOT" java-doc comment for the corresponding method and override label creation logic.
Underlying View type should be used to choose correct icon for Package Explorer. All icons should be cached inside singleton ImageRegistry for diagramming plugin. Default icon should be used if there was no image cached in ImageRegistry yet. This icon should be selected based on View type (ElementType) from generated ???ElementTypes class and will be same as an image returned by generated ???IconProvider.
User should be able to show custom icons in navigator by putting desired ImageDescriptors using corresponding key into plugin ImageRegistry. This could be done by implementing custom getImageRegistry() method and initializing returned registry in accordance.
An icon of Logical Groups should be specified in gmfgen model.