Java Reference
In-Depth Information
With our diagram becoming just another page in a multipage editor, we need
to modify its generated code a bit to take into account the passed
FileEditorInputProxy . Open the org.eclipse.requirements.
diagram.part.RequirementsDocumentProvider class and replace all uses
of org.eclipse.ui.part.FileEditorInput with org.eclipse.ui.
IFileEditorInput , with the exception of the method handleElement
Moved() . Don't forget to mark each section with @generated NOT .
Next, we need to modify the createEmptyDocument() method so that it
uses the passed EditingDomain instead of creating its own. Actually, we have
the original method delegate to a new method that takes an input parameter and
modify the createDocument() method to pass its parameter as follows
(changes in bold):
/**
* @generated NOT
*/
protected IDocument createDocument(Object element) throws CoreException
{
// ...
IDocument document = createEmptyDocument( element );
setDocumentContent(document, (IeditorInput) element);
setupDocument(element, document);
return document;
}
/**
* Modified to use passed EditingDomain
*
* @generated NOT
*/
protected IDocument createEmptyDocument() {
return createEmptyDocument(null);
}
/**
* Use passed EditingDomain from input
*/
protected IDocument createEmptyDocument(Object input) {
DiagramDocument document = new DiagramDocument();
if (input instanceof FileEditorInputProxy) {
FileEditorInputProxy proxy = (FileEditorInputProxy) input;
document.setEditingDomain(proxy.getEditingDomain());
} else {
document.setEditingDomain(createEditingDomain());
}
return document;
}
Search WWH ::




Custom Search