Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Shell activate order problem
Shell activate order problem [message #554980] Wed, 25 August 2010 04:56 Go to next message
Yury Mising name is currently offline Yury Mising nameFriend
Messages: 95
Registered: May 2010
Location: Russia
Member
Hi, All!

I had found some difference in shell activation process between RAP 1.2 and RAP 1.3. I will try to describe the situation that leads to the problem and hope it will be clear to understand.

We have a wizard (WizardDialog) which run IRunnableWithProgress by WizardDialog.run() by button pressing.
This runnable opens the modal dialog and log its progress to text field on this dialog.
When the runnable will be done the MessageBox will be shown.
Press OK button on the message box and get the dialog with progress that will not responds on any events (in this case on pressing OK button on this dialog to close it).

Lets look in the platform code and see what is happened there:
1. Display.setActiveShell(...)
Display has shells array that collects application shells in order by their activation (the last activated shell will be removed and placed to the end of array).
When the IRunnableWithProgress will be run it will open the dialog and set dialog shell active. Wizard progress bar that is displayed runnable progress too will activate wizard shell in WizardDialog.stopped(...) method:
	private void stopped(Object savedState) {
		if (getShell() != null && !getShell().isDisposed()) {
.................................................................................................
			Control focusControl = (Control) state.get(FOCUS_CONTROL);
			if (focusControl != null && !focusControl.isDisposed()) {
				focusControl.setFocus();
			}
		}
	}

focusControl is the button that run IRunnableWithProgress. There is the last activated shell in Display.shells is the wizard shell.

When the MessageBox will be shown (it activates its own shell - last activated shell in Display is message box shell) and after pressing OK button the message box will be closed and there is wizard shell will be set as a current active one in Display.removeShell(...).
The problem is occurred here - we try to press OK button in the our progress dialog and can't close it.
This SelectionEvent on the button is checked in SelectionEvent.allowProcessing() that return false, because final EventUtil.isShellAccessible(...) checking return false by comparison progress dialog shell with active shell that is returned by Display (we remember - it was set wizard shell).

I don't know there the problem exactly is, but find the following differences in Control class:
RAP 1.2
  private void setFocusControl( final Control control ) {
    // focus
    Object adapter = getDisplay().getAdapter( IDisplayAdapter.class );
    IDisplayAdapter displayAdapter = ( IDisplayAdapter )adapter;
    displayAdapter.setFocusControl( control );
    // active
    Shell shell = getShell();
    shell.setActiveControl( control );
  }

RAP 1.3
  private void setFocusControl( final Control control ) {
    if( control != null ) {
      display.setActiveShell( control.getShell() );
    }
    // focus
    Object adapter = getDisplay().getAdapter( IDisplayAdapter.class );
    IDisplayAdapter displayAdapter = ( IDisplayAdapter )adapter;
    displayAdapter.setFocusControl( control );
    // active
    if( control != null ) {
      Shell shell = control.getShell();
      shell.setActiveControl( control );
    }
  }

This method is invoked in WizardDialog.stopped(...). See that the control shell is activated by setFocus in RAP 1.3. If this code will be removed the problem will disappear, so I doubt in correctness of this code - we shouldn't activate control shell by setFocus method without any checks (f.e. there is modal dialog over the control shell).

Best regards,
Yury.

[Updated on: Wed, 25 August 2010 04:56]

Report message to a moderator

Re: Shell activate order problem [message #554995 is a reply to message #554980] Wed, 25 August 2010 06:43 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Yury,

thanks for the detailed explanation. Please file a bugzilla with your
findings. A snippet to reproduce the problem would be great. We will
look at the issue as soon as possible.

Best,
Ivan

On 08/25/2010 7:56 AM, Yury wrote:
> Hi, All!
>
> I had found some difference in shell activation process between RAP
> 1.2 and RAP 1.3. I will try the situation that leads to the problem
> and hope it will be clear to understand.
>
> We have a wizard (WizardDialog) which run IRunnableWithProgress by
> WizardDialog.run() by button pressing. This runnable opens the modal
> dialog and log its progress to text field on this dialog.
> When the runnable will be done the MessageBox will be shown.
> Press OK button on the message box and get the dialog with progress
> that will not responds on any events (in this case on pressing OK
> button on this dialog to close it).
>
> Lets look in the platform code and see what is happened there:
> 1. Display.setActiveShell(...)
> Display has shells array that collects application shells in order by
> their activation (the last activated shell will be removed and placed
> to the end of array).
> When the IRunnableWithProgress will be run it will open the dialog and
> set dialog shell active. Wizard progress bar that is displayed
> runnable progress too will activate wizard shell in
> WizardDialog.stopped(...) method:
>
> private void stopped(Object savedState) {
> if (getShell() != null && !getShell().isDisposed()) {
> ............................................................ ....................................
>
> Control focusControl = (Control) state.get(FOCUS_CONTROL);
> if (focusControl != null && !focusControl.isDisposed()) {
> focusControl.setFocus();
> }
> }
> }
>
> focusControl is the button that run IRunnableWithProgress. There is
> the last activated shell in Display.shells is the wizard shell.
>
> When the MessageBox will be shown (it activates its own shell - last
> activated shell in Display is message box shell) and after pressing OK
> button the message box will be closed and there is wizard shell will
> be set as a current active one in Display.removeShell(...).
> The problem is occurred here - we try to press OK button in the our
> progress dialog and can't close it.
> This SelectionEvent on the button is checked in
> SelectionEvent.allowProcessing() that return false, because final
> EventUtil.isShellAccessible(...) checking return false by comparison
> progress dialog shell with active shell that is returned by Display
> (we remember - it was set wizard shell).
>
> I don't know there the problem exactly is, but find the following
> differences in Control class:
> RAP 1.2
>
> private void setFocusControl( final Control control ) {
> // focus
> Object adapter = getDisplay().getAdapter( IDisplayAdapter.class );
> IDisplayAdapter displayAdapter = ( IDisplayAdapter )adapter;
> displayAdapter.setFocusControl( control );
> // active
> Shell shell = getShell();
> shell.setActiveControl( control );
> }
>
> RAP 1.3
>
> private void setFocusControl( final Control control ) {
> if( control != null ) {
> display.setActiveShell( control.getShell() );
> }
> // focus
> Object adapter = getDisplay().getAdapter( IDisplayAdapter.class );
> IDisplayAdapter displayAdapter = ( IDisplayAdapter )adapter;
> displayAdapter.setFocusControl( control );
> // active
> if( control != null ) {
> Shell shell = control.getShell();
> shell.setActiveControl( control );
> }
> }
>
> This method is invoked in WizardDialog.stopped(...). See that the
> control shell is activated by setFocus in RAP 1.3. If this code will
> be removed the problem will disappear, so I doubt in correctness of
> this code - we shouldn't activate control shell by setFocus method
> without any checks (f.e. there is modal dialog over the control shell).
>
> Best regards,
> Yury.
Re: Shell activate order problem [message #555020 is a reply to message #554980] Wed, 25 August 2010 08:26 Go to previous message
Yury Mising name is currently offline Yury Mising nameFriend
Messages: 95
Registered: May 2010
Location: Russia
Member
Hi, Ivan!

I've reported https://bugs.eclipse.org/bugs/show_bug.cgi?id=323570 and created a patch for ComplaintsPage from SurveyWizard in org.eclipse.rap.demo project to easy reproduce the problem (there is a Run button on the first page of the wizard).

Best regards,
Yury.
Previous Topic:How to get .swf running in a browser?
Next Topic:Custom Table Paint
Goto Forum:
  


Current Time: Wed Feb 21 19:50:28 GMT 2024

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

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

Back to the top