|
Re: Diagram partitioning, keep editor [message #642967 is a reply to message #642957] |
Fri, 03 December 2010 14:45 |
Michael Golubev Messages: 383 Registered: July 2009 |
Senior Member |
|
|
Hello,
I am not sure I understand the problem.
All the generated diagram editors implements IReusableEditor, so you should be able to write code like that (in the generated OpenDiagramEditPolicy.OpenDiagramCommand):
Quote: |
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
try {
Diagram diagram = getDiagramToOpen();
if (diagram == null) {
diagram = intializeNewDiagram();
}
URI uri = diagram.eResource().getURI();
uri = uri.appendFragment(diagram.eResource().getURIFragment(diagra m));
String diagramName = getDiagramName(getDiagramDomainElement());
IEditorInput editorInput = new URIEditorInput(uri, diagramName);
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();
XXXDiagramEditor currentEditor = findCurrentEditor(page, getEditorID());
page.reuseEditor(currentEditor, editorInput); //<- reusing, not opening new
//page.openEditor(editorInput, getEditorID());
return CommandResult.newOKCommandResult();
} catch (Exception ex) {
throw new ExecutionException("Can't open diagram", ex);
}
}
|
I have not implemented the findCurrentEditor(IWorkbenchPage page, String editorId), but that should not be difficult.
Regards,
Michael
|
|
|
Re: Diagram partitioning, keep editor [message #643012 is a reply to message #642967] |
Fri, 03 December 2010 16:19 |
Eclipse User |
|
|
|
Originally posted by: marius.groeger.googlemail.com
On 03.12.2010 15:45, Michael Golubev wrote:
> Hello,
> I am not sure I understand the problem.
> All the generated diagram editors implements IReusableEditor, so you
> should be able to write code like that (in the generated
> OpenDiagramEditPolicy.OpenDiagramCommand):
Thanks, that was exactly what I meant - I'll explore that.
Regards
Marius
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02535 seconds