|
Re: Question on CreationFactory.getNewObject() [message #196070 is a reply to message #196062] |
Thu, 15 September 2005 22:42 |
Eclipse User |
|
|
|
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 #226467 is a reply to message #196070] |
Mon, 13 November 2006 22:38 |
Eclipse User |
|
|
|
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.
>
|
|
|
Powered by
FUDForum. Page generated in 0.03550 seconds