[JFace] Long-running operations in a Wizard [message #328678] |
Mon, 02 June 2008 06:34 |
Karsten Stöckmann 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 |
Prakash G.R. 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
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03375 seconds