summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-09 09:19:51 (EDT)
committerEike Stepper2007-10-09 09:19:51 (EDT)
commit38ae2e2de0c3f4bdfa642cf704b4c57ff8e32b8e (patch)
treee126ce89c5765307939886702b5de87d785c66d5
parent78d72482bcfb1d30bb48000d57189fabc0fedc35 (diff)
downloadcdo-38ae2e2de0c3f4bdfa642cf704b4c57ff8e32b8e.zip
cdo-38ae2e2de0c3f4bdfa642cf704b4c57ff8e32b8e.tar.gz
cdo-38ae2e2de0c3f4bdfa642cf704b4c57ff8e32b8e.tar.bz2
[205668] Provide buddies example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205668
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java5
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/icons/full/obj16/collaborations.gif (renamed from plugins/org.eclipse.net4j.buddies.ui/icons/full/obj16/chats.gif)bin573 -> 573 bytes
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/icons/full/view16/collaborations_view.gifbin0 -> 573 bytes
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/plugin.xml12
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java49
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java88
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java33
7 files changed, 155 insertions, 32 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
index d3eb43d..94cee5e 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
@@ -14,6 +14,7 @@ import org.eclipse.net4j.util.ui.views.IElementFilter;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbenchPage;
public class CDOSessionsView extends ContainerView
@@ -25,10 +26,10 @@ public class CDOSessionsView extends ContainerView
}
@Override
- public void createPartControl(Composite parent)
+ protected Control createUI(Composite parent)
{
openSessionAction = new OpenSessionAction(getViewSite().getPage());
- super.createPartControl(parent);
+ return super.createUI(parent);
}
@Override
diff --git a/plugins/org.eclipse.net4j.buddies.ui/icons/full/obj16/chats.gif b/plugins/org.eclipse.net4j.buddies.ui/icons/full/obj16/collaborations.gif
index 21a902f..21a902f 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/icons/full/obj16/chats.gif
+++ b/plugins/org.eclipse.net4j.buddies.ui/icons/full/obj16/collaborations.gif
Binary files differ
diff --git a/plugins/org.eclipse.net4j.buddies.ui/icons/full/view16/collaborations_view.gif b/plugins/org.eclipse.net4j.buddies.ui/icons/full/view16/collaborations_view.gif
new file mode 100644
index 0000000..21a902f
--- /dev/null
+++ b/plugins/org.eclipse.net4j.buddies.ui/icons/full/view16/collaborations_view.gif
Binary files differ
diff --git a/plugins/org.eclipse.net4j.buddies.ui/plugin.xml b/plugins/org.eclipse.net4j.buddies.ui/plugin.xml
index d8d8cdb..8c8c133 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/plugin.xml
+++ b/plugins/org.eclipse.net4j.buddies.ui/plugin.xml
@@ -30,15 +30,19 @@
point="org.eclipse.ui.views">
<category
id="org.eclipse.net4j"
- name="Net4j">
- </category>
+ name="Net4j"/>
<view
category="org.eclipse.net4j"
class="org.eclipse.net4j.buddies.internal.ui.views.BuddiesView"
icon="icons/full/view16/buddies_view.gif"
id="org.eclipse.net4j.BuddiesView"
- name="Buddies">
- </view>
+ name="Buddies"/>
+ <view
+ category="org.eclipse.net4j"
+ class="org.eclipse.net4j.buddies.internal.ui.views.CollaborationsView"
+ icon="icons/full/view16/collaborations_view.gif"
+ id="org.eclipse.net4j.CollaborationsView"
+ name="Collaborations"/>
</extension>
<extension
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java
index b67a454..e79fdae 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java
@@ -28,6 +28,8 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
public class BuddiesView extends ContainerView implements IListener
{
@@ -52,6 +54,8 @@ public class BuddiesView extends ContainerView implements IListener
private boolean flashing;
+ private static BuddiesView INSTANCE;
+
public BuddiesView()
{
if (isAutoConnect())
@@ -60,6 +64,16 @@ public class BuddiesView extends ContainerView implements IListener
}
}
+ public static synchronized BuddiesView getINSTANCE()
+ {
+ return INSTANCE;
+ }
+
+ public IBuddySession getSession()
+ {
+ return session;
+ }
+
protected Boolean isAutoConnect()
{
return OM.PREF_AUTO_CONNECT.getValue();
@@ -146,12 +160,21 @@ public class BuddiesView extends ContainerView implements IListener
}
@Override
- public void dispose()
+ public synchronized void dispose()
{
+ INSTANCE = null;
disconnect();
super.dispose();
}
+ @Override
+ protected Control createUI(Composite parent)
+ {
+ Control control = super.createUI(parent);
+ INSTANCE = this;
+ return control;
+ }
+
public void notifyEvent(IEvent event)
{
if (event.getSource() == session)
@@ -189,30 +212,6 @@ public class BuddiesView extends ContainerView implements IListener
}
}
- protected void closeView()
- {
- try
- {
- getSite().getShell().getDisplay().syncExec(new Runnable()
- {
- public void run()
- {
- try
- {
- getSite().getPage().hideView(BuddiesView.this);
- BuddiesView.this.dispose();
- }
- catch (Exception ignore)
- {
- }
- }
- });
- }
- catch (Exception ignore)
- {
- }
- }
-
@Override
protected IContainer<?> getContainer()
{
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
new file mode 100644
index 0000000..2b2d95a
--- /dev/null
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
@@ -0,0 +1,88 @@
+package org.eclipse.net4j.buddies.internal.ui.views;
+
+import org.eclipse.net4j.buddies.IBuddySession;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
+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.layout.RowLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Sash;
+import org.eclipse.swt.widgets.Tree;
+
+public class CollaborationsView extends ContainerView implements IListener
+{
+ private static CollaborationsView INSTANCE;
+
+ private Sash sash;
+
+ public CollaborationsView()
+ {
+ }
+
+ public static synchronized CollaborationsView getINSTANCE()
+ {
+ return INSTANCE;
+ }
+
+ @Override
+ public synchronized void dispose()
+ {
+ INSTANCE = null;
+ super.dispose();
+ }
+
+ @Override
+ protected synchronized Control createUI(Composite parent)
+ {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new RowLayout());
+
+ Control control = super.createUI(composite);
+ sash = new Sash(composite, SWT.VERTICAL);
+ Tree pane = new Tree(composite, SWT.NONE);
+ INSTANCE = this;
+ return composite;
+ }
+
+ public void notifyEvent(IEvent event)
+ {
+ }
+
+ @Override
+ protected IContainer<?> getContainer()
+ {
+ BuddiesView buddiesView = BuddiesView.getINSTANCE();
+ IBuddySession session = buddiesView == null ? null : buddiesView.getSession();
+ return session != null ? session.getSelf() : ContainerUtil.emptyContainer();
+ }
+
+ @Override
+ protected ContainerItemProvider<IContainer<Object>> createContainerItemProvider()
+ {
+ return new BuddiesItemProvider();
+ }
+
+ @Override
+ protected void fillLocalToolBar(IToolBarManager manager)
+ {
+ super.fillLocalToolBar(manager);
+ }
+
+ @Override
+ protected void fillLocalPullDown(IMenuManager manager)
+ {
+ super.fillLocalPullDown(manager);
+ }
+
+ protected void updateState()
+ {
+ }
+} \ No newline at end of file
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 b2c7a08..8e8b912 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
@@ -23,6 +23,7 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
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.ui.IActionBars;
@@ -87,7 +88,12 @@ public abstract class ContainerView extends ViewPart implements ISetSelectionTar
}
@Override
- public void createPartControl(Composite parent)
+ public final void createPartControl(Composite parent)
+ {
+ createUI(parent);
+ }
+
+ protected Control createUI(Composite parent)
{
itemProvider = createContainerItemProvider();
viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
@@ -101,6 +107,7 @@ public abstract class ContainerView extends ViewPart implements ISetSelectionTar
hookContextMenu();
hookDoubleClick();
contributeToActionBars();
+ return viewer.getControl();
}
protected ContainerItemProvider<IContainer<Object>> createContainerItemProvider()
@@ -224,6 +231,30 @@ public abstract class ContainerView extends ViewPart implements ISetSelectionTar
}
}
+ protected void closeView()
+ {
+ try
+ {
+ getSite().getShell().getDisplay().syncExec(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ getSite().getPage().hideView(ContainerView.this);
+ ContainerView.this.dispose();
+ }
+ catch (Exception ignore)
+ {
+ }
+ }
+ });
+ }
+ catch (Exception ignore)
+ {
+ }
+ }
+
protected void showMessage(String message)
{
showMessage(MessageType.INFORMATION, message);