Shell activate order problem [message #554980] |
Wed, 25 August 2010 04:56  |
Eclipse User |
|
|
|
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] by Moderator Report message to a moderator
|
|
|
Re: Shell activate order problem [message #554995 is a reply to message #554980] |
Wed, 25 August 2010 06:43   |
Eclipse User |
|
|
|
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.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03570 seconds