Java Reference
In-Depth Information
Figure 4-24
Requirements editing domain
With our editors sharing a common editing domain, now we turn to each of
our pages in the multipage editor because they need a reference to this shared
domain. Fortunately, GMF comes with a FileEditorInputProxy class that we can
use to initialize each of the pages. First, we need to add a dependency from our
EMF editor plug-in to our
org.eclipse.requirements.diagram
plug-in
and re-export all the
org.eclipse.gmf.runtime.*
plug-ins from the diagram
editor manifest. After this, navigate to the
init()
method of the
RequirementsEditor class. Mark the method with
@generated NOT
and mod-
ify accordingly (changes in bold):
/**
* This is called during startup.
* Modified to pass FileEditorInputProxy as input for
* TransactionalEditingDomain support.
*
* @generated
NOT
*/
@Override
public void init(IEditorSite site, IEditorInput editorInput) {
IEditorInput input = editorInput;
if (input instanceof IFileEditorInput) {
input = new FileEditorInputProxy((IFileEditorInput) input,
(TransactionalEditingDomain) editingDomain);
}
setSite(site);
setInputWithNotify(
input
);
setPartName(
input
.getName());
site.setSelectionProvider(this);
site.getPage().addPartListener(partListener);
ResourcesPlugin.getWorkspace().addResourceChangeListener(
resourceChangeListener, IResourceChangeEvent.POST_CHANGE);
}
Search WWH ::
Custom Search