summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-09 09:56:18 (EDT)
committerEike Stepper2007-10-09 09:56:18 (EDT)
commit22b32652d28f5b47609845aa3a1dd2c3da261346 (patch)
treebafb7f6dcf760e40b0af9a57fe80fc74a797c081
parentf40c4988b2f5679d1f4a9207840d6fbb08e55569 (diff)
downloadcdo-22b32652d28f5b47609845aa3a1dd2c3da261346.zip
cdo-22b32652d28f5b47609845aa3a1dd2c3da261346.tar.gz
cdo-22b32652d28f5b47609845aa3a1dd2c3da261346.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.java70
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java9
2 files changed, 72 insertions, 7 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 935ae94..848c795 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
@@ -11,6 +11,8 @@ import org.eclipse.net4j.util.ui.views.ContainerView;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -24,6 +26,10 @@ public class CollaborationsView extends ContainerView implements IListener
private Sash sash;
+ private Control leftControl;
+
+ private Tree rightControl;
+
public CollaborationsView()
{
}
@@ -41,24 +47,74 @@ public class CollaborationsView extends ContainerView implements IListener
}
@Override
- protected synchronized Control createUI(Composite parent)
+ protected synchronized Control createUI(final Composite parent)
{
GridLayout grid = new GridLayout(3, false);
grid.marginWidth = 0;
grid.marginHeight = 0;
grid.horizontalSpacing = 0;
- Composite composite = new Composite(parent, SWT.NONE);
+ final Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(grid);
- Control control = super.createUI(composite);
- control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ leftControl = super.createUI(composite);
+ leftControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
sash = new Sash(composite, SWT.VERTICAL);
sash.setLayoutData(new GridData(GridData.FILL_VERTICAL));
-
- Tree pane = new Tree(composite, SWT.NONE);
- pane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ sash.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ sash.setBounds(e.x, e.y, e.width, e.height);
+ composite.layout(true);
+
+ // if (event.detail == SWT.DRAG)
+ // {
+ // return;
+ // }
+ //
+ // int shift = event.x - sash.getBounds().x;
+ // GridData data = (GridData)rightControl.getLayoutData();
+ // int newWidthHint = data.widthHint + shift;
+ // if (newWidthHint < 20)
+ // {
+ // return;
+ // }
+ //
+ // Point computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ // Point currentSize = getShell().getSize();
+ //
+ // // if the dialog wasn't of a custom size we know we can shrink
+ // // it if necessary based on sash movement.
+ // boolean customSize = !computedSize.equals(currentSize);
+ // data.widthHint = newWidthHint;
+ // composite.layout(true);
+ //
+ // // recompute based on new widget size
+ // computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ //
+ // // if the dialog was of a custom size then increase it only if
+ // // necessary.
+ // if (customSize)
+ // {
+ // computedSize.x = Math.max(computedSize.x, currentSize.x);
+ // }
+ //
+ // computedSize.y = Math.max(computedSize.y, currentSize.y);
+ // if (computedSize.equals(currentSize))
+ // {
+ // return;
+ // }
+ //
+ // compo(computedSize.x, computedSize.y);
+ // lastShellSize = getShell().getSize();
+ }
+ });
+
+ rightControl = new Tree(composite, SWT.NONE);
+ rightControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
INSTANCE = this;
return composite;
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java
index 9163695..a0cc10b 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java
@@ -28,6 +28,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.part.ISetSelectionTarget;
@@ -35,6 +36,8 @@ import org.eclipse.ui.part.ViewPart;
public abstract class ContainerView extends ViewPart implements ISetSelectionTarget
{
+ private Shell shell;
+
private ContainerItemProvider<IContainer<Object>> itemProvider;
private TreeViewer viewer;
@@ -55,6 +58,11 @@ public abstract class ContainerView extends ViewPart implements ISetSelectionTar
{
}
+ public Shell getShell()
+ {
+ return shell;
+ }
+
@Override
public void setFocus()
{
@@ -92,6 +100,7 @@ public abstract class ContainerView extends ViewPart implements ISetSelectionTar
@Override
public final void createPartControl(Composite parent)
{
+ shell = parent.getShell();
GridLayout grid = new GridLayout(1, false);
grid.marginWidth = 0;
grid.marginHeight = 0;