Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Question on CreationFactory.getNewObject()
Question on CreationFactory.getNewObject() [message #196062] Thu, 15 September 2005 22:28 Go to next message
Brahmanandam Somanchi is currently offline Brahmanandam SomanchiFriend
Messages: 11
Registered: July 2009
Junior Member
Hi,

I have implemeting a graphical editor with palette for
managing/customizing the datamodel. I have a wizard that takes the
necessary inputs and creates new classes in the model. I would like to
hookup this wizard with the one of the tool palette that creates classes.

I hooked up launching of wizard and creating the new class in
MyCreationFactory.getNewObject(). This works fine if I drag and drop it
from the palette.

If I click on the class tool and hover on the editor, the
MyCreationFactory.getNewObject() gets triggered and the wizard comes up.
The problem here is, the wizard pops up even before selecting the drop
location. How to I get rid of this problem.

The stack sequence is:
-------------------------
ClassCreationFactory.getNewObject()
CreateRequest.getNewObject()
MyXYLayoutEditPolicy.getCreateCommand(CreateRequest)
MyXYLayoutEditPolicy(LayoutEditPolicy).getCommand(Request)
MyXYLayoutEditPolicy(ConstrainedLayoutEditPolicy).getCommand (Request)
MyDiagramEditPart(AbstractEditPart).getCommand(Request)
CreationTool(TargetingTool).getCommand()
CreationTool.handleMove()
CreationTool(AbstractTool).mouseMove(MouseEvent, EditPartViewer)


Is there a better way to handle my requirement?
Re: Question on CreationFactory.getNewObject() [message #196070 is a reply to message #196062] Thu, 15 September 2005 22:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You'd have to avoid asking for the object since it isn't available until the
wizard has been invoked.
You could have the tool invoke the wizard, and have getNewObject return null
until the wizard has been completed.
Or, your command could keep a reference to the request until it is executed,
at which point it asks for the new object and stops referencing the request.

"Brahma Somanchi" <somanchi@ugs.com> wrote in message
news:3982edb1a18dfe1718d27928644c592b$1@www.eclipse.org...
> Hi,
>
> I have implemeting a graphical editor with palette for
> managing/customizing the datamodel. I have a wizard that takes the
> necessary inputs and creates new classes in the model. I would like to
> hookup this wizard with the one of the tool palette that creates classes.
> I hooked up launching of wizard and creating the new class in
> MyCreationFactory.getNewObject(). This works fine if I drag and drop it
> from the palette.
>
> If I click on the class tool and hover on the editor, the
> MyCreationFactory.getNewObject() gets triggered and the wizard comes up.
> The problem here is, the wizard pops up even before selecting the drop
> location. How to I get rid of this problem.
>
> The stack sequence is:
> -------------------------
> ClassCreationFactory.getNewObject() CreateRequest.getNewObject()
> MyXYLayoutEditPolicy.getCreateCommand(CreateRequest)
> MyXYLayoutEditPolicy(LayoutEditPolicy).getCommand(Request)
> MyXYLayoutEditPolicy(ConstrainedLayoutEditPolicy).getCommand (Request)
> MyDiagramEditPart(AbstractEditPart).getCommand(Request)
> CreationTool(TargetingTool).getCommand()
> CreationTool.handleMove() CreationTool(AbstractTool).mouseMove(MouseEvent,
> EditPartViewer)
>
> Is there a better way to handle my requirement?
>
>
>
Re: Question on CreationFactory.getNewObject() [message #196102 is a reply to message #196062] Fri, 16 September 2005 10:44 Go to previous messageGo to next message
Andreas Holtz is currently offline Andreas HoltzFriend
Messages: 53
Registered: July 2009
Member
Brahma Somanchi schrieb am 16.09.2005 00:28:
> Hi,
> How to I get rid of this problem.

Search for a diskussion "Show a wizard during creation".
I think this could give you some hints for solving your problem.

Andreas
Re: Question on CreationFactory.getNewObject() [message #196396 is a reply to message #196070] Mon, 19 September 2005 14:49 Go to previous messageGo to next message
Brahmanandam Somanchi is currently offline Brahmanandam SomanchiFriend
Messages: 11
Registered: July 2009
Junior Member
Thanks Randy. I am able to get rid of my problem by saving the Reference
of 'Request' object in the command.
Re: Question on CreationFactory.getNewObject() [message #226467 is a reply to message #196070] Mon, 13 November 2006 22:38 Go to previous message
Eclipse UserFriend
Originally posted by: blunk.informatik.hu-berlin.de

Hello,

I have a similar problem. The difference is that I am using getNewObject
inside a getConnectionCreateCommand. The problem is that when the
creation of the connection completes, getConnectionCreateCommand is
called again (because the mouse pointer is still above the ending object
of the connection). This results in a new model object being created
although it may not be needed. The created model object stays inside my
model repository, alone, without any references to other model objects.

Your advice does not work here because if I execute getNewObject inside
the command then no connection editpart will be created before the
command is executed making it impossible two connect the objects.

I think the only solution is to throw the created model object away at
some point. But where is that?

Thanks,
Andreas

Randy Hudson schrieb:
> You'd have to avoid asking for the object since it isn't available until the
> wizard has been invoked.
> You could have the tool invoke the wizard, and have getNewObject return null
> until the wizard has been completed.
> Or, your command could keep a reference to the request until it is executed,
> at which point it asks for the new object and stops referencing the request.
>
Previous Topic:Scrollpane is not scrolling when polygon is added
Next Topic:Label Decorators in Outline View
Goto Forum:
  


Current Time: Thu Apr 25 15:14:39 GMT 2024

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

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

Back to the top