summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-13 03:35:51 (EDT)
committerEike Stepper2007-10-13 03:35:51 (EDT)
commit30d1ae1b8db430671a1ddcc7d1903c25160ead97 (patch)
tree52b3c28231bbe03125f76fb3b16d2faf253c45bb
parent067817c630747a942835c746d7b4185b478f770f (diff)
downloadcdo-30d1ae1b8db430671a1ddcc7d1903c25160ead97.zip
cdo-30d1ae1b8db430671a1ddcc7d1903c25160ead97.tar.gz
cdo-30d1ae1b8db430671a1ddcc7d1903c25160ead97.tar.bz2
[206223] Provide collaborations example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=206223
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/SashComposite.java64
1 files changed, 36 insertions, 28 deletions
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/SashComposite.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/SashComposite.java
index c288de8..dc978aa 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/SashComposite.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/SashComposite.java
@@ -145,40 +145,48 @@ public abstract class SashComposite extends Composite
protected Sash createSash(Composite parent)
{
- final Sash sash = new Sash(parent, vertical ? SWT.VERTICAL : SWT.HORIZONTAL);
- sash.addListener(SWT.Selection, new Listener()
+ Sash sash = new Sash(parent, vertical ? SWT.VERTICAL : SWT.HORIZONTAL);
+ sash.addListener(SWT.Selection, new SashListener());
+ return sash;
+ }
+
+ protected abstract Control createControl1(Composite parent);
+
+ protected abstract Control createControl2(Composite parent);
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class SashListener implements Listener
+ {
+ public SashListener()
+ {
+ }
+
+ public void handleEvent(Event e)
{
- public void handleEvent(Event e)
+ Rectangle sashRect = sash.getBounds();
+ Rectangle shellRect = SashComposite.this.getClientArea();
+ if (vertical)
{
- Rectangle sashRect = sash.getBounds();
- Rectangle shellRect = SashComposite.this.getClientArea();
- if (vertical)
+ int right = shellRect.width - sashRect.width - limit;
+ e.x = Math.max(Math.min(e.x, right), limit);
+ if (e.x != sashRect.x)
{
- int right = shellRect.width - sashRect.width - limit;
- e.x = Math.max(Math.min(e.x, right), limit);
- if (e.x != sashRect.x)
- {
- sashData.left = new FormAttachment(0, e.x);
- SashComposite.this.layout();
- }
+ sashData.left = new FormAttachment(0, e.x);
+ SashComposite.this.layout();
}
- else
+ }
+ else
+ {
+ int bottom = shellRect.height - sashRect.height - limit;
+ e.y = Math.max(Math.min(e.y, bottom), limit);
+ if (e.y != sashRect.y)
{
- int bottom = shellRect.height - sashRect.height - limit;
- e.y = Math.max(Math.min(e.y, bottom), limit);
- if (e.y != sashRect.y)
- {
- sashData.top = new FormAttachment(0, e.y);
- SashComposite.this.layout();
- }
+ sashData.top = new FormAttachment(0, e.y);
+ SashComposite.this.layout();
}
}
- });
-
- return sash;
+ }
}
-
- protected abstract Control createControl1(Composite parent);
-
- protected abstract Control createControl2(Composite parent);
} \ No newline at end of file