summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-11 03:32:41 (EDT)
committerEike Stepper2007-10-11 03:32:41 (EDT)
commit1486bbcb74d7524637ac59501abc0404035f245e (patch)
tree0115d954315af36bc4c4cbe83c08d2db90d5aca0
parent5981a75313352308b46b33cd3efa9acf076bf7de (diff)
downloadcdo-1486bbcb74d7524637ac59501abc0404035f245e.zip
cdo-1486bbcb74d7524637ac59501abc0404035f245e.tar.gz
cdo-1486bbcb74d7524637ac59501abc0404035f245e.tar.bz2
[205668] Provide buddies example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205668
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java64
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/SashComposite.java4
2 files changed, 15 insertions, 53 deletions
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
index 574366f..79332e0 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
@@ -13,18 +13,12 @@ package org.eclipse.net4j.buddies.internal.ui.views;
import org.eclipse.net4j.buddies.BuddiesUtil;
import org.eclipse.net4j.util.container.ContainerUtil;
import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.ui.widgets.SashComposite;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Sash;
public class CollaborationsView extends SessionManagerView
{
@@ -34,11 +28,7 @@ public class CollaborationsView extends SessionManagerView
private static CollaborationsView INSTANCE;
- private Sash sash;
-
- private Control leftControl;
-
- private Control rightControl;
+ private SashComposite sashComposite;
public CollaborationsView()
{
@@ -59,51 +49,23 @@ public class CollaborationsView extends SessionManagerView
@Override
protected Control createControl(Composite parent)
{
- final FormLayout form = new FormLayout();
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(form);
-
- leftControl = super.createControl(composite);
- sash = new Sash(composite, SWT.VERTICAL);
- rightControl = createPane(composite);
-
- FormData leftControlData = new FormData();
- leftControlData.left = new FormAttachment(0, 0);
- leftControlData.right = new FormAttachment(sash, 0);
- leftControlData.top = new FormAttachment(0, 0);
- leftControlData.bottom = new FormAttachment(100, 0);
- leftControl.setLayoutData(leftControlData);
-
- final FormData sashData = new FormData();
- sashData.left = new FormAttachment(PERCENT, 0);
- sashData.top = new FormAttachment(0, 0);
- sashData.bottom = new FormAttachment(100, 0);
- sash.setLayoutData(sashData);
- sash.addListener(SWT.Selection, new Listener()
+ sashComposite = new SashComposite(parent, SWT.NONE, LIMIT, PERCENT)
{
- public void handleEvent(Event e)
+ @Override
+ protected Control createControl1(Composite parent)
{
- Rectangle sashRect = sash.getBounds();
- Rectangle shellRect = composite.getClientArea();
- 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);
- composite.layout();
- }
+ return CollaborationsView.super.createControl(parent);
}
- });
- FormData rightControlData = new FormData();
- rightControlData.left = new FormAttachment(sash, 0);
- rightControlData.right = new FormAttachment(100, 0);
- rightControlData.top = new FormAttachment(0, 0);
- rightControlData.bottom = new FormAttachment(100, 0);
- rightControl.setLayoutData(rightControlData);
+ @Override
+ protected Control createControl2(Composite parent)
+ {
+ return createPane(parent);
+ }
+ };
INSTANCE = this;
- return composite;
+ return sashComposite;
}
protected Control createPane(Composite parent)
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 b76474f..d90e003 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
@@ -90,7 +90,7 @@ public abstract class SashComposite extends Composite
return control2;
}
- protected abstract Control createControl2(Composite parent);
-
protected abstract Control createControl1(Composite parent);
+
+ protected abstract Control createControl2(Composite parent);
} \ No newline at end of file