Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » blockOnOpen = false for Wizards(block on open can't be deactivated)
blockOnOpen = false for Wizards [message #491181] Tue, 13 October 2009 14:54 Go to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: October 2009
Junior Member
Hey everybody,
i'm new to developing with the eclipse api and just created a wizard, which should be modal or blockOnOpen should be set to false.

Im opening the wizard with this command / handler:

public Object execute(final ExecutionEvent event) throws ExecutionException {
		RecoveryWizard wizard = new RecoveryWizard();

[...]

		WizardDialog wizardDialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
			wizard);
		wizardDialog.setBlockOnOpen(false);
		wizardDialog.create();
		wizardDialog.open();

		return null;
	}


but somehow the wizard blocks eclipse (i can't change sth in the background).

I'm using eclipse galileo.

Thanks for your help,
Henning
Re: blockOnOpen = false for Wizards [message #491285 is a reply to message #491181] Wed, 14 October 2009 00:21 Go to previous messageGo to next message
Remy Suen is currently offline Remy SuenFriend
Messages: 462
Registered: July 2009
Senior Member
On Tue, 13 Oct 2009 10:54:57 -0400, h.femmer wrote:
> but somehow the wizard blocks eclipse (i can't change sth in the
> background).

Invoking Wizard's setBlockOnOpen(boolean) method has nothing to do with
whether the opened window will be modal or not.

According to the javadocs...

true if the open not return until the window closes, and false if the
open method should return immediately

....so as you can see, this is a matter of whether open() method returns
immediately or not (i.e. whether the thread is "stalled" or not). The
modality of a dialog/window is determined by its shell's style bits.

Remy
Re: blockOnOpen = false for Wizards [message #491332 is a reply to message #491181] Wed, 14 October 2009 07:51 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: October 2009
Junior Member
So, is there a solution for opening a wizard modaly?
Re: blockOnOpen = false for Wizards [message #491338 is a reply to message #491332] Wed, 14 October 2009 08:20 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Sure there is but you need to subclass WizardDialog and in the
constructor call setShellStyle(SWT.SHELL_TRIM|SWT.APPLICATION_MODAL).

Tom

h.femmer@web.de schrieb:
> So, is there a solution for opening a wizard modaly?
Re: blockOnOpen = false for Wizards [message #491387 is a reply to message #491181] Wed, 14 October 2009 12:24 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: October 2009
Junior Member
Hm, the constructor of WizardDialog already sets the application.modal flag:

public WizardDialog(Shell parentShell, IWizard newWizard) {
		super(parentShell);
		setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
				| SWT.APPLICATION_MODAL | SWT.RESIZE | getDefaultOrientation());
		setWizard(newWizard);
		// since VAJava can't initialize an instance var with an anonymous
		// class outside a constructor we do it here:
		cancelListener = new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				cancelPressed();
			}
		};
	}


also subclassing did not do the trick:
	private class ModalWizardDialog extends WizardDialog {

		public ModalWizardDialog(Shell parentShell, IWizard newWizard) {
			super(parentShell, newWizard);

			setShellStyle(SWT.SHELL_TRIM | SWT.APPLICATION_MODAL);
		}

	}
Re: blockOnOpen = false for Wizards [message #491398 is a reply to message #491387] Wed, 14 October 2009 12:35 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
so you want it none modal? Then remove SWT.APPLICATION_MODAL and the
Shell doesn't block anything any more.

Tom

h.femmer@web.de schrieb:
> Hm, the constructor of WizardDialog already sets the application.modal
> flag:
>
> public WizardDialog(Shell parentShell, IWizard newWizard) {
> super(parentShell);
> setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
> | SWT.APPLICATION_MODAL | SWT.RESIZE |
> getDefaultOrientation());
> setWizard(newWizard);
> // since VAJava can't initialize an instance var with an anonymous
> // class outside a constructor we do it here:
> cancelListener = new SelectionAdapter() {
> public void widgetSelected(SelectionEvent e) {
> cancelPressed();
> }
> };
> }
>
> also subclassing did not do the trick:
> private class ModalWizardDialog extends WizardDialog {
>
> public ModalWizardDialog(Shell parentShell, IWizard newWizard) {
> super(parentShell, newWizard);
>
> setShellStyle(SWT.SHELL_TRIM | SWT.APPLICATION_MODAL);
> }
>
> }
Re: blockOnOpen = false for Wizards [message #491407 is a reply to message #491181] Wed, 14 October 2009 13:11 Go to previous message
No real name is currently offline No real nameFriend
Messages: 4
Registered: October 2009
Junior Member
Oh, i'm sorry, how stupid.

Thanks a lot for your help!

[CLOSE]

[Updated on: Wed, 14 October 2009 13:12]

Report message to a moderator

Previous Topic:Eclipse Plugin and URLClassLoader
Next Topic:Having two distinct editors in one window
Goto Forum:
  


Current Time: Fri Mar 29 10:36:01 GMT 2024

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

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

Back to the top