Skip to main content



      Home
Home » Eclipse Projects » GEF » Returning null or UnexecutableCommand.INSTANCE
Returning null or UnexecutableCommand.INSTANCE [message #125246] Thu, 01 April 2004 03:39 Go to next message
Eclipse UserFriend
Could someone please clarify the rationale behind the use of null or
UnexecutableCommand.INSTANCE as the returned value from various
getXXXCommand methods in the edit policies classes. The GEF examples
sometimes use null and sometimes UnexecutableCommand.INSTANCE. And if you
interchange them the behaviour is not the same.

Thank you in advance.

Jose M Beleta
Re: Returning null or UnexecutableCommand.INSTANCE [message #125376 is a reply to message #125246] Thu, 01 April 2004 10:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

null means no participation, unexecutable means disallow the operation.
Because of the "chain of command" pattern used in editpolicies, you need to
be specific about these two cases.

"Jose M Beleta" <beleta@attglobal.net> wrote in message
news:c4gk79$j39$1@eclipse.org...
> Could someone please clarify the rationale behind the use of null or
> UnexecutableCommand.INSTANCE as the returned value from various
> getXXXCommand methods in the edit policies classes. The GEF examples
> sometimes use null and sometimes UnexecutableCommand.INSTANCE. And if you
> interchange them the behaviour is not the same.
>
> Thank you in advance.
>
> Jose M Beleta
>
>
Re: Returning null or UnexecutableCommand.INSTANCE [message #125448 is a reply to message #125376] Thu, 01 April 2004 16:47 Go to previous messageGo to next message
Eclipse UserFriend
Randy, thank you for your response.

I have a class that extends GraphicalNodeEditPolicy.

I am making connections and want to disallow starting a connection from a
specific EditPart. So I write copying from your samples but changing

return null;

by

return UnexecutableCommand.INSTANCE;

the following code:
protected Command getConnectionCreateCommand(CreateConnectionRequest
request)

{

...

if (notAllowed())

return UnexecutableCommand.INSTANCE;

// return null;

ConnectionCreateCommand cmd = new ConnectionCreateCommand(request,
source);

request.setStartCommand(cmd);

return cmd;

}

Then when I select the connection tool and pass the mouse pointer over the
EditPart the pointer does not change to prohibited signal as expected. If I
return null the prohibited signal is shown. This is the opposite to the
behaviour you suggested in your comment.

Jose M Beleta


"Randy Hudson" <none@us.ibm.com> escribi
Re: Returning null or UnexecutableCommand.INSTANCE [message #125487 is a reply to message #125448] Thu, 01 April 2004 21:26 Go to previous message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

I have only ever used null. But I don't have any chained commands I
dont believe.

I have used a NodeEditPolicy, and I too am returning null.




Jose M Beleta wrote:
> Randy, thank you for your response.
>
> I have a class that extends GraphicalNodeEditPolicy.
>
> I am making connections and want to disallow starting a connection from a
> specific EditPart. So I write copying from your samples but changing
>
> return null;
>
> by
>
> return UnexecutableCommand.INSTANCE;
>
> the following code:
> protected Command getConnectionCreateCommand(CreateConnectionRequest
> request)
>
> {
>
> ...
>
> if (notAllowed())
>
> return UnexecutableCommand.INSTANCE;
>
> // return null;
>
> ConnectionCreateCommand cmd = new ConnectionCreateCommand(request,
> source);
>
> request.setStartCommand(cmd);
>
> return cmd;
>
> }
>
> Then when I select the connection tool and pass the mouse pointer over the
> EditPart the pointer does not change to prohibited signal as expected. If I
> return null the prohibited signal is shown. This is the opposite to the
> behaviour you suggested in your comment.
>
> Jose M Beleta
>
>
> "Randy Hudson" <none@us.ibm.com> escribió en el mensaje
> news:c4hd5g$8pb$1@eclipse.org...
>
>>null means no participation, unexecutable means disallow the operation.
>>Because of the "chain of command" pattern used in editpolicies, you need
>
> to
>
>>be specific about these two cases.
>>
>>"Jose M Beleta" <beleta@attglobal.net> wrote in message
>>news:c4gk79$j39$1@eclipse.org...
>>
>>>Could someone please clarify the rationale behind the use of null or
>>>UnexecutableCommand.INSTANCE as the returned value from various
>>>getXXXCommand methods in the edit policies classes. The GEF examples
>>>sometimes use null and sometimes UnexecutableCommand.INSTANCE. And if
>
> you
>
>>>interchange them the behaviour is not the same.
>>>
>>>Thank you in advance.
>>>
>>>Jose M Beleta
>>>
>>>
>>
>>
>
>


--
Respectfully,


CL Gilbert

"Verily, verily, I say unto you, He that entereth not by the door() into
the sheepfold{}, but climbeth up some other *way, the same is a thief
and a robber." John 10:1

GnuPG Key Fingerprint:
82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D

For a free Java interface to Freechess.org see
http://www.rigidsoftware.com/Chess/chess.html
Previous Topic:Label to connector disappears.
Next Topic:GEF Install
Goto Forum:
  


Current Time: Tue Jul 22 08:32:23 EDT 2025

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

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

Back to the top