Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [JFace] Long-running operations in a Wizard
[JFace] Long-running operations in a Wizard [message #328678] Mon, 02 June 2008 06:34 Go to next message
Karsten Stöckmann is currently offline Karsten StöckmannFriend
Messages: 12
Registered: July 2009
Junior Member
Hi,

currently, I am trying to work out some kind of 'best practise' of how
to solve the following problem:

I am using a wizard-based approach to authenticate the user with a web
service. This wizard has a page where the user is prompted to enter his
user name (login name) to that web service; when finished, the wizard
uses this information to create a session ID for further processing.

The wizard page decides whether it is "finished" by a listener to the
text input field where the user enters his login data, such as this:

....
textUserName.addListener(SWT.Modify, new Listener() {
public void handleEvent(Event e) {
setPageComplete(!textUserName.getText().isEmpty());
}
});
....

When the user clicks the 'Next >' button, the page should start the
(long-running) operation (= create a session ID; wrapped in an
IRunnableWithProgress) and wait until it has finished; page flipping
then should depend on the operation's result. Now, where would be the
correct place to implement this?

Currently, I've solved this by overriding WizardDialog.nextPressed(),
but I'd prefer moving the code of the long-running operation into the
wizard page, if that is possible. Is there any kind of best practise of
how to implement this?

Best wishes,
Karsten

--
PGP Public Key ID 0x708CD1FE (pgpkeys.pca.dfn.de)
"When the light of day is dead, the spark of night ignites"
Re: [JFace] Long-running operations in a Wizard [message #328679 is a reply to message #328678] Mon, 02 June 2008 06:56 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
I don't see any issues in running a long running operation in the
nextPressed() method.

You can run your long running operation thru getContainer().run()
method. This will automatically disable all the UI components in the
current page and enable them after the operation is over. If you have
called the setNeedsProgressMonitor(true), the wizard will display a
progress bar as well :-)


--

- Prakash

Eclipse Tips: http://blog.cypal-solutions.com
Eclipse Search: http://www.cypal.in/eclipsesearch


Karsten Stöckmann wrote:
> Hi,
>
> currently, I am trying to work out some kind of 'best practise' of how
> to solve the following problem:
>
> I am using a wizard-based approach to authenticate the user with a web
> service. This wizard has a page where the user is prompted to enter his
> user name (login name) to that web service; when finished, the wizard
> uses this information to create a session ID for further processing.
>
> The wizard page decides whether it is "finished" by a listener to the
> text input field where the user enters his login data, such as this:
>
> ....
> textUserName.addListener(SWT.Modify, new Listener() {
> public void handleEvent(Event e) {
> setPageComplete(!textUserName.getText().isEmpty());
> }
> });
> ....
>
> When the user clicks the 'Next >' button, the page should start the
> (long-running) operation (= create a session ID; wrapped in an
> IRunnableWithProgress) and wait until it has finished; page flipping
> then should depend on the operation's result. Now, where would be the
> correct place to implement this?
>
> Currently, I've solved this by overriding WizardDialog.nextPressed(),
> but I'd prefer moving the code of the long-running operation into the
> wizard page, if that is possible. Is there any kind of best practise of
> how to implement this?
>
> Best wishes,
> Karsten
>
Re: [JFace] Long-running operations in a Wizard [message #328961 is a reply to message #328679] Mon, 09 June 2008 12:56 Go to previous message
Karsten Stöckmann is currently offline Karsten StöckmannFriend
Messages: 12
Registered: July 2009
Junior Member
Prakash G.R. wrote:

> I don't see any issues in running a long running operation in the
> nextPressed() method.

Thank you very much for pointing that out. :)


> You can run your long running operation thru getContainer().run()
> method. This will automatically disable all the UI components in the
> current page and enable them after the operation is over. If you have
> called the setNeedsProgressMonitor(true), the wizard will display a
> progress bar as well :-)

Yes, I was aware of that. Simple and straightforward. :)

Best wishes,
Karsten

--
PGP Public Key ID 0x708CD1FE (pgpkeys.pca.dfn.de)
"When the light of day is dead, the spark of night ignites"
Previous Topic:Large Icons / Skins
Next Topic:Eclipse Plug-in Workbench & GUI design
Goto Forum:
  


Current Time: Thu Dec 26 11:17:07 GMT 2024

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

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

Back to the top