Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Webster2013-09-27 19:26:40 +0000
committerGerrit Code Review @ Eclipse.org2013-10-03 19:27:54 +0000
commit9e3a192774a5791281df43c15f4d3666ba525fdc (patch)
treeb0956154b466528352395cd22d9ec21996c86e0d
parent7c2051c64a1cb377923565018609ea5d10524448 (diff)
downloadeclipse.platform.ui-9e3a192774a5791281df43c15f4d3666ba525fdc.tar.gz
eclipse.platform.ui-9e3a192774a5791281df43c15f4d3666ba525fdc.tar.xz
eclipse.platform.ui-9e3a192774a5791281df43c15f4d3666ba525fdc.zip
Bug 398684 - [Workbench] Initial size from IWorkbenchWindowConfigurer is
not used to create the workbench window Set the size after preWindowOpen() is called. Have the default model loaded for small RCP apps start with a really small size to avoid large grey rectangles. Change-Id: I5816bf38df4ccd3135e1f1cb9c0dbccb563381df
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java2
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ResourceHandler.java1
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/LegacyIDE.e4xmi2
4 files changed, 16 insertions, 2 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java
index 0c031aa3440..9fe7a8762eb 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java
@@ -78,6 +78,8 @@ public class E4Workbench implements IWorkbench {
*/
public static final String FORCED_PERSPECTIVE_ID = "forcedPerspetiveId"; //$NON-NLS-1$
+ public static final String NO_SAVED_MODEL_FOUND = "NO_SAVED_MODEL_FOUND"; //$NON-NLS-1$
+
private final String id;
private ServiceRegistration<?> osgiRegistration;
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ResourceHandler.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ResourceHandler.java
index 11d200c8139..7c380a4016e 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ResourceHandler.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ResourceHandler.java
@@ -207,6 +207,7 @@ public class ResourceHandler implements IModelResourceHandler {
Resource applicationResource = loadResource(applicationDefinitionInstance);
MApplication theApp = (MApplication) applicationResource.getContents().get(0);
resource = createResourceWithApp(theApp);
+ context.set(E4Workbench.NO_SAVED_MODEL_FOUND, Boolean.TRUE);
}
// Add model items described in the model extension point
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
index b3846c5b97f..d4bcf4ee9e9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
@@ -112,6 +112,8 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Layout;
@@ -568,13 +570,13 @@ public class WorkbenchWindow implements IWorkbenchWindow {
cs.activateContext(IContextService.CONTEXT_ID_WINDOW);
cs.getActiveContextIds();
- configureShell(getShell(), windowContext);
initializeDefaultServices();
// register with the tracker
fireWindowOpening();
+ configureShell(getShell(), windowContext);
try {
page = new WorkbenchPage(this, input);
@@ -697,6 +699,15 @@ public class WorkbenchWindow implements IWorkbenchWindow {
IContextService contextService = context.get(IContextService.class);
contextService.registerShell(shell, IContextService.TYPE_WINDOW);
+ if (model.getContext().get(E4Workbench.NO_SAVED_MODEL_FOUND) != null) {
+ Point initialSize = getWindowConfigurer().getInitialSize();
+ Rectangle bounds = shell.getBounds();
+ // actually set the shell size, so that setting the
+ // menuBar on the shell doesn't override the model changes.
+ bounds.width = initialSize.x;
+ bounds.height = initialSize.y;
+ shell.setBounds(bounds);
+ }
}
private boolean setupPerspectiveStack(IEclipseContext context) {
diff --git a/bundles/org.eclipse.ui.workbench/LegacyIDE.e4xmi b/bundles/org.eclipse.ui.workbench/LegacyIDE.e4xmi
index a55c0520381..e96f202e31e 100644
--- a/bundles/org.eclipse.ui.workbench/LegacyIDE.e4xmi
+++ b/bundles/org.eclipse.ui.workbench/LegacyIDE.e4xmi
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ASCII"?>
<application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xsi:schemaLocation="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic http://www.eclipse.org/ui/2010/UIModel/application#//ui/basic" xmi:id="org.eclipse.e4.legacy.ide.application" elementId="org.eclipse.e4.legacy.ide.application" bindingContexts="_SeXUHO8EEd6BC9cDb6iV7y">
- <children xsi:type="basic:TrimmedWindow" xmi:id="IDEWindow" elementId="IDEWindow" label="%trimmedwindow.label.eclipseSDK" width="1024" height="768"/>
+ <children xsi:type="basic:TrimmedWindow" xmi:id="IDEWindow" elementId="IDEWindow" label="%trimmedwindow.label.eclipseSDK" width="5" height="5"/>
<bindingTables xmi:id="_SeXUEO8EEd6FC9cDb6iV7x" bindingContext="_SeXUHO8EEd6BC9cDb6iV7y"/>
<rootContext xmi:id="_SeXUHO8EEd6BC9cDb6iV7y" elementId="org.eclipse.ui.contexts.dialogAndWindow" name="%bindingcontext.name.dialogAndWindows">
<children xmi:id="_SeXUEO8EEd6FC9cDb6iV7w" elementId="org.eclipse.ui.contexts.window" name="%bindingcontext.name.windows">

Back to the top