Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » NullPointerException at ITransformableContentPart
NullPointerException at ITransformableContentPart [message #1793763] Wed, 15 August 2018 11:46 Go to next message
Robert Stelzmann is currently offline Robert StelzmannFriend
Messages: 3
Registered: July 2018
Junior Member
Hey guys,

I'm quite new to GEF5 and I'm currently working through the "Getting started with GEF" (at the Itemis website; sorry, I'm not yet allowed to place foreign links in this forum). I've successfully managed to complete the second part of the tutorial and implemented a simple diagram with the capability to translate and resize my nodes. Afterwards I started to migrate this diagram to our Eclipse RCP project (and removed the "resize" capability) and now I'm continuously getting NullPointerExceptions on ITransformableContentPart.


Here you can see the implementation of doRefreshVisual of the problematic GEF-Part.
    protected void doRefreshVisual(final OperatorVisual visual) {
        final OperatorRepresentation operator = getContent();

        visual.setPrefSize(operator.getBounds().getWidth(), operator.getBounds().getHeight());


I've also implemented the ITransformableContentPart interface likewise in the aforementioned tutorial.
    public Affine getContentTransform() {
        final Rectangle bounds = getContent().getBounds();
        return new Affine(new Translate(bounds.getX(), bounds.getY()));

    public void setContentTransform(final Affine totalTransform) {
        // storing the new position
        final Rectangle bounds = getContent().getBounds().getCopy();

My module implementation is also more or less a copy of the tutorial temlate.
public class DiagramModule extends MvcFxModule {

    protected void configure() {


        bindOperatorPartAdapters(AdapterMaps.getAdapterMapBinder(binder(), OperatorPart.class));

    protected void bindOperatorPartAdapters(final MapBinder<AdapterKey<?>, Object> adapterMapBinder) {
        // provides a hover feedback to the shape, used by the HoverBehavior
        AdapterKey<?> role = AdapterKey.role(DefaultHoverFeedbackPartFactory.HOVER_FEEDBACK_GEOMETRY_PROVIDER);

        // provides a selection feedback to the shape
        role = AdapterKey.role(DefaultSelectionFeedbackPartFactory.SELECTION_FEEDBACK_GEOMETRY_PROVIDER);

        // support moving nodes via mouse drag

    protected void bindIContentPartFactory() {

    protected void bindAbstractContentPartAdapters(final MapBinder<AdapterKey<?>, Object> adapterMapBinder) {

        // binding the HoverOnHoverPolicy to every part
        // if a mouse is moving above a part it is set i the HoverModel

        // add the focus and select policy to every part, listening to clicks
        // and changing the focus and selection model

    protected void bindIRootPartAdaptersForContentViewer(final MapBinder<AdapterKey<?>, Object> adapterMapBinder) {

        // binding a Hover Behavior to the root part. it will react to
        // HoverModel changes and render the hover part


Any suggestions?
Re: NullPointerException at ITransformableContentPart [message #1793766 is a reply to message #1793763] Wed, 15 August 2018 12:50 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Robert,

the root of the problem should be that OperatorPart does not have a TRANSFORM_PROVIDER (adapter) when setVisualTransform() is called, i.e. the getAdapter() call inside setVisualTransform() returns null. This should be easy to validate.

Possible causes of the top of my head:
- OperatorPart does not extend AbstractContentPart
- OperatorPart is not constructed using the Injector
- OperatorPart#doRefreshVisual() is called explicitly in a place where setup is not yet complete

Best regards,
Re: NullPointerException at ITransformableContentPart [message #1793770 is a reply to message #1793766] Wed, 15 August 2018 13:04 Go to previous message
Robert Stelzmann is currently offline Robert StelzmannFriend
Messages: 3
Registered: July 2018
Junior Member
Hi Matthias,

that was my mistake:
Matthias Wienand wrote on Wed, 15 August 2018 12:50
- OperatorPart is not constructed using the Injector

Thank you so much for the hint! :-)

Best regards,
Previous Topic:[GEF4] Multiple selection performance problem
Next Topic:GEF/ZEST more complex examples/projects
Goto Forum:

Current Time: Sun May 19 03:09:58 GMT 2024

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

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

Back to the top