Home » Eclipse Projects » GEF » Populate Wizard from a CreationTool
Populate Wizard from a CreationTool [message #245158] |
Tue, 26 August 2008 14:53 |
Eclipse User |
|
|
|
Originally posted by: andreas-scharf.gmx.de
Hi,
I've some problems with the following scenario: In my GEF editor the
user can add model objects which are saved into different resources.
What I want to achieve is: The user a tool from the palette and clicks
onto the editPart where he/she want to add the new object. Then my
standard NewWizard for that object should be displayed, the object is
build, serialized into a new resource and finally added to the editPart.
I know that I should implement my own CreationTool and override
performCreation(..). My problem is, that while the user moves the mouse
over the screen, the editParts editPolicy is asked for the
createCommand, where I normally return a CreateChildCommand which itself
needs the newChild which is normally obtained from the CreationTools's
CreationFactory...
Can u point me the way how I can do that right?
Cheers,
Andreas
|
|
|
Re: Populate Wizard from a CreationTool [message #245176 is a reply to message #245158] |
Wed, 27 August 2008 04:32 |
Eclipse User |
|
|
|
Originally posted by: lifesting.gmail.com
Andreas Scharf wrote:
> Hi,
>
> I've some problems with the following scenario: In my GEF editor the
> user can add model objects which are saved into different resources.
> What I want to achieve is: The user a tool from the palette and clicks
> onto the editPart where he/she want to add the new object. Then my
> standard NewWizard for that object should be displayed, the object is
> build, serialized into a new resource and finally added to the editPart.
>
> I know that I should implement my own CreationTool and override
> performCreation(..). My problem is, that while the user moves the mouse
> over the screen, the editParts editPolicy is asked for the
> createCommand, where I normally return a CreateChildCommand which itself
> needs the newChild which is normally obtained from the CreationTools's
> CreationFactory...
>
> Can u point me the way how I can do that right?
>
> Cheers,
> Andreas
You can write a customizable WizardCreateTool which sends a different
WizardRequest other than CreateRequest to selected EditPart that can be
processed by registered WizardEditPoilcy and produces
CreateWizardChildCommand as a result.
In CreateWizardChildCommand definition, you can open a WizardDialog and
let the user select a Wizard to follow, then create new object like
"Child c = new Child(XX,XX)" base on the info provided by Wizard.
In a short, you'd better write a Tool, a Request, an EditPolicy and a
Command for the scenario, so CreationFactory is not a problem, you can
define ALL.
|
|
|
Re: Populate Wizard from a CreationTool [message #245186 is a reply to message #245158] |
Wed, 27 August 2008 05:12 |
Eclipse User |
|
|
|
Originally posted by: shady_86.sify.com
hello there, you said,
> What I want to achieve is: The user a tool from the
> palette and clicks
> onto the editPart where he/she want to add the new
> object. Then my
> standard NewWizard for that object should be
> displayed, the object is
> build, serialized into a new resource and finally
> added to the editPart.
you mean you want to do some list of tasks when you create a new object?
for this you will need to catch the event which is being propagated when you created the new object,
you can do that in your edit policy, command, model where you fire the property change, your edit part, etc etc..,
|
|
|
Re: Populate Wizard from a CreationTool [message #245191 is a reply to message #245176] |
Wed, 27 August 2008 07:59 |
Eclipse User |
|
|
|
Originally posted by: andreas-scharf.gmx.de
David,
I now solved it by implementing my own Tool which first pops up the
dialog and only executes the command if the user clicks finish, which
works fine.
I didn't go the way to call the Wizard in a GEF Command because I read
that it can cause problems if the user cancels the dialog and the
command cannot really be canceled...
Although your idea with a new EditPolicy which handles a new Request is
fine - I only thought of using a new Request but then stuck because my
current EditPolicy (which of course acts on CreateRequests) was not
called. Don't know why I didn't think of just implementing a new
EditPolicy...
ANdreas
David BY Chan schrieb:
> Andreas Scharf wrote:
>> Hi,
>>
>> I've some problems with the following scenario: In my GEF editor the
>> user can add model objects which are saved into different resources.
>> What I want to achieve is: The user a tool from the palette and clicks
>> onto the editPart where he/she want to add the new object. Then my
>> standard NewWizard for that object should be displayed, the object is
>> build, serialized into a new resource and finally added to the editPart.
>>
>> I know that I should implement my own CreationTool and override
>> performCreation(..). My problem is, that while the user moves the mouse
>> over the screen, the editParts editPolicy is asked for the
>> createCommand, where I normally return a CreateChildCommand which
>> itself needs the newChild which is normally obtained from the
>> CreationTools's CreationFactory...
>>
>> Can u point me the way how I can do that right?
>>
>> Cheers,
>> Andreas
> You can write a customizable WizardCreateTool which sends a different
> WizardRequest other than CreateRequest to selected EditPart that can be
> processed by registered WizardEditPoilcy and produces
> CreateWizardChildCommand as a result.
>
> In CreateWizardChildCommand definition, you can open a WizardDialog and
> let the user select a Wizard to follow, then create new object like
> "Child c = new Child(XX,XX)" base on the info provided by Wizard.
>
> In a short, you'd better write a Tool, a Request, an EditPolicy and a
> Command for the scenario, so CreationFactory is not a problem, you can
> define ALL.
|
|
|
Goto Forum:
Current Time: Fri Apr 26 12:55:45 GMT 2024
Powered by FUDForum. Page generated in 0.03258 seconds
|