Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Diagram partitioning, keep editor
Diagram partitioning, keep editor [message #642957] Fri, 03 December 2010 14:00 Go to next message
Eclipse UserFriend
Originally posted by: marius.groeger.googlemail.com

Hello,

when using diagram partitiong (good info about this here [1] and here
[2]) - how would an OpenEditPolicy look that openes the new diagram in
the same editor page? Would it even be possible to stack those diagrams,
perhaps with a breadcrumps control at the top?

Regards,
Marius

[1] http://wiki.eclipse.org/Diagram_Partitioning
[2] http://www.jevon.org/wiki/GMF_Troubleshooting_5
Re: Diagram partitioning, keep editor [message #642967 is a reply to message #642957] Fri, 03 December 2010 14:45 Go to previous messageGo to next message
Michael Golubev is currently offline Michael GolubevFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Diagram partitioning, keep editor [message #644623 is a reply to message #643012] Mon, 13 December 2010 14:18 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 268
Registered: March 2010
Senior Member
Hi,

Can i have an idea about the implmentation of findCurrentEditor(IWorkbenchPage page, String editorId).

Thanks a lot
Re: Diagram partitioning, keep editor [message #644663 is a reply to message #644623] Mon, 13 December 2010 16:58 Go to previous message
Michael Golubev is currently offline Michael GolubevFriend
Messages: 383
Registered: July 2009
Senior Member
Hello,

Not sure, but IWorkbenchPage#findEditors(IEditorInput input, String editorId, int matchFlags) looks like a promising starting point.

Regards,
Michael
Previous Topic:How to set target decoration of connectors
Next Topic:Showing the property while programmatically selecting a node
Goto Forum:
  


Current Time: Fri Apr 19 18:04:36 GMT 2024

Powered by FUDForum. Page generated in 0.02535 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top