Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How does a CreationTool actually work?
How does a CreationTool actually work? [message #140537] Tue, 29 June 2004 04:22 Go to next message
Eclipse UserFriend
Originally posted by: RichardSpackmann.mafd.org

All,

I've been playing with a creation tool for quite some time (as I have found
with GEF) the lack of documentation is hindering my process.

I am creating a "drawing pad" application (squares, circles, etc.) and I'm
trying to be able to create new shapes on the canvas. I am not using a
palette and I am trying to create my own EllipseCreationTool (extends
CreationTool and creates ellipses).

I worked through the examples found on the eclipse-wiki site, but as a few
other posts pointed out, they do not do creations. My question is just how
exactly does the EditPart creation process work - specifically with the
CreateCommands and CreateRequests?

I'll walk through the various classes that I have and methods as I believe
they are being called, and that will help illustrate my confusion.

1) I have a EllipseCreationToolFactory class whose getNewObject method
returns a "EllipseShapeModel", which is my custom class modeling an ellipse
shape.
2) clicking and releasing the left mouse button invokes the "handleButtonUp"
method on my EllipseCreationTool
3) the handleButtonUp ultimately invokes the performCreation method which
executes the current command- which at this point is null, which is what I'm
not understanding.
4) the getCreateCommand in the top edit part creates a
CreateEllipseShapeCommand which is a custom class that I created
5) the CreateEllipseShapeCommand maintains two important references: a
reference to the parent model and the CreateRequest.
6) I have a CreateEllipseShapeCommand that in the execute method takes the
EllipseShapeModel returned by the getNewObject method in the CreateRequest
reference and adds that model to parent model - thus completing the "create
operation" (I think).
7) The new edit part will be added via the "refreshChildren" method - if I
read the other posts correctly.

So I guess I dont' necessarily see how the new command is going to get
passed to the tool, or specifically, how the command is created and executed
simply by clicking on the mouse button - via the CreateEllipseTool.

Thank you very much for helping sort this process out.

Regards,

