DiagramComposite workbench part [message #1695192] |
Tue, 12 May 2015 14:40  |
Jerome Sivadier Messages: 15 Registered: May 2015 |
Junior Member |
|
|
Hello Michael,
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
[Updated on: Tue, 12 May 2015 14:42] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02329 seconds