Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » NPE when initialising GraphicalEditor
NPE when initialising GraphicalEditor [message #668200] Wed, 04 May 2011 09:33 Go to previous message
Pewterfish  is currently offline Pewterfish
Messages: 2
Registered: May 2011
Junior Member
Hi folk,

I'm attempting to build a GEF-based model editor in an RCP application, and hitting a little trouble. I'm following the guide located at http://www.ibm.com/developerworks/library/os-eclipse-gef11/ (this is my first GEF project), and it's mostly been pretty straightforward. However, now I've finished defining editparts and writing figure drawing code, and it's time to pull it all together... and it doesn't work.

I've subclassed GraphicalEditor to create an editor (at the moment I'm just giving it an EditPartFactory and a Model, as recommended in the IBM tutorial), and am displaying it on a View. However, when I try to instantiate this editor, I get a null-pointer exception in GraphicallEditor.hookGraphicalViewer(), which appears to be coming from a getSite() call that returns null. The entire stack trace is posted below.

I'm using Eclipse Helios and GEF 3.7.0 (upgraded from 3.6.2 in the hopes of a bugfix that didn't materialise).

Can anyone shed any light on what's going wrong here? I'm a fairly experienced Java programmer but am comparatively new to Eclipse RCP/GEF, so I suspect I'm making a simple but non-obvious mistake Confused

Quote:
java.lang.NullPointerException
at org.eclipse.gef.ui.parts.GraphicalEditor.hookGraphicalViewer (GraphicalEditor.java:332)
at org.eclipse.gef.ui.parts.GraphicalEditor.createGraphicalView er(GraphicalEditor.java:157)
at org.eclipse.gef.ui.parts.GraphicalEditorWithPalette.createPa rtControl(GraphicalEditorWithPalette.java:63)
at gefexperiment.ReqAnalyserView.createPartControl(ReqAnalyserV iew.java:36)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewR eference.java:375)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReferen ce.java:229)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:595)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:31 3)
at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:52 9)
at org.eclipse.ui.internal.presentations.PresentablePart.setVis ible(PresentablePart.java:180)
at org.eclipse.ui.internal.presentations.util.PresentablePartFo lder.select(PresentablePartFolder.java:270)
at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrd er.select(LeftToRightTabOrder.java:65)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresen tation.selectPart(TabbedStackPresentation.java:473)
(...and so on back to org.eclipse.equinox.launcher.Main)
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:One-click drag of the endpoint of a connector
Next Topic:z-order of children edit parts
Goto Forum:
  


Current Time: Tue May 21 06:49:22 EDT 2013

Powered by FUDForum. Page generated in 0.01661 seconds