Skip to main content



      Home
Home » Eclipse Projects » GEF » Returning null or UnexecutableCommand.INSTANCE; is this a bug?
Returning null or UnexecutableCommand.INSTANCE; is this a bug? [message #125745] Mon, 05 April 2004 05:35 Go to next message
Eclipse UserFriend
Sorry for insisting but I am really lost. If you said:

> null means no participation, unexecutable means disallow the operation.

Why when I am returnning null from
GraphicalNodeEditPolicy#getConnectionCreateCommand the UI shows a prohibited
sign but no such a sign is shown when returning
UnexecutableCommand.INSTANCE.

Is this a bug or I am missing something?

Best regards,

Jose M Beleta
Re: Returning null or UnexecutableCommand.INSTANCE; is this a bug? [message #125826 is a reply to message #125745] Mon, 05 April 2004 15:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

This is not a bug. If no one participates, then the operation is not
handled by anyone, so you get a not sign.

"Jose M Beleta" <beleta@attglobal.net> wrote in message
news:c4r8ul$1h6$1@eclipse.org...
> Sorry for insisting but I am really lost. If you said:
>
> > null means no participation, unexecutable means disallow the operation.
>
> Why when I am returnning null from
> GraphicalNodeEditPolicy#getConnectionCreateCommand the UI shows a
prohibited
> sign but no such a sign is shown when returning
> UnexecutableCommand.INSTANCE.
>
> Is this a bug or I am missing something?
>
> Best regards,
>
> Jose M Beleta
>
>
Re: Returning null or UnexecutableCommand.INSTANCE; is this a bug? [message #125852 is a reply to message #125826] Mon, 05 April 2004 15:46 Go to previous messageGo to next message
Eclipse UserFriend
OK. Thank you Randy.

Now I understand null. But don't you think that if
UnexecutableCommand.INSTANCE is returned the not sign has to be shown as
well.

Regards,

Jose M Beleta

"Randy Hudson" <none@us.ibm.com> escribi
Re: Returning null or UnexecutableCommand.INSTANCE; is this a bug? [message #125902 is a reply to message #125826] Mon, 05 April 2004 20:29 Go to previous messageGo to next message
Eclipse UserFriend
Randy,

Perhaps I found the reason of what I think is an incorrect behavior:

this is the code of AbstractConnectionCreationTool#calculateCursor()

/**

* @see org.eclipse.gef.tools.AbstractTool#calculateCursor()

*/

protected Cursor calculateCursor() {

if (isInState(STATE_INITIAL)) {

if (getCurrentCommand() != null)

// IMHO the preceding line has to be set to:

// if (getCurrentCommand() != null && getCurrentCommand().canExecute())

return getDefaultCursor();

}

return super.calculateCursor();

}



and this is the code of AbstractTool#calculateCursor()

protected Cursor calculateCursor() {

if (isInState(STATE_TERMINAL))

return null;

Command command = getCurrentCommand();

if (command == null || !command.canExecute())

return getDisabledCursor();

return getDefaultCursor();

}


As you can see AbstractTool#calculateCursor() checks for executability but
AbstractConnectionCreationTool#calculateCursor() only checks for null.

Regards,

Jose M Beleta

"Randy Hudson" <none@us.ibm.com> escribi
Re: Returning null or UnexecutableCommand.INSTANCE; is this a bug? [message #125983 is a reply to message #125826] Tue, 06 April 2004 06:00 Go to previous messageGo to next message
Eclipse UserFriend
I filled a bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=57545.

In this bug I also point out the need for changing
AbstractConnectionCreationTool#handleButtonDown() for the same reason.

Jose M Beleta

"Randy Hudson" <none@us.ibm.com> escribi
Re: Returning null or UnexecutableCommand.INSTANCE; is this a bug? [message #126111 is a reply to message #125902] Tue, 06 April 2004 10:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Connection creation is done by asking two different editparts to build the
overall command for the creation. Because the source editpart is only
building half of a command, that command may not be executable, and in fact
there is never any attempt to execute half of creation. So, this is the one
case where returning unexecutable command will have a delayed effect. We
cannot change this for compatibility reasons.

"Jose M Beleta" <beleta@attglobal.net> wrote in message
news:c4staq$5lh$1@eclipse.org...
> Randy,
>
> Perhaps I found the reason of what I think is an incorrect behavior:
>
> this is the code of AbstractConnectionCreationTool#calculateCursor()
>
> /**
>
> * @see org.eclipse.gef.tools.AbstractTool#calculateCursor()
>
> */
>
> protected Cursor calculateCursor() {
>
> if (isInState(STATE_INITIAL)) {
>
> if (getCurrentCommand() != null)
>
> // IMHO the preceding line has to be set to:
>
> // if (getCurrentCommand() != null && getCurrentCommand().canExecute())
>
> return getDefaultCursor();
>
> }
>
> return super.calculateCursor();
>
> }
>
>
>
> and this is the code of AbstractTool#calculateCursor()
>
> protected Cursor calculateCursor() {
>
> if (isInState(STATE_TERMINAL))
>
> return null;
>
> Command command = getCurrentCommand();
>
> if (command == null || !command.canExecute())
>
> return getDisabledCursor();
>
> return getDefaultCursor();
>
> }
>
>
> As you can see AbstractTool#calculateCursor() checks for executability but
> AbstractConnectionCreationTool#calculateCursor() only checks for null.
>
> Regards,
>
> Jose M Beleta
>
> "Randy Hudson" <none@us.ibm.com> escribi
Re: Returning null or UnexecutableCommand.INSTANCE; is this a bug? [message #126191 is a reply to message #126111] Tue, 06 April 2004 14:23 Go to previous message
Eclipse UserFriend
Randy, now I understand both null and UnexecutableCommand.INSTANCE. However
I am continuing thinking, as I already said, that this explanation depends
on the implementation and does not come from that is expressed in the
documentation. You will understand that is a little bit difficult to figure
out and understand those subtle concepts and behaviours and lacks of
homogeneity without your experience and without digging into the source
code.

If UnexecutableCommand.INSTANCE cannot be used to prohibit a starting
connection it should be stated in the documentation.

Thanks again for such a great product and API.

Best regards,

Jose M Beleta

"Randy Hudson" <none@us.ibm.com> escribi
Previous Topic:Dom4j problems in GEF-plugin
Next Topic:Figure in targetDecoration
Goto Forum:
  


Current Time: Sun May 11 20:06:20 EDT 2025

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

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

Back to the top