Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsDiagramComposite workbench part
https://www.eclipse.org/forums/index.php/mv/msg/1066501/1695192/#msg_1695192
I am trying to extend the new DiagramComposite class from Graphiti 0.10 and I am facing a problem I do not know how to solve. Here it is :
For demo purposes, I am trying to launch a Dialog containing a Graphiti diagram composite from a Graphiti diagram editor. Both diagrams share the same DiagramEditorInput and a common DiagramBehavior but one is extending the DiagramEditor class and the other extends the DiagramComposite class.
Then when I launch the dialog I have tried to instantiate my DiagramComposite with a IWorkbenchPart and without.
* With a IWorkbenchPart, the editor works well but when I close the window (call #dispose()) it unregisters all actions defined in the WorkbenchPart including the ones I have declared in the parent graphical editor !
* Without this IWorkbenchPart the editor does not start because of NullPointerExceptions in the Graphiti library. Actually these NPE are thrown because of many calls to "IDiagramContainerUI#getWorkbenchPart()#getSite()" failing because getWorkbenchPart() returns null.
You can find such calls in ElementDeleteListener (l.64), in DiagramComposite (a lot of times), and in other classes. I have tried to manually modify the variable values to avoid throwing NPE everytime "getWorkbenchPart()#getSite()" is called and it seems to work.
Final question: should I be instantiating a DiagramComposite without a workbench part?
If NO how to solve the dispose() problem?
If YES I guess some refactor is needed in that part of the library. I suggest to replace every "getWorkbenchPart()#getSite()" by a "getSite()" which is defined in IDiagramContainerUI, and add a check in "getSite()" to be sure the WorkbenchPart() is not null there. If so return null.
Thanks for your advice !
Regards,
Jérôme]]>Jerome Sivadier2015-05-12T14:40:21-00:00Re: DiagramComposite workbench part
https://www.eclipse.org/forums/index.php/mv/msg/1066501/1695510/#msg_1695510
the intention is to to start the composite with a workbench part. And it
sounds as if the indirection you describe for getting the site is missing.
Would you file a bug for that, please?
Since this will be an API change I'm afraid we will only be able to do that
for the next developement cycle as we have already passed API freeze...
Thanks,
Michael]]>Michael Wenz2015-05-15T13:23:05-00:00Re: DiagramComposite workbench part
https://www.eclipse.org/forums/index.php/mv/msg/1066501/1695650/#msg_1695650
Thanks for this reply, here is the bug I have reported: https://bugs.eclipse.org/bugs/show_bug.cgi?id=467502
No problem for the API freeze, I will wait and maybe clone the project and modify it locally if I need this feature in a close future.