Java Reference
In-Depth Information
name from one that might have been created earlier. Note that you also need to
have the mindmap model and edit projects in the workspace. When using the
new Plug-in Project Wizard, select the option that indicates that the plug-in will
make contributions to the user interface (UI), but don't use any of the provided
templates. When finished, you'll have a basic plug-in with activator class that
extends AbstractUIPlugin .
Diagram Editor
Using the plug-in manifest editor, add a new contribution to the org.eclipse.
ui.editors extension-point. You can do this from the Extensions tab using the
UI, or you can create it directly into the plugin.xml using its Text Editor tab. We
need to supply only the basic information for ID, class, extension, matching
strategy, and contributor class, as shown here:
<extension point="org.eclipse.ui.editors">
<editor
id="org.eclipse.mindmap.diagram.editor.MindmapDiagramEditorID"
name="%editorName"
icon="icons/obj16/MindmapDiagramFile.gif"
extensions="mmd"
default="true"
class="org.eclipse.mindmap.diagram.editor.MindmapDiagramEditor"
matchingStrategy="org.eclipse.gmf.runtime.diagram.ui.
resources.editor.parts.DiagramDocumentEditorMatchingStrategy"
contributorClass="org.eclipse.mindmap.diagram.editor.
MindmapDiagramActionBarContributor">
</editor>
</extension>
Use the provided quick fix support in the editor to add new classes where
required, beginning with the editor class. In the wizard, indicate that the editor
should extend org.eclipse.gmf.runtime.diagram.ui.resources.
editor.parts. DiagramDocumentEditor . This superclass offers almost all
the basic functionality we need, so the only content to add at this point is an ID
field and getter. Note that the ID matches the ID field in our earlier plug-in man-
ifest. If we plan to share the editing domain for this editor, we must enter the
appropriate extension-point contribution and ID with getter in the editor code as
well. We explore the sharing of editing domains in Section 4.4, “Developing a
Requirements Diagram.”
public class MindmapDiagramEditor extends DiagramDocumentEditor {
public MindmapDiagramEditor() {
super(true);
Search WWH ::




Custom Search