Java Reference
In-Depth Information
implement
IDiagramWorkbenchPart
, with each of its methods delegating to
our
diagramEditor
:
public
Diagram getDiagram() {
return
diagramEditor.getDiagram();
}
public
IDiagramEditDomain getDiagramEditDomain() {
return
diagramEditor.getDiagramEditDomain();
}
public
DiagramEditPart getDiagramEditPart() {
return
diagramEditor.getDiagramEditPart();
}
public
IDiagramGraphicalViewer getDiagramGraphicalViewer() {
return
diagramEditor.getDiagramGraphicalViewer();
}
Our diagram plug-in manifest contains contributions to
globalAction-
HandlerProviders
, each using the ID of the diagram editor. We need to either
modify the IDs to be that of our EMF editor (now multipage), or copy this con-
tribution to the other editor manifest, change the IDs, and make the priorities
higher than the diagram editor. We opt for the second approach here, pasting the
entire
globalActionHandlerProviders
section into the
org.ecilpse.
requiremements.model.editor plugin.xml
file, replacing the three
Priorities
with
Low
and changing each of the
ViewId
s to
org.eclipse.
requirements.presentation.RequirementsEditorID
.
Creation Wizard
Recall the “Resource contains no diagram” error we received when attempting
to create a new Requirements model using the EMF-generated wizard. The EMF-
generated wizard knows nothing about creating the diagram, which is an
instance of the GMF notation model. We need to modify the
performFinish()
method to create and initialize a diagram when the domain model is created
(changes in bold).
/**
* Do the work after everything is specified.
*
Modified to include diagram
.
*
* @generated
NOT
*/
@Override
public boolean performFinish() {
Search WWH ::
Custom Search