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

Bug 398684

Summary: [Workbench] Initial size from IWorkbenchWindowConfigurer is not used to create the workbench window
Product: [Eclipse Project] Platform Reporter: Janice Li <jli1>
Component: UIAssignee: Paul Webster <pwebster>
Status: VERIFIED FIXED QA Contact: Paul Webster <pwebster>
Severity: normal    
Priority: P3 CC: daniel_megert, emoffatt, Mike_Wilson, pwebster
Version: 4.2.1Keywords: helpwanted
Target Milestone: 4.4 M3   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 418615, 418616    

Description Janice Li CLA 2013-01-21 15:39:16 EST
In our application (IBM Installation Manager), we override 'preWindowOpen()' in 'WorkbenchWindowAdvisor' to set initial size to IWorkbenchWindowConfigurer (e.g. IWorkbenchWindowConfigurer.setInitialSize(lastSessionIMSize)) . But this initial size is not used to create the workbench window after we moved our target environment to Eclipse 4.2.1. It used to work before our E4 adoption.
Comment 1 Janice Li CLA 2013-03-19 15:35:14 EDT
When will this bug be fixed?
Comment 2 Paul Webster CLA 2013-03-19 16:03:45 EDT
No one is looking at this.

PW
Comment 3 Janice Li CLA 2013-09-06 19:53:55 EDT
Any plan when this is going to be fixed? I got an APAR for this problem.
Comment 4 Mike Wilson CLA 2013-09-25 14:10:13 EDT
Paul, we need to look at this one.
Comment 5 Paul Webster CLA 2013-09-26 14:28:35 EDT
We have code in org.eclipse.ui.internal.Workbench.createWorkbenchWindow(IAdaptable, IPerspectiveDescriptor, MWindow, boolean) that will fill in the initial size for new windows.

But it appears on startup of an RCP app we end up calling createWorkbenchWindow(*) with newWindow = false, and the stack trace looks like:

Thread [main] (Suspended (breakpoint at line 701 in WorkbenchWindow))	
	Workbench.createWorkbenchWindow(IAdaptable, IPerspectiveDescriptor, MWindow, boolean) line: 1399	
	Workbench.getActiveWorkbenchWindow() line: 1372	
	WorkbenchSourceProvider.updateActiveShell(Map) line: 924	
	WorkbenchSourceProvider.getCurrentState() line: 133	
	WorkbenchSourceProvider$6.handleEvent(Event) line: 684	
	EventTable.sendEvent(Event) line: 84	
	Display.filterEvent(Event) line: 1552	
	Shell(Widget).sendEvent(Event) line: 1386	
	Shell(Widget).sendEvent(int, Event, boolean) line: 1411	
	Shell(Widget).sendEvent(int) line: 1392	
	Shell.filterProc(long, long, long) line: 752	
	Display.filterProc(long, long, long) line: 1564	
	OS._g_main_context_iteration(long, boolean) line: not available [native method]	
	OS.g_main_context_iteration(long, boolean) line: 2260	
	Display.readAndDispatch() line: 3359	
	PartRenderingEngine$9.run() line: 1113	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 997	
	E4Workbench.createAndRunUI(MApplicationElement) line: 144	
	Workbench$5.run() line: 613	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 567	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 150	
	Application.start(IApplicationContext) line: 20	
	EclipseAppHandle.run(Object) line: 196	
	EclipseAppLauncher.runApplication(Object) line: 109	
	EclipseAppLauncher.start(Object) line: 80	
	EclipseStarter.run(Object) line: 372	
	EclipseStarter.run(String[], Runnable) line: 226	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
	Method.invoke(Object, Object...) line: 601	
	Main.invokeFramework(String[], URL[]) line: 636	
	Main.basicRun(String[]) line: 591	
	Main.run(String[]) line: 1450	
	Main.main(String[]) line: 1426	
	
org.eclipse.ui.internal.Workbench.openWorkbenchWindow(String, IAdaptable) looks like the only path where we say newWindow = true;  We need to initialize that first window an RCP app creates.
Comment 6 Paul Webster CLA 2013-09-26 14:34:38 EDT
Also, preWindowOpened is not called until after methods like org.eclipse.ui.internal.WorkbenchWindow.configureShell(Shell, IEclipseContext) are called

PW
Comment 7 Paul Webster CLA 2013-09-27 15:29:11 EDT
Here's a proposed fix for RCP applications: 
https://git.eclipse.org/r/16851

Set the size of the shell after the preWindowOpen has been called.
Set the default size of the shell in ui.workbench (the final refuge to load a new model for RCP apps) to 5,5 to avoid a large grey rectangle.

PW
Comment 9 Eric Moffatt CLA 2013-10-29 10:55:28 EDT
Verified (using the RCPMail app) in 4.4.0.I20131028-2000.