Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 440948

Summary: [Shell] setMaximized does not work in some case
Product: [RT] RAP Reporter: laurent russo <laurent.russo>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.3   
Target Milestone: 3.0 M1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Rap Demo Project helping reproduction of Shell Maximization Issue none

Description laurent russo CLA 2014-08-01 03:57:09 EDT
Created attachment 245635 [details]
Rap Demo Project helping reproduction of Shell Maximization Issue

We have a recurring problem on maximizing the shell during a long processing in postWindowOpen().
This issue occurs during workbench's creation when the user decide to manipulate browser's window size.

3 important points are to be considered :

a simple App -> shellStyle(SWT.NO_TRIM)
a long process -> Thread.sleep(3000)
a maximized Shell -> shell.setMaximized(true);

We can reproduce this behavior in RAP demo by modifying a few lines in the DemoWorkbenchWindowAdvisor (see snippet/project in attachment  in order to reproduce the bug):

To explain|summarize...

in preWindowOpen() we define:
getWindowConfigurer () setShellStyle (SWT.NO_TRIM).;

in postWindowOpen() we add a pause to simulate a long process:
try {
Thread.sleep (3000);
} Catch (InterruptedException e) {
e.printStackTrace ();
}

and to maximize of the view,we overload the postWindowCreate() method:
IWorkbench PlatformUI.getWorkbench workbench = ();
IWorkbenchWindow workbench.getActiveWorkbenchWindow window = ();
Shell shell = window.getShell ();
shell.setMaximized (true);
super.postWindowCreate ();

To reproduce this issue we have to proceed the following three steps quickly chained:
1) Reduce the size of the window to a quarter of the screen size.
2) Press the 'F5' key and ...
3) immediately change the size of the browser window.

When the Demo Application finally appears, it occupies the same size that the browser's window have before the processing (sleep (3000)).
Comment 1 Ivan Furnadjiev CLA 2014-08-04 04:53:56 EDT
Are you sure that you are using RAP 2.3? I've tried to modify our Workbech Demo as you mentioned in the description, but it's working fine for me. Could you provide a complete test project (modified Workbench Demo -> DemoWorkbenchWindowAdvisor) to demonstrate the issue? Does it happen in all browsers - IE10/11, Chrome, Firefox, Opera?
Comment 2 laurent russo CLA 2014-08-04 07:52:35 EDT
Yes, i confirm you that we are using RAP 2.3. You will find a complete test project (modified Workbench Demo -> DemoWorkbenchWindowAdvisor) provided as attachment of the previous message.
Comment 3 laurent russo CLA 2014-08-04 08:01:45 EDT
We can reproduce on (linux) firefox 30 & chromium 34 (pc) iexplorer 7
Comment 4 Ivan Furnadjiev CLA 2014-08-04 09:27:40 EDT
I can't reproduce it all the time (it's timing issue), but at least I saw the problem several times. Client does not send shell bounds, when the problem occurs (display bounds are correctly sent).
Comment 5 Ivan Furnadjiev CLA 2014-08-05 03:24:48 EDT
We add client-side "windowresize" listener to the Shell, when mode ( "maximized" ) is applied. When restarting the application (F5), the shell mode is set by the server in the response of the first post request. If this request takes longer (your thread sleep code) and you resize the browser window when the request is running, "windowresize" listener is not attached yet and thus window resizing is not detected by the shell (old display/shell bounds are used).
Comment 6 Ivan Furnadjiev CLA 2014-08-05 11:37:17 EDT
Fixed in master with change https://git.eclipse.org/r/31023.