Richard Spackmann
Re: How does a CreationTool actually work? [message #140656 is a reply to message #140537] Tue, 29 June 2004 15:21 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
The one step you are missing is handleMove() in the creation tool. The
command is created and cached at that point. The command and cursor are
always kept up-to-date based on the mouse location.

"Richard Spackmann" <RichardSpackmann@mafd.org> wrote in message
news:cbqqph$cb1$1@eclipse.org...
> All,
>
> I've been playing with a creation tool for quite some time (as I have
found
> with GEF) the lack of documentation is hindering my process.
>
> I am creating a "drawing pad" application (squares, circles, etc.) and I'm
> trying to be able to create new shapes on the canvas. I am not using a
> palette and I am trying to create my own EllipseCreationTool (extends
> CreationTool and creates ellipses).
>
> I worked through the examples found on the eclipse-wiki site, but as a few
> other posts pointed out, they do not do creations. My question is just how
> exactly does the EditPart creation process work - specifically with the
> CreateCommands and CreateRequests?
>
> I'll walk through the various classes that I have and methods as I believe
> they are being called, and that will help illustrate my confusion.
>
> 1) I have a EllipseCreationToolFactory class whose getNewObject method
> returns a "EllipseShapeModel", which is my custom class modeling an
ellipse
> shape.
> 2) clicking and releasing the left mouse button invokes the
"handleButtonUp"
> method on my EllipseCreationTool
> 3) the handleButtonUp ultimately invokes the performCreation method which
> executes the current command- which at this point is null, which is what
I'm
> not understanding.
> 4) the getCreateCommand in the top edit part creates a
> CreateEllipseShapeCommand which is a custom class that I created
> 5) the CreateEllipseShapeCommand maintains two important references: a
> reference to the parent model and the CreateRequest.
> 6) I have a CreateEllipseShapeCommand that in the execute method takes the
> EllipseShapeModel returned by the getNewObject method in the CreateRequest
> reference and adds that model to parent model - thus completing the
"create
> operation" (I think).
> 7) The new edit part will be added via the "refreshChildren" method - if I
> read the other posts correctly.
>
> So I guess I dont' necessarily see how the new command is going to get
> passed to the tool, or specifically, how the command is created and
executed
> simply by clicking on the mouse button - via the CreateEllipseTool.
>
> Thank you very much for helping sort this process out.
>
> Regards,
>
> Richard Spackmann
>
>
Re: How does a CreationTool actually work? [message #140740 is a reply to message #140656] Tue, 29 June 2004 19:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: webmaster.mafd.org

Thank you Pratik, I'll try this out tonight.

Was I correct in understanding the "flow" of the command creation, that is,
that the creation of the command will come from the EllipseShape's edit
policy's getCreateCommand method - which is called through the handleMove
method??

Richard

"Pratik Shah" <ppshah@us.ibm.com> wrote in message
news:cbs1br$8ft$1@eclipse.org...
> The one step you are missing is handleMove() in the creation tool. The
> command is created and cached at that point. The command and cursor are
> always kept up-to-date based on the mouse location.
>
> "Richard Spackmann" <RichardSpackmann@mafd.org> wrote in message
> news:cbqqph$cb1$1@eclipse.org...
> > All,
> >
> > I've been playing with a creation tool for quite some time (as I have
> found
> > with GEF) the lack of documentation is hindering my process.
> >
> > I am creating a "drawing pad" application (squares, circles, etc.) and
I'm
> > trying to be able to create new shapes on the canvas. I am not using a
> > palette and I am trying to create my own EllipseCreationTool (extends
> > CreationTool and creates ellipses).
> >
> > I worked through the examples found on the eclipse-wiki site, but as a
few
> > other posts pointed out, they do not do creations. My question is just
how
> > exactly does the EditPart creation process work - specifically with the
> > CreateCommands and CreateRequests?
> >
> > I'll walk through the various classes that I have and methods as I
believe
> > they are being called, and that will help illustrate my confusion.
> >
> > 1) I have a EllipseCreationToolFactory class whose getNewObject method
> > returns a "EllipseShapeModel", which is my custom class modeling an
> ellipse
> > shape.
> > 2) clicking and releasing the left mouse button invokes the
> "handleButtonUp"
> > method on my EllipseCreationTool
> > 3) the handleButtonUp ultimately invokes the performCreation method
which
> > executes the current command- which at this point is null, which is what
> I'm
> > not understanding.
> > 4) the getCreateCommand in the top edit part creates a
> > CreateEllipseShapeCommand which is a custom class that I created
> > 5) the CreateEllipseShapeCommand maintains two important references: a
> > reference to the parent model and the CreateRequest.
> > 6) I have a CreateEllipseShapeCommand that in the execute method takes
the
> > EllipseShapeModel returned by the getNewObject method in the
CreateRequest
> > reference and adds that model to parent model - thus completing the
> "create
> > operation" (I think).
> > 7) The new edit part will be added via the "refreshChildren" method - if
I
> > read the other posts correctly.
> >
> > So I guess I dont' necessarily see how the new command is going to get
> > passed to the tool, or specifically, how the command is created and
> executed
> > simply by clicking on the mouse button - via the CreateEllipseTool.
> >
> > Thank you very much for helping sort this process out.
> >
> > Regards,
> >
> > Richard Spackmann
> >
> >
>
>
Re: How does a CreationTool actually work? [message #140747 is a reply to message #140740] Tue, 29 June 2004 20:57 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Yes. The CreationTool passes the factory to the request and it is the
request that invokes the creation of the new object. Upon mouseMove, the
CreationTool fetches the command (by invoking getCommand() on the target
EditPart, which delegates that task to its editpolicies) and updates the
cursor based on whether or not the command can be executed. On mouseDown,
the target editpart is locked and dragging is tracked. On mouseUp, the
command is executed.

"Richard Spackmann" <webmaster@mafd.org> wrote in message
news:cbsf91$8d1$1@eclipse.org...
> Thank you Pratik, I'll try this out tonight.
>
> Was I correct in understanding the "flow" of the command creation, that
is,
> that the creation of the command will come from the EllipseShape's edit
> policy's getCreateCommand method - which is called through the handleMove
> method??
>
> Richard
>
> "Pratik Shah" <ppshah@us.ibm.com> wrote in message
> news:cbs1br$8ft$1@eclipse.org...
> > The one step you are missing is handleMove() in the creation tool. The
> > command is created and cached at that point. The command and cursor are
> > always kept up-to-date based on the mouse location.
> >
> > "Richard Spackmann" <RichardSpackmann@mafd.org> wrote in message
> > news:cbqqph$cb1$1@eclipse.org...
> > > All,
> > >
> > > I've been playing with a creation tool for quite some time (as I have
> > found
> > > with GEF) the lack of documentation is hindering my process.
> > >
> > > I am creating a "drawing pad" application (squares, circles, etc.) and
> I'm
> > > trying to be able to create new shapes on the canvas. I am not using a
> > > palette and I am trying to create my own EllipseCreationTool (extends
> > > CreationTool and creates ellipses).
> > >
> > > I worked through the examples found on the eclipse-wiki site, but as a
> few
> > > other posts pointed out, they do not do creations. My question is just
> how
> > > exactly does the EditPart creation process work - specifically with
the
> > > CreateCommands and CreateRequests?
> > >
> > > I'll walk through the various classes that I have and methods as I
> believe
> > > they are being called, and that will help illustrate my confusion.
> > >
> > > 1) I have a EllipseCreationToolFactory class whose getNewObject method
> > > returns a "EllipseShapeModel", which is my custom class modeling an
> > ellipse
> > > shape.
> > > 2) clicking and releasing the left mouse button invokes the
> > "handleButtonUp"
> > > method on my EllipseCreationTool
> > > 3) the handleButtonUp ultimately invokes the performCreation method
> which
> > > executes the current command- which at this point is null, which is
what
> > I'm
> > > not understanding.
> > > 4) the getCreateCommand in the top edit part creates a
> > > CreateEllipseShapeCommand which is a custom class that I created
> > > 5) the CreateEllipseShapeCommand maintains two important references: a
> > > reference to the parent model and the CreateRequest.
> > > 6) I have a CreateEllipseShapeCommand that in the execute method takes
> the
> > > EllipseShapeModel returned by the getNewObject method in the
> CreateRequest
> > > reference and adds that model to parent model - thus completing the
> > "create
> > > operation" (I think).
> > > 7) The new edit part will be added via the "refreshChildren" method -
if
> I
> > > read the other posts correctly.
> > >
> > > So I guess I dont' necessarily see how the new command is going to get
> > > passed to the tool, or specifically, how the command is created and
> > executed
> > > simply by clicking on the mouse button - via the CreateEllipseTool.
> > >
> > > Thank you very much for helping sort this process out.
> > >
> > > Regards,
> > >
> > > Richard Spackmann
> > >
> > >
> >
> >
>
>
Re: How does a CreationTool actually work? [message #140766 is a reply to message #140747] Tue, 29 June 2004 21:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: webmaster.mafd.org

Great!

I'll be trying this out tonight, and I'll post back!

Spack

"Pratik Shah" <ppshah@us.ibm.com> wrote in message
news:cbsl3i$ku4$1@eclipse.org...
> Yes. The CreationTool passes the factory to the request and it is the
> request that invokes the creation of the new object. Upon mouseMove, the
> CreationTool fetches the command (by invoking getCommand() on the target
> EditPart, which delegates that task to its editpolicies) and updates the
> cursor based on whether or not the command can be executed. On mouseDown,
> the target editpart is locked and dragging is tracked. On mouseUp, the
> command is executed.
>
> "Richard Spackmann" <webmaster@mafd.org> wrote in message
> news:cbsf91$8d1$1@eclipse.org...
> > Thank you Pratik, I'll try this out tonight.
> >
> > Was I correct in understanding the "flow" of the command creation, that
> is,
> > that the creation of the command will come from the EllipseShape's edit
> > policy's getCreateCommand method - which is called through the
handleMove
> > method??
> >
> > Richard
> >
> > "Pratik Shah" <ppshah@us.ibm.com> wrote in message
> > news:cbs1br$8ft$1@eclipse.org...
> > > The one step you are missing is handleMove() in the creation tool.
The
> > > command is created and cached at that point. The command and cursor
are
> > > always kept up-to-date based on the mouse location.
> > >
> > > "Richard Spackmann" <RichardSpackmann@mafd.org> wrote in message
> > > news:cbqqph$cb1$1@eclipse.org...
> > > > All,
> > > >
> > > > I've been playing with a creation tool for quite some time (as I
have
> > > found
> > > > with GEF) the lack of documentation is hindering my process.
> > > >
> > > > I am creating a "drawing pad" application (squares, circles, etc.)
and
> > I'm
> > > > trying to be able to create new shapes on the canvas. I am not using
a
> > > > palette and I am trying to create my own EllipseCreationTool
(extends
> > > > CreationTool and creates ellipses).
> > > >
> > > > I worked through the examples found on the eclipse-wiki site, but as
a
> > few
> > > > other posts pointed out, they do not do creations. My question is
just
> > how
> > > > exactly does the EditPart creation process work - specifically with
> the
> > > > CreateCommands and CreateRequests?
> > > >
> > > > I'll walk through the various classes that I have and methods as I
> > believe
> > > > they are being called, and that will help illustrate my confusion.
> > > >
> > > > 1) I have a EllipseCreationToolFactory class whose getNewObject
method
> > > > returns a "EllipseShapeModel", which is my custom class modeling an
> > > ellipse
> > > > shape.
> > > > 2) clicking and releasing the left mouse button invokes the
> > > "handleButtonUp"
> > > > method on my EllipseCreationTool
> > > > 3) the handleButtonUp ultimately invokes the performCreation method
> > which
> > > > executes the current command- which at this point is null, which is
> what
> > > I'm
> > > > not understanding.
> > > > 4) the getCreateCommand in the top edit part creates a
> > > > CreateEllipseShapeCommand which is a custom class that I created
> > > > 5) the CreateEllipseShapeCommand maintains two important references:
a
> > > > reference to the parent model and the CreateRequest.
> > > > 6) I have a CreateEllipseShapeCommand that in the execute method
takes
> > the
> > > > EllipseShapeModel returned by the getNewObject method in the
> > CreateRequest
> > > > reference and adds that model to parent model - thus completing the
> > > "create
> > > > operation" (I think).
> > > > 7) The new edit part will be added via the "refreshChildren"
method -
> if
> > I
> > > > read the other posts correctly.
> > > >
> > > > So I guess I dont' necessarily see how the new command is going to
get
> > > > passed to the tool, or specifically, how the command is created and
> > > executed
> > > > simply by clicking on the mouse button - via the CreateEllipseTool.
> > > >
> > > > Thank you very much for helping sort this process out.
> > > >
> > > > Regards,
> > > >
> > > > Richard Spackmann
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: How does a CreationTool actually work? [message #140852 is a reply to message #140766] Wed, 30 June 2004 02:25 Go to previous message
Eclipse UserFriend
Originally posted by: RichardSpackmann.mafd.org

That worked great, thanks again!

Spack

"Richard Spackmann" <webmaster@mafd.org> wrote in message
news:cbsmko$o0b$1@eclipse.org...
> Great!
>
> I'll be trying this out tonight, and I'll post back!
>
> Spack
>
> "Pratik Shah" <ppshah@us.ibm.com> wrote in message
> news:cbsl3i$ku4$1@eclipse.org...
> > Yes. The CreationTool passes the factory to the request and it is the
> > request that invokes the creation of the new object. Upon mouseMove,
the
> > CreationTool fetches the command (by invoking getCommand() on the target
> > EditPart, which delegates that task to its editpolicies) and updates the
> > cursor based on whether or not the command can be executed. On
mouseDown,
> > the target editpart is locked and dragging is tracked. On mouseUp, the
> > command is executed.
> >
> > "Richard Spackmann" <webmaster@mafd.org> wrote in message
> > news:cbsf91$8d1$1@eclipse.org...
> > > Thank you Pratik, I'll try this out tonight.
> > >
> > > Was I correct in understanding the "flow" of the command creation,
that
> > is,
> > > that the creation of the command will come from the EllipseShape's
edit
> > > policy's getCreateCommand method - which is called through the
> handleMove
> > > method??
> > >
> > > Richard
> > >
> > > "Pratik Shah" <ppshah@us.ibm.com> wrote in message
> > > news:cbs1br$8ft$1@eclipse.org...
> > > > The one step you are missing is handleMove() in the creation tool.
> The
> > > > command is created and cached at that point. The command and cursor
> are
> > > > always kept up-to-date based on the mouse location.
> > > >
> > > > "Richard Spackmann" <RichardSpackmann@mafd.org> wrote in message
> > > > news:cbqqph$cb1$1@eclipse.org...
> > > > > All,
> > > > >
> > > > > I've been playing with a creation tool for quite some time (as I
> have
> > > > found
> > > > > with GEF) the lack of documentation is hindering my process.
> > > > >
> > > > > I am creating a "drawing pad" application (squares, circles, etc.)
> and
> > > I'm
> > > > > trying to be able to create new shapes on the canvas. I am not
using
> a
> > > > > palette and I am trying to create my own EllipseCreationTool
> (extends
> > > > > CreationTool and creates ellipses).
> > > > >
> > > > > I worked through the examples found on the eclipse-wiki site, but
as
> a
> > > few
> > > > > other posts pointed out, they do not do creations. My question is
> just
> > > how
> > > > > exactly does the EditPart creation process work - specifically
with
> > the
> > > > > CreateCommands and CreateRequests?
> > > > >
> > > > > I'll walk through the various classes that I have and methods as I
> > > believe
> > > > > they are being called, and that will help illustrate my confusion.
> > > > >
> > > > > 1) I have a EllipseCreationToolFactory class whose getNewObject
> method
> > > > > returns a "EllipseShapeModel", which is my custom class modeling
an
> > > > ellipse
> > > > > shape.
> > > > > 2) clicking and releasing the left mouse button invokes the
> > > > "handleButtonUp"
> > > > > method on my EllipseCreationTool
> > > > > 3) the handleButtonUp ultimately invokes the performCreation
method
> > > which
> > > > > executes the current command- which at this point is null, which
is
> > what
> > > > I'm
> > > > > not understanding.
> > > > > 4) the getCreateCommand in the top edit part creates a
> > > > > CreateEllipseShapeCommand which is a custom class that I created
> > > > > 5) the CreateEllipseShapeCommand maintains two important
references:
> a
> > > > > reference to the parent model and the CreateRequest.
> > > > > 6) I have a CreateEllipseShapeCommand that in the execute method
> takes
> > > the
> > > > > EllipseShapeModel returned by the getNewObject method in the
> > > CreateRequest
> > > > > reference and adds that model to parent model - thus completing
the
> > > > "create
> > > > > operation" (I think).
> > > > > 7) The new edit part will be added via the "refreshChildren"
> method -
> > if
> > > I
> > > > > read the other posts correctly.
> > > > >
> > > > > So I guess I dont' necessarily see how the new command is going to
> get
> > > > > passed to the tool, or specifically, how the command is created
and
> > > > executed
> > > > > simply by clicking on the mouse button - via the
CreateEllipseTool.
> > > > >
> > > > > Thank you very much for helping sort this process out.
> > > > >
> > > > > Regards,
> > > > >
> > > > > Richard Spackmann
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Previous Topic:ConnectionLayer
Next Topic:No scrollbars with ScrollingGraphicalViewer
Goto Forum:
  


Current Time: Wed Sep 25 09:44:35 GMT 2024

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

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

Back to the top