Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Problems with CreationTool and disabled cursor
Problems with CreationTool and disabled cursor [message #164558] Wed, 19 January 2005 08:37 Go to next message
Marion Schmid is currently offline Marion SchmidFriend
Messages: 35
Registered: July 2009
Member
Hello community,

are there any problems known concerning the cursor change from default
cursor to the disabled cursor with the CreationTool?
For some reason, in our examples, when dragging a child element onto a
forbidden parent container in the viewer,
the cursor remains as default cursor. With other tools (dragging connection,
moving edit parts somewhere they should not be moved to) the disabled cursor
works. The reason is not in

AbstractTool#calculateCursor() {
if (command == null || !command.canExecute())
return getDisabledCursor();

that is, actually, the disabledCursor is returned, but as is null, the
default cursor is returned.

I debugged a bit more and found out that in CreationTool#refreshCursor() ->
calculateCursor(), for the CreationTool the state is always STATE_INITIAL,
so I thought here's the problem ?

In this method (AbstractTool) there's some debug possibility, but how do I
enable this?

protected void setState(int state) {
this.state = state;
if (GEF.DebugToolStates)
GEF.debug("STATE CHANGE:\t" + getDebugName() + //$NON-NLS-1$
":\t" + getDebugNameForState(this.state) + //$NON-NLS-1$
" <" + state + '>'); //$NON-NLS-1$
}

Thanks in advance if someone can help
and best regards,

Marion
Re: Problems with CreationTool and disabled cursor [message #164604 is a reply to message #164558] Wed, 19 January 2005 16:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

For connection creation, the original command from the source node is passed
to the target node for completion. Therefore, the original connection is
not complete and probably can't execute. So the connection tool does not
call canExecute() to determine cursor.

The target should return NULL as the command for the request. Or, better
yet, the target should not get targeted and then the target will *be* null,
which should also show the NOT cursor.

"Marion Schmid" <marion.schmid@sap.com> wrote in message
news:csl691$mqt$1@www.eclipse.org...
> Hello community,
>
> are there any problems known concerning the cursor change from default
> cursor to the disabled cursor with the CreationTool?
> For some reason, in our examples, when dragging a child element onto a
> forbidden parent container in the viewer,
> the cursor remains as default cursor. With other tools (dragging
> connection,
> moving edit parts somewhere they should not be moved to) the disabled
> cursor
> works. The reason is not in
>
> AbstractTool#calculateCursor() {
> if (command == null || !command.canExecute())
> return getDisabledCursor();
>
> that is, actually, the disabledCursor is returned, but as is null, the
> default cursor is returned.
>
> I debugged a bit more and found out that in
> CreationTool#refreshCursor() ->
> calculateCursor(), for the CreationTool the state is always STATE_INITIAL,
> so I thought here's the problem ?
>
> In this method (AbstractTool) there's some debug possibility, but how do I
> enable this?
>
> protected void setState(int state) {
> this.state = state;
> if (GEF.DebugToolStates)
> GEF.debug("STATE CHANGE:\t" + getDebugName() + //$NON-NLS-1$
> ":\t" + getDebugNameForState(this.state) + //$NON-NLS-1$
> " <" + state + '>'); //$NON-NLS-1$
> }
>
> Thanks in advance if someone can help
> and best regards,
>
> Marion
>
>
>
>
Re: Problems with CreationTool and disabled cursor [message #164731 is a reply to message #164604] Thu, 20 January 2005 14:44 Go to previous messageGo to next message
Marion Schmid is currently offline Marion SchmidFriend
Messages: 35
Registered: July 2009
Member
Hello Randy,
maybe there's a little misunderstanding, I meant that I have problems with
the creation of new objects in the viewer, i.e. selecting the kind of
object to be created in my palette and hovering my mouse over potential
parent (container) elements in the viewer.

The cursor when dragging a connection, i.e. ConnectionCreationTool works
fine for us.
But with your hint, I took as well a look at the
AbstractConnectionTool#calculateCursor(), and as it's different to
CreationTool#calculateCursor() (where I debugged) I tried the coding
AbstractConnectionTool#calculateCursor() in the CreationTool source - and
partly succeeded (=>for most creations, the disabled cursor appears
correctly:-)

_the commented lines are the original lines in CreationTool___

protected Cursor calculateCursor() {
// if (isInState(STATE_INITIAL))
// return getDefaultCursor();
// return super.calculateCursor();
if (isInState(STATE_INITIAL)) {
if (getCurrentCommand() != null)
return getDefaultCursor();
}
return super.calculateCursor();
}

That's why I wondered, what's about the state in my previous message.

Best regards, Marion

"Randy Hudson" <none@us.ibm.com> wrote in message
news:csm2de$h11$1@www.eclipse.org...
> For connection creation, the original command from the source node is
passed
> to the target node for completion. Therefore, the original connection is
> not complete and probably can't execute. So the connection tool does not
> call canExecute() to determine cursor.
>
> The target should return NULL as the command for the request. Or, better
> yet, the target should not get targeted and then the target will *be*
null,
> which should also show the NOT cursor.
>
> "Marion Schmid" <marion.schmid@sap.com> wrote in message
> news:csl691$mqt$1@www.eclipse.org...
> > Hello community,
> >
> > are there any problems known concerning the cursor change from default
> > cursor to the disabled cursor with the CreationTool?
> > For some reason, in our examples, when dragging a child element onto a
> > forbidden parent container in the viewer,
> > the cursor remains as default cursor. With other tools (dragging
> > connection,
> > moving edit parts somewhere they should not be moved to) the disabled
> > cursor
> > works. The reason is not in
> >
> > AbstractTool#calculateCursor() {
> > if (command == null || !command.canExecute())
> > return getDisabledCursor();
> >
> > that is, actually, the disabledCursor is returned, but as is null, the
> > default cursor is returned.
> >
> > I debugged a bit more and found out that in
> > CreationTool#refreshCursor() ->
> > calculateCursor(), for the CreationTool the state is always
STATE_INITIAL,
> > so I thought here's the problem ?
> >
> > In this method (AbstractTool) there's some debug possibility, but how do
I
> > enable this?
> >
> > protected void setState(int state) {
> > this.state = state;
> > if (GEF.DebugToolStates)
> > GEF.debug("STATE CHANGE:\t" + getDebugName() + //$NON-NLS-1$
> > ":\t" + getDebugNameForState(this.state) + //$NON-NLS-1$
> > " <" + state + '>'); //$NON-NLS-1$
> > }
> >
> > Thanks in advance if someone can help
> > and best regards,
> >
> > Marion
> >
> >
> >
> >
>
>
Re: Problems with CreationTool and disabled cursor [message #164739 is a reply to message #164731] Thu, 20 January 2005 14:55 Go to previous message
Marion Schmid is currently offline Marion SchmidFriend
Messages: 35
Registered: July 2009
Member
Hello again,
I took a look at the current code of gef.tools.CreationTool in the CVS and
org.eclipse.gef.source_3.1.0 which I did not yet use productively,
and saw, that the problem I found seemed to be fixed.

Sorry, I did not find this bug report yesterday.

Best regards, Marion

/**
* @see org.eclipse.gef.tools.AbstractTool#calculateCursor()
*/
protected Cursor calculateCursor() {
/*
* Fix for Bug# 66010
* The following two lines of code were added for the case where a tool is
* activated via the keyboard (that code hasn't been released yet).
However, they
* were causing a problem as described in 66010. Since the keyboard
activation code
* is not being released for 3.0, the following lines are being commented
out.
*/
// if (isInState(STATE_INITIAL))
// return getDefaultCursor();
return super.calculateCursor();
}


"Marion Schmid" <marion.schmid@sap.com> wrote in message
news:csog4p$mi8$1@www.eclipse.org...
> Hello Randy,
> maybe there's a little misunderstanding, I meant that I have problems with
> the creation of new objects in the viewer, i.e. selecting the kind of
> object to be created in my palette and hovering my mouse over potential
> parent (container) elements in the viewer.
>
> The cursor when dragging a connection, i.e. ConnectionCreationTool works
> fine for us.
> But with your hint, I took as well a look at the
> AbstractConnectionTool#calculateCursor(), and as it's different to
> CreationTool#calculateCursor() (where I debugged) I tried the coding
> AbstractConnectionTool#calculateCursor() in the CreationTool source - and
> partly succeeded (=>for most creations, the disabled cursor appears
> correctly:-)
>
> _the commented lines are the original lines in CreationTool___
>
> protected Cursor calculateCursor() {
> // if (isInState(STATE_INITIAL))
> // return getDefaultCursor();
> // return super.calculateCursor();
> if (isInState(STATE_INITIAL)) {
> if (getCurrentCommand() != null)
> return getDefaultCursor();
> }
> return super.calculateCursor();
> }
>
> That's why I wondered, what's about the state in my previous message.
>
> Best regards, Marion
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:csm2de$h11$1@www.eclipse.org...
> > For connection creation, the original command from the source node is
> passed
> > to the target node for completion. Therefore, the original connection
is
> > not complete and probably can't execute. So the connection tool does
not
> > call canExecute() to determine cursor.
> >
> > The target should return NULL as the command for the request. Or,
better
> > yet, the target should not get targeted and then the target will *be*
> null,
> > which should also show the NOT cursor.
> >
> > "Marion Schmid" <marion.schmid@sap.com> wrote in message
> > news:csl691$mqt$1@www.eclipse.org...
> > > Hello community,
> > >
> > > are there any problems known concerning the cursor change from default
> > > cursor to the disabled cursor with the CreationTool?
> > > For some reason, in our examples, when dragging a child element onto a
> > > forbidden parent container in the viewer,
> > > the cursor remains as default cursor. With other tools (dragging
> > > connection,
> > > moving edit parts somewhere they should not be moved to) the disabled
> > > cursor
> > > works. The reason is not in
> > >
> > > AbstractTool#calculateCursor() {
> > > if (command == null || !command.canExecute())
> > > return getDisabledCursor();
> > >
> > > that is, actually, the disabledCursor is returned, but as is null, the
> > > default cursor is returned.
> > >
> > > I debugged a bit more and found out that in
> > > CreationTool#refreshCursor() ->
> > > calculateCursor(), for the CreationTool the state is always
> STATE_INITIAL,
> > > so I thought here's the problem ?
> > >
> > > In this method (AbstractTool) there's some debug possibility, but how
do
> I
> > > enable this?
> > >
> > > protected void setState(int state) {
> > > this.state = state;
> > > if (GEF.DebugToolStates)
> > > GEF.debug("STATE CHANGE:\t" + getDebugName() + //$NON-NLS-1$
> > > ":\t" + getDebugNameForState(this.state) + //$NON-NLS-1$
> > > " <" + state + '>'); //$NON-NLS-1$
> > > }
> > >
> > > Thanks in advance if someone can help
> > > and best regards,
> > >
> > > Marion
> > >
> > >
> > >
> > >
> >
> >
>
>
Previous Topic:feasiblility study about automated generating GEF-based Editor?
Next Topic:Multiple content panes possible??
Goto Forum:
  


Current Time: Tue Apr 23 14:37:44 GMT 2024

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

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

Back to the top