Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Xenos2016-04-01 22:34:16 +0000
committerStefan Xenos2016-04-01 23:11:21 +0000
commit9492ed48a3660fd9da974d80f9e34660060d6865 (patch)
treeb99f582d2517a0ea100390b5fea41c48da86b4ce
parent602d6ee7aefa96c36a6eaa72ec8213078a263bee (diff)
downloadeclipse.platform.ui-9492ed48a3660fd9da974d80f9e34660060d6865.tar.gz
eclipse.platform.ui-9492ed48a3660fd9da974d80f9e34660060d6865.tar.xz
eclipse.platform.ui-9492ed48a3660fd9da974d80f9e34660060d6865.zip
Bug 490945 - Detached views get smaller on restart
Remember the shell's bounds each time the view becomes visible, and correct the bounds if the call to setVisible caused a change in the shell size. Change-Id: I76ffacf780b29a62f83504ef0ec7d28dda0a4e05 Signed-off-by: Stefan Xenos <sxenos@gmail.com>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java
index f7a5dcdd055..c390d8fce8c 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java
@@ -19,6 +19,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.Objects;
import java.util.Set;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
@@ -245,7 +246,15 @@ public class WBWRenderer extends SWTPartRenderer {
if (UIEvents.UIElement.VISIBLE.equals(attName)) {
boolean isVisible = (Boolean) event.getProperty(UIEvents.EventTags.NEW_VALUE);
+
+ Rectangle oldBounds = theShell.getBounds();
theShell.setVisible(isVisible);
+ // Workaround for bug 490944: Making a shell visible can change its
+ // size. This is a no-op if the bug isn't present.
+ Rectangle newBounds = theShell.getBounds();
+ if (!Objects.equals(oldBounds, newBounds)) {
+ theShell.setBounds(oldBounds);
+ }
}
}
@@ -690,8 +699,16 @@ public class WBWRenderer extends SWTPartRenderer {
shell.layout(true);
forceLayout(shell);
+ Rectangle oldBounds = shell.getBounds();
if (shellME.isVisible()) {
shell.open();
+
+ // Workaround for bug 490944: Making a shell visible can change its
+ // size. This is a no-op if the bug isn't present.
+ Rectangle newBounds = shell.getBounds();
+ if (!Objects.equals(oldBounds, newBounds)) {
+ shell.setBounds(oldBounds);
+ }
} else {
shell.setVisible(false);
}

Back to the top