Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Gerbig2015-08-31 09:14:33 +0000
committerGerrit Code Review @ Eclipse.org2015-11-05 12:26:35 +0000
commitc077b2a68f8f418ec60460a3719678e62170d342 (patch)
tree678af1e68e16878238adc8f5bdbb6049c82dac46
parentdad3b80ddc6a311f7ad3c179d3b46b7623ff48c4 (diff)
downloadorg.eclipse.rap.incubator.e4-c077b2a68f8f418ec60460a3719678e62170d342.tar.gz
org.eclipse.rap.incubator.e4-c077b2a68f8f418ec60460a3719678e62170d342.tar.xz
org.eclipse.rap.incubator.e4-c077b2a68f8f418ec60460a3719678e62170d342.zip
Bug 469756 - View resize problem when on view is minimized in trimstack
The old SelectionListener is removed and a new one is added when the sash widgets are updated. This has to be done because the SelectionListener works on old SashRect data otherwise. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=469756 Change-Id: I50d24b9a65a1fa6e5c93d35fa64fbbf1f67cd980 Signed-off-by: Alexander Gerbig <alexander.gerbig@gmail.com>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/SashLayout.java55
1 files changed, 37 insertions, 18 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/SashLayout.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/SashLayout.java
index 963050a..3b0b70b 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/SashLayout.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/SashLayout.java
@@ -188,6 +188,7 @@ public class SashLayout extends Layout {
// RAP: Use real Sash widgets instead of mouse track/move listeners
List<Sash> sashWidgets = new ArrayList<Sash>();
+ private static final String SELECTION_LISTENER_ID = "selListener"; //$NON-NLS-1$
private void updateSashWidgets() {
for (int i = 0; i < sashes.size(); i++) {
@@ -196,6 +197,11 @@ public class SashLayout extends Layout {
Sash sashWidget = sashWidgets.get(i);
if (isSameOrientation(sashWidget, sashRect)) {
sashWidget.setBounds(sashRect.rect);
+ sashWidget.removeListener(SWT.Selection, (Listener) sashWidget.getData(SELECTION_LISTENER_ID));
+
+ SelectionListener selListener = new SelectionListener(sashRect, sashWidget);
+ sashWidget.setData(SELECTION_LISTENER_ID, selListener);
+ sashWidget.addListener(SWT.Selection, selListener);
} else {
sashWidgets.set(i, createSash(sashRect)).dispose();
}
@@ -208,28 +214,41 @@ public class SashLayout extends Layout {
}
}
+ class SelectionListener implements Listener {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ SashRect sashRect;
+ Sash sash;
+
+ public SelectionListener(SashRect sr, Sash sash) {
+ sashRect = sr;
+ this.sash = sash;
+ }
+
+ @Override
+ public void handleEvent(Event event) {
+ Display display = host.getDisplay();
+ Point cursorLocation = display.getCursorLocation();
+ Point mapped = display.map(null, host, cursorLocation);
+ List<SashRect> sashesToDrag = new ArrayList<SashLayout.SashRect>();
+ sashesToDrag.add(sashRect);
+ adjustWeights(sashesToDrag, mapped.x, mapped.y);
+ host.layout();
+ host.update();
+ }
+ }
+
private Sash createSash(final SashRect sashRect) {
boolean horizontal = !sashRect.container.isHorizontal();
Sash sash = new Sash(host, horizontal ? SWT.HORIZONTAL : SWT.VERTICAL);
sash.setBounds(sashRect.rect);
- sash.addListener(SWT.Selection, new Listener() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- Display display = host.getDisplay();
- Point cursorLocation = display.getCursorLocation();
- Point mapped = display.map(null, host, cursorLocation);
- sashesToDrag = new ArrayList<SashLayout.SashRect>();
- sashesToDrag.add(sashRect);
- adjustWeights(sashesToDrag, mapped.x, mapped.y);
- host.layout();
- host.update();
- }
- });
+
+ SelectionListener selListener = new SelectionListener(sashRect, sash);
+ sash.setData(SELECTION_LISTENER_ID, selListener);
+ sash.addListener(SWT.Selection, selListener);
return sash;
}

Back to the top