Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Complex Command tip needed
Complex Command tip needed [message #167207] Sun, 06 February 2005 22:10 Go to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

I have a Command that is pretty complex and requires some user
interaction. But I don't ask the user anything unless the action is
actually being executed. Then I need to ask a bunch of questions.

What I will end up with is a specific way to carryout the command, sort
of one step at a time while the user gives input. But I want it
undo/redo in one step.

Any idea on how to take all this user one step at a time interaction and
create someting that can be undone and redone in one step? Sub commands
seems like the perfect thing.

perhaps I can just construct a complex command from within my command,
and have my new inner command never actually get on the command stack
but live totally within my main Command?



tips appreciated.


Thanks,

CL
Re: Complex Command tip needed [message #167289 is a reply to message #167207] Mon, 07 February 2005 06:28 Go to previous message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
news:cu64jv$19l$1@www.eclipse.org...
> I have a Command that is pretty complex and requires some user
> interaction. But I don't ask the user anything unless the action is
> actually being executed. Then I need to ask a bunch of questions.

This has come up on this newsgroup before, and I believe the recommended way
is to just launch your dialog/wizard in the command's execute method.
Personally, I don't think commands should be UI-dependent. So, an
alternative is to override the tool's handling and have it launch the
dialog/wizard to get more information at the appropriate time. It would
then populate the request with this information and forward it as usual.
This approach, however, has the drawback that you if you have an action on a
menu or toolbar that does the same thing, it would have to copy the code
that launches and handles the dialog/wizard.

Another option is to use the EditPart's performRequest(). This won't have
the above-mentioned drawback. This would mean that the request would not be
forwarded to the EditPart until it's ready to be executed. The EditPart can
then launch the dialog/wizard. In essence, it would work something like the
open request. However, based on what you've mentioned so far, it seems you
can't do that.

>
> What I will end up with is a specific way to carryout the command, sort
> of one step at a time while the user gives input. But I want it
> undo/redo in one step.

Can't you just execute all information and execute at once? If you must
execute it one step at a time, maybe you can write a custom CompoundCommand.
The command can launch the dialog that will collect the necessary
information from the user in its execute method and then can trigger other
commands (providing them with the necessary information that the user
entered).

>
> Any idea on how to take all this user one step at a time interaction and
> create someting that can be undone and redone in one step? Sub commands
> seems like the perfect thing.
>
> perhaps I can just construct a complex command from within my command,
> and have my new inner command never actually get on the command stack
> but live totally within my main Command?
>
>
>
> tips appreciated.
>
>
> Thanks,
>
> CL
Previous Topic:Serialization error
Next Topic:why getHeight() returns top+bottom in class Insets?
Goto Forum:
  


Current Time: Sat Aug 17 17:43:47 GMT 2024

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

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

Back to the top