Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Possible NullPointerException in GMF(NullPointerException in GMF)
Possible NullPointerException in GMF [message #1011742] Wed, 20 February 2013 07:18 Go to next message
MyungWoon Oh is currently offline MyungWoon OhFriend
Messages: 30
Registered: March 2012
Member
The Situation
- I opened 2 or more GMF editors.
- The focus is in the editor that has at least one diagram.

When I move focus to other editor that doesn't have any diagram yet, I got 2 Exceptions like below.

#1 Exception
org.eclipse.core.runtime.AssertionFailedException: null argument:
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:73)
at org.eclipse.gmf.runtime.diagram.ui.render.internal.commands.CopyImageCommand.<init>(CopyImageCommand.java:96)
at org.eclipse.gmf.runtime.diagram.ui.render.internal.providers.ImageSupportGlobalActionHandler$1.<init>(ImageSupportGlobalActionHandler.java:104)
at org.eclipse.gmf.runtime.diagram.ui.render.internal.providers.ImageSupportGlobalActionHandler.getCopyCommand(ImageSupportGlobalActionHandler.java:104)
......
This happens because diagramPart.getDiagram() in org.eclipse.gmf.runtime.diagram.ui.render.internal.providers.ImageSupportGlobalActionHandler.getCopyCommand(ImageSupportGlobalActionHandler.java:104 returns null if the diagramPart doesn't have any diagram yet.

#2 Exception
java.lang.NullPointerException
at org.eclipse.gmf.runtime.diagram.ui.actions.internal.ShowConnectionLabelsAction.createOperationSet(ShowConnectionLabelsAction.java:84)
.......
This happens because getDiagramEditPart() in at org.eclipse.gmf.runtime.diagram.ui.actions.internal.ShowConnectionLabelsAction.createOperationSet(ShowConnectionLabelsAction.java:84) returns null if the the diagramPart doesn't have any diagram yet.



So, I think those 2 errors had better be fixed.
Thank you.
Re: Possible NullPointerException in GMF [message #1016990 is a reply to message #1011742] Fri, 08 March 2013 13:59 Go to previous message
Thomas Beyer is currently offline Thomas BeyerFriend
Messages: 55
Registered: February 2013
Member
Hi MyungWoon,

there could be something misconfigured in the diagram, your are testing.
GMF creates the Notation-Diagram and its Domain-Model-counterpart upon every Diagram-creation.
Since these elements define the very root of your models, they should never be deleted.
GMF usually takes care that this won't happen.

Please check your generated
XXXDiagramEditorUtil.createDiagram(URI diagramURI, URI modelURI,IProgressMonitor progressMonitor)
to ensure everything will be created properly on diagram-creation.

So the case you are describing, the DiagramEditPart's query for its Notation-Diagram resulting in a NPE, should never happen.
Did you modify any code, that could possibly corrupt your models?

Regards
Thomas
Previous Topic:Delete From Diagram
Next Topic:Dynamically extending the palette
Goto Forum:
  


Current Time: Mon Dec 22 01:24:43 GMT 2014

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

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