Java Reference
In-Depth Information
because of some outstanding issues with keyboard binding at the time of this
writing.
First, we add the object contribution to our org.eclipse.mindmap.
diagram.custom plug-in manifest, as shown. Only our Topic EditPart
classes need the contribution because it makes sense to add a new subtopic only
from the context of an existing Topic . The only nodes on our diagram are either
Topic s or Subtopics, so we use their superclass ShapeNodeEditPart for the
objectClass . We're defining an Insert menu item, with a child Subtopic action.
We could have created a single menu item (Insert
Subtopic), but this gives us
a placeholder for other possible additions, such as Insert
Parent Topic.
<extension point="org.eclipse.ui.popupMenus">
<objectContribution adaptable="false"
id="org.eclipse.mindmap.diagram.ui.objectContribution.TopicEditPart"
objectClass="org.eclipse.gmf.runtime.diagram.ui.editparts.
ShapeNodeEditPart">
<menu
id="MindmapInsert"
label="&amp;Insert"
path="additions">
<separator name="group1"/>
</menu>
<action
class="org.eclipse.mindmap.diagram.part.MindmapCreateSubtopicAction"
definitionId="org.eclipse.mindmap.insertSubtopic"
enablesFor="1"
id="org.eclipse.mindmap.popup.MindmapCreateSubtopicActionID"
label="&amp;Subtopic"
menubarPath="MindmapInsert/group1">
</action>
</objectContribution>
</extension>
The declared action class is MindmapCreateSubtopicAction , which we
have defined next. It enables only a single Topic selection because it doesn't
make sense to invoke the action for multiple selected Topic elements. Before
diving into the action code, we complete our definition by contributing to the
commands and bindings extension-points.
<extension point="org.eclipse.ui.bindings">
<key
commandId="org.eclipse.mindmap.insertSubtopic"
contextId="org.eclipse.mindmap.diagram.ui.diagramContext"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+I"/>
</extension>
Search WWH ::




Custom Search