Skip to main content



      Home
Home » Eclipse Projects » GEF » Weird CreationTool behaviour
Weird CreationTool behaviour [message #6840] Sun, 02 June 2002 11:04 Go to next message
Eclipse UserFriend
Hi
I'm trying to create an applicatino, that one of its editors is similar to
the logic example. i have extanded CreationTool, and for some reason i
can't get the add cursor to apear over the canvas (which is actually an
EditPart) when i select the appropriate entry from the palette. It seems
that the method mouseDrag (implemented in AbstractTool), does not get
called. any ideas what have i done wrong?
thanks
yoav
Re: Weird CreationTool behaviour [message #6891 is a reply to message #6840] Sun, 02 June 2002 14:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

The creation tool does not work using mouseDrag. You have to click on the
palette and release, then you enter a "creation mode", and the tool will
handle mouseMove.

Then, you will only get the add cursor if your canvas editpart says that it
is the target of that type of creation, *and* it returns a command that is
executable.

"Yoav Rubin" <yoav@il.ibm.com> wrote in message
news:addc68$1r9$1@rogue.oti.com...
> Hi
> I'm trying to create an applicatino, that one of its editors is similar to
> the logic example. i have extanded CreationTool, and for some reason i
> can't get the add cursor to apear over the canvas (which is actually an
> EditPart) when i select the appropriate entry from the palette. It seems
> that the method mouseDrag (implemented in AbstractTool), does not get
> called. any ideas what have i done wrong?
> thanks
> yoav
>
Re: Weird CreationTool behaviour [message #7091 is a reply to message #6891] Mon, 03 June 2002 03:08 Go to previous messageGo to next message
Eclipse UserFriend
Hi
what do you mean by saying "the editpart sais that it is the target of
this type of creation", how does the tool check this?
moreover, who is suppose to return the appropriate command, as i saw in
the logic example, the method getCommand(Request r) is not implemented in
LogicEditPart, so who is retuning the command there?
thanks
yoav
Randy Hudson wrote:

> The creation tool does not work using mouseDrag. You have to click on the
> palette and release, then you enter a "creation mode", and the tool will
> handle mouseMove.

> Then, you will only get the add cursor if your canvas editpart says that it
> is the target of that type of creation, *and* it returns a command that is
> executable.

> "Yoav Rubin" <yoav@il.ibm.com> wrote in message
> news:addc68$1r9$1@rogue.oti.com...
> > Hi
> > I'm trying to create an applicatino, that one of its editors is similar to
> > the logic example. i have extanded CreationTool, and for some reason i
> > can't get the add cursor to apear over the canvas (which is actually an
> > EditPart) when i select the appropriate entry from the palette. It seems
> > that the method mouseDrag (implemented in AbstractTool), does not get
> > called. any ideas what have i done wrong?
> > thanks
> > yoav
> >
Re: Weird CreationTool behaviour [message #7113 is a reply to message #7091] Mon, 03 June 2002 07:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

This is handled by XYLayoutEditPolicy. The diagram itself is in an
XYLayout. The implementation of dropping into this layout is separated out
into an EditPolicy, which your EditPart can then use or not use, if it
wants. If you aren't sure about why this "delegation" is a good idea, the
reasoning is in the JavaDOC overview for GEF.

XYLayoutEditPolicy knows it is the target of CREATION, MOVE, and ADD (add is
when an existing object is changing parents or containers). see
LayoutEditPolicy.getTarget(Request).

"Yoav Rubin" <yoav@il.ibm.com> wrote in message
news:adf4li$f57$1@rogue.oti.com...
> Hi
> what do you mean by saying "the editpart sais that it is the target of
> this type of creation", how does the tool check this?
> moreover, who is suppose to return the appropriate command, as i saw in
> the logic example, the method getCommand(Request r) is not implemented in
> LogicEditPart, so who is retuning the command there?
> thanks
> yoav
> Randy Hudson wrote:
>
Re: Weird CreationTool behaviour [message #7137 is a reply to message #7113] Mon, 03 June 2002 07:59 Go to previous messageGo to next message
Eclipse UserFriend
Hi
i\\\'ve extended ContainerEditPolicy, and implemented the methods
getTarget and getCommand. it seems that the method getCommand is called on
every mouseMove event, in this method i am instanciating a command, and i
would prefer that the instanciation would be when i click on the canvas,
rather on every mouse move, am i doing something wrong in this process or
is it the expected behaviour?
thanks
yoav
Randy Hudson wrote:

> This is handled by XYLayoutEditPolicy. The diagram itself is in an
> XYLayout. The implementation of dropping into this layout is separated out
> into an EditPolicy, which your EditPart can then use or not use, if it
> wants. If you aren\\\'t sure about why this \\\"delegation\\\" is a good
idea, the
> reasoning is in the JavaDOC overview for GEF.

> XYLayoutEditPolicy knows it is the target of CREATION, MOVE, and ADD (add is
> when an existing object is changing parents or containers). see
> LayoutEditPolicy.getTarget(Request).

> \\\"Yoav Rubin\\\" <yoav@il.ibm.com> wrote in message
> news:adf4li$f57$1@rogue.oti.com...
> > Hi
> > what do you mean by saying \\\"the editpart sais that it is the target of
> > this type of creation\\\", how does the tool check this?
> > moreover, who is suppose to return the appropriate command, as i saw in
> > the logic example, the method getCommand(Request r) is not implemented in
> > LogicEditPart, so who is retuning the command there?
> > thanks
> > yoav
> > Randy Hudson wrote:
> >
Re: Weird CreationTool behaviour [message #7160 is a reply to message #7137] Mon, 03 June 2002 08:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

Why extend ContainerEditPolicy? XYLayoutEditPolicy handles creating the
appropriate Rectangle where the new part is going to be placed.

ContainerEditPolicy is non-graphical, meaning it doesn't really care about
UI interaction.

> i\\\'ve extended ContainerEditPolicy, and implemented the methods
> getTarget and getCommand. it seems that the method getCommand is called on
> every mouseMove event, in this method i am instanciating a command, and i
> would prefer that the instanciation would be when i click on the canvas,
> rather on every mouse move, am i doing something wrong in this process or
> is it the expected behaviour?

This is the expected behavior. Command.canExecute() is used to determine
whether the NOT cursor should be displayed.
Re: Weird CreationTool behaviour [message #7182 is a reply to message #7160] Mon, 03 June 2002 09:44 Go to previous messageGo to next message
Eclipse UserFriend
Hi
i still can\'t find who suppose to instanciate the EditPart that will be
created due to the selection in the palette I tried to use the method
createChild(Object model) in the canvas editpart, but this method doesn\'t
get called, so who suppose to do this?

as for the getCommand method, is there a way to not have to instanciate a
new command on every mouse move, since this way of action is a bit extreme.
thanks
yoav
Randy Hudson wrote:

> Why extend ContainerEditPolicy? XYLayoutEditPolicy handles creating the
> appropriate Rectangle where the new part is going to be placed.

> ContainerEditPolicy is non-graphical, meaning it doesn\'t really care about
> UI interaction.

> > i\\\\\\\'ve extended ContainerEditPolicy, and implemented the methods
> > getTarget and getCommand. it seems that the method getCommand is called on
> > every mouseMove event, in this method i am instanciating a command, and i
> > would prefer that the instanciation would be when i click on the canvas,
> > rather on every mouse move, am i doing something wrong in this process or
> > is it the expected behaviour?

> This is the expected behavior. Command.canExecute() is used to determine
> whether the NOT cursor should be displayed.
Re: Weird CreationTool behaviour [message #7205 is a reply to message #7182] Mon, 03 June 2002 10:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

Put a breakpoint in:
com.ibm.etools.gef.examples.logicdesigner.model.CreateComman d#execute()
and step through the code.

You will see that the EditPart is a listener to the model, it calls
refreshChildren, which eventually calls createChild(Object) when it finds
the new child for which there currently is no EditPart.

"Yoav Rubin" <yoav@il.ibm.com> wrote in message
news:adfrsh$q4o$1@rogue.oti.com...
> Hi
> i still can\'t find who suppose to instanciate the EditPart that will be
> created due to the selection in the palette I tried to use the method
> createChild(Object model) in the canvas editpart, but this method doesn\'t
> get called, so who suppose to do this?
>
> as for the getCommand method, is there a way to not have to instanciate a
> new command on every mouse move, since this way of action is a bit
extreme.
> thanks
> yoav
> Randy Hudson wrote:
>
> > Why extend ContainerEditPolicy? XYLayoutEditPolicy handles creating the
> > appropriate Rectangle where the new part is going to be placed.
>
> > ContainerEditPolicy is non-graphical, meaning it doesn\'t really care
about
> > UI interaction.
>
> > > i\\\\\\\'ve extended ContainerEditPolicy, and implemented the methods
> > > getTarget and getCommand. it seems that the method getCommand is
called on
> > > every mouseMove event, in this method i am instanciating a command,
and i
> > > would prefer that the instanciation would be when i click on the
canvas,
> > > rather on every mouse move, am i doing something wrong in this
process or
> > > is it the expected behaviour?
>
> > This is the expected behavior. Command.canExecute() is used to
determine
> > whether the NOT cursor should be displayed.
>
>
>
>
>
Re: Weird CreationTool behaviour [message #9509 is a reply to message #6891] Tue, 11 June 2002 06:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: g.wagenknecht.intershop.de

Hi!

"Randy Hudson" <none@ibm.com> schrieb im Newsbeitrag
news:addn19$4i5$1@rogue.oti.com...

> Then, you will only get the add cursor if your canvas editpart says that
it
> is the target of that type of creation, *and* it returns a command that is
> executable.

How can I force the EditPart to tell that it is the target for a type
creation?

I implemented a XYLayoutPolicy, but it seems that createAddCommand never
gets called (simple debugging with System.out.println) . I use the same
XYLayoutPolicy for movement, which works fine.

I use CreationTool with my own factory implementation. Debugging shows that
at least this is working (a new EditPart is created).

Everything is implemented similar to the Logic Example but it seems I've
missed something.

Cu, Gunnar
Re: Weird CreationTool behaviour [message #9532 is a reply to message #9509] Tue, 11 June 2002 06:17 Go to previous message
Eclipse UserFriend
Originally posted by: g.wagenknecht.intershop.de

"Gunnar Wagenknecht" <g.wagenknecht@intershop.de> schrieb im Newsbeitrag
news:ae4h3p$vs5$1@rogue.oti.com...

> Everything is implemented similar to the Logic Example but it seems I've
> missed something.

Oh, seems I've mixed up createAddCommand with getCreateCommmand.

Cu, Gunnar
Previous Topic:swt widgets above the editparts
Next Topic:OK I'll start the ball rolling...
Goto Forum:
  


Current Time: Tue Mar 11 03:01:21 EDT 2025

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

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

Back to the top