| <h2>Frequently Asked Questions</h2> |
| |
| <!-- <h3>[General]</h3> --> |
| |
| <ol> |
| <h4> |
| <li>Is it possible to separate the diagram data from the domain |
| data? |
| </h4> |
| <p>Yes, and it is also recommended to do so. Simply use the |
| standard EMF mechanisms to store the domain objects in an EMF resource |
| of your choice. The tutorial follows the very simple approach to store |
| both the diagram and domain objects inside the same resource, this is |
| definitely not the way to go for building your own tool. Have a look at |
| this <a |
| href="http://www.eclipse.org/forums/index.php?t=msg&th=172247&start=0&S=acb08c1bf425f0ccb0106fb3a46a4bad"> |
| forum entry</a> to see how it can be changed for the tutorial.</p> |
| |
| <h4> |
| <li>Is it possible to integrate an arbitrary automatic layouter |
| with Graphiti? |
| </h4> |
| <p>Yes, indeed. Use a Custom Feature to do so. The following <a |
| href="resources/TutorialLayoutDiagramFeature.java">snippet</a> shows |
| how a layouter can be integrated into the Graphiti tutorial. In the |
| snippet, we use a layouter which comes with GEF. Note, that this |
| requires a direct dependency to Draw2D. Your Feature Provider has to |
| deliver the Layout Feature as a Custom Feature. Then the action will be |
| available via the context menu.</p> |
| |
| <h4> |
| <li>How do i build an editable property sheet? |
| </h4> |
| <p>We use the non-editable property sheet in the examples.common |
| and examples.tutorial plugins of the Graphiti project as a touchstone. |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <ol> |
| <li>Study the extension point <code>org.eclipse.ui.views.properties.tabbed.propertyContributor</code>. |
| See the <code>org.eclipse.graphiti.examples.common.property</code> |
| package as reference.</li> |
| <li>Study the extension point <code>org.eclipse.ui.views.properties.tabbed.propertySections</code>. |
| See the <code>org.eclipse.graphiti.examples.tutorial.property</code> |
| package as reference.</li> |
| <li>In the class <code>TutorialEClassSection</code> from the |
| tutorial plug-in set the <code>nameText</code> field as editable and |
| add a <code>ModifyListener</code> to the <code>nameText</code> field |
| as shown in the <a href="resources/ModifyListener.txt">snippet</a>.</li> |
| |
| </ol> |
| </p> |
| |
| <h4> |
| <li>How do i build structured menus on context buttons? |
| </h4> |
| <p>If you want a compact context button pad you might consider |
| organizing your context buttons into sub-menus. Use <code>ContextButtonEntry</code>'s |
| method <code>addContextButtonMenuEntry</code> to add sub-entries to the |
| context menu entry. If a menu entry has sub-entries this is visualized |
| by a small triangle in the lower right corner of the entry |
| representation and left-clicking opens the sub-menu.</p> |
| |
| <h4> |
| <li>Why does pressing F2 to enable direct editing only work if the |
| mouse cursor is placed over the shape? |
| </h4> |
| <p>In general it is possible to invoke direct editing for a |
| selected shape by pressing F2. Since the selected object may contain |
| more than one editable object (e.g. two text fields) or the hierarchy |
| may not be clear, the Graphiti framework may not be able to |
| automatically determine which field should be edited. As a last resort |
| the framework tries to use the shape the mouse cursor is placed upon.</p> |
| <p>But you can help the framework out by overriding the method |
| getLocationInfo in your ToolBehaviorProvider. This method is called |
| upon pressing F2 and can return a LocationInfo object stating which |
| text object shall be edited. Here's a <a |
| href="resources/GetLocationInfo.java">short example implementation</a> |
| for the tutorial.</p> |
| </ol> |