[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: selectAddedObject() throws NullPointerException only on Linux

Sounds like the tool is getting a FocusLost event on Linux, and setting the
current view to NULL.  If you are going to override performCreation(), you
probably shouldn't call super in this case.

"Barry Andrews" <bandrews@xxxxxxxxxxxxxxxx> wrote in message
news:con94b$bpn$1@xxxxxxxxxxxxxxxxxx
> Hello,
> I think this is probably a bug, but I would like to confirm with the
> experts here before logging. I have overridden CreationTool to provide
> additional functionality to performCreation() method. My class looks
> like this:
>
> public class DECreationTool extends CreationTool
> {
>      /**
>       *
>       */
>      public DECreationTool()
>      {
>          super();
>      }
>
>      /**
>       * @param aFactory
>       */
>      public DECreationTool(CreationFactory aFactory)
>      {
>          super(aFactory);
>      }
>
>
>      /* (non-Javadoc)
>       * @see org.eclipse.gef.tools.CreationTool#performCreation(int)
>       */
>      protected void performCreation(int button)
>      {
>          CreateCommand command = (CreateCommand)this.getCommand();
>
>          if(command.preExecute())
>          {
>              this.setCurrentCommand(command);
>              try
>              {
>                  super.performCreation(button);
>              }
>              catch(NullPointerException $ne)
>              {
>                  //TODO I only get this problem on Linux. It happens when
>                  // selectAddedObject() is called.
>                  ;
>              }
>          }
>      }
> }
>
> All the preExecute() method does is gets some information from the user
> via a dialog and returns true/false based on whether or not the
> information was valid.
>
> The problem is when selectAddedObject() method is called, the
> EditPartViewer from getCurrentViewer() is null.
>
> This only happens on Linux. It works fine on Windows. Is it obvious I am
> doing something wrong here, or is it a bug in the framework?
>
> many thanks,
>
> Barry