summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-02-17 04:58:00 (EST)
committerEike Stepper2007-02-17 04:58:00 (EST)
commitd945cf432354cc55ae56cd41135598e94d479b79 (patch)
treedf54627d97b6162c9ac5be38d1dba7c77eb720b2
parent45916c7c34712ca860fbdd13fea949535a75dbc3 (diff)
downloadcdo-d945cf432354cc55ae56cd41135598e94d479b79.zip
cdo-d945cf432354cc55ae56cd41135598e94d479b79.tar.gz
cdo-d945cf432354cc55ae56cd41135598e94d479b79.tar.bz2
Initial provisioning
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/.classpath7
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/.cvsignore2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/.options1
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/.project28
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF11
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/build.properties5
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/H.gifbin0 -> 101 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/call_hierarchy.gifbin0 -> 209 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/etool16/delete.gifbin0 -> 351 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/acceptor.gifbin0 -> 376 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/adapter.gifbin0 -> 196 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/channel.gifbin0 -> 198 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/connector.gifbin0 -> 202 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/factory.gifbin0 -> 211 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/folder.gifbin0 -> 219 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/view16/server_explorer.gifbin0 -> 359 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/p2pconn_obj.gifbin0 -> 141 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/sample.gifbin0 -> 983 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/plugin.properties33
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/plugin.xml34
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/CDOUI.java53
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/SharedIcons.java76
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsItemProvider.java92
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsNameSorter.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java204
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/ItemProvider.java161
26 files changed, 724 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/.classpath b/plugins/org.eclipse.emf.cdo.ui/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.emf.cdo.ui/.cvsignore b/plugins/org.eclipse.emf.cdo.ui/.cvsignore
new file mode 100644
index 0000000..6938697
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/.cvsignore
@@ -0,0 +1,2 @@
+bin
+doc
diff --git a/plugins/org.eclipse.emf.cdo.ui/.options b/plugins/org.eclipse.emf.cdo.ui/.options
new file mode 100644
index 0000000..bcbdaa5
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/.options
@@ -0,0 +1 @@
+org.eclipse.emf.cdo.ui/debug = true
diff --git a/plugins/org.eclipse.emf.cdo.ui/.project b/plugins/org.eclipse.emf.cdo.ui/.project
new file mode 100644
index 0000000..fb911ca
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.emf.cdo.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..28d8d2b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.emf.cdo.ui;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-Activator: org.eclipse.emf.cdo.internal.ui.bundle.CDOUI$Activator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.emf.cdo.container
+Eclipse-LazyStart: true
diff --git a/plugins/org.eclipse.emf.cdo.ui/build.properties b/plugins/org.eclipse.emf.cdo.ui/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/H.gif b/plugins/org.eclipse.emf.cdo.ui/icons/H.gif
new file mode 100644
index 0000000..5d86350
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/H.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/call_hierarchy.gif b/plugins/org.eclipse.emf.cdo.ui/icons/call_hierarchy.gif
new file mode 100644
index 0000000..7c7dca8
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/call_hierarchy.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/full/etool16/delete.gif b/plugins/org.eclipse.emf.cdo.ui/icons/full/etool16/delete.gif
new file mode 100644
index 0000000..b6922ac
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/full/etool16/delete.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/acceptor.gif b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/acceptor.gif
new file mode 100644
index 0000000..a830867
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/acceptor.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/adapter.gif b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/adapter.gif
new file mode 100644
index 0000000..e8c1e6f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/adapter.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/channel.gif b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/channel.gif
new file mode 100644
index 0000000..df67abd
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/channel.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/connector.gif b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/connector.gif
new file mode 100644
index 0000000..3b3ad7c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/connector.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/factory.gif b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/factory.gif
new file mode 100644
index 0000000..955d5e8
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/factory.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/folder.gif b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/folder.gif
new file mode 100644
index 0000000..42e027c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/folder.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/full/view16/server_explorer.gif b/plugins/org.eclipse.emf.cdo.ui/icons/full/view16/server_explorer.gif
new file mode 100644
index 0000000..7ef3c2c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/full/view16/server_explorer.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/p2pconn_obj.gif b/plugins/org.eclipse.emf.cdo.ui/icons/p2pconn_obj.gif
new file mode 100644
index 0000000..405fda6
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/p2pconn_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/sample.gif b/plugins/org.eclipse.emf.cdo.ui/icons/sample.gif
new file mode 100644
index 0000000..34fb3c9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/sample.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/plugin.properties b/plugins/org.eclipse.emf.cdo.ui/plugin.properties
new file mode 100644
index 0000000..fbb03e3
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/plugin.properties
@@ -0,0 +1,33 @@
+# /**
+# * <copyright>
+# *
+# * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+# * All rights reserved. This program and the accompanying materials
+# * are made available under the terms of the Eclipse Public License v1.0
+# * which accompanies this distribution, and is available at
+# * http://www.eclipse.org/legal/epl-v10.html
+# *
+# * Contributors:
+# * Eike Stepper - Initial API and implementation
+# *
+# * </copyright>
+# *
+# * $Id$
+# */
+
+# NLS_MESSAGEFORMAT_VAR
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+pluginName=CDO UI
+providerName=Eclipse.org
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
diff --git a/plugins/org.eclipse.emf.cdo.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.ui/plugin.xml
new file mode 100644
index 0000000..ee28879
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/plugin.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ id="org.eclipse.emf.cdo.ui"
+ name="CDO">
+ </category>
+ <view
+ category="org.eclipse.emf.cdo.ui"
+ class="org.eclipse.emf.cdo.internal.ui.views.CDOSessionsView"
+ icon="icons/sample.gif"
+ id="org.eclipse.emf.cdo.ui.CDOSessionsView"
+ name="CDO Sessions">
+ </view>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.eclipse.ui.resourcePerspective">
+ <view
+ id="org.eclipse.emf.cdo.ui.CDOSessionsView"
+ ratio="0.5"
+ relationship="left"
+ relative="org.eclipse.ui.views.TaskList">
+ </view>
+ </perspectiveExtension>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/CDOUI.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/CDOUI.java
new file mode 100644
index 0000000..5b79df5
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/CDOUI.java
@@ -0,0 +1,53 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.ui.bundle;
+
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMLogger;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.OMTracer;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOUI
+{
+ public static final String BUNDLE_ID = "org.eclipse.net4j.container.ui"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, CDOUI.class);
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ private CDOUI()
+ {
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Activator implements BundleActivator
+ {
+ public void start(BundleContext context) throws Exception
+ {
+ BUNDLE.setBundleContext(context);
+ }
+
+ public void stop(BundleContext context) throws Exception
+ {
+ BUNDLE.setBundleContext(null);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/SharedIcons.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/SharedIcons.java
new file mode 100644
index 0000000..9adda86
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/SharedIcons.java
@@ -0,0 +1,76 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.ui.bundle;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * @author Eike Stepper
+ */
+public class SharedIcons
+{
+ private static final ImageRegistry REGISTRY = new ImageRegistry(getDisplay());
+
+ private static final String OBJ = "icons/full/obj16/";
+
+ public static final ImageDescriptor OBJ_ACCEPTOR = getDescriptor(OBJ + "acceptor.gif");
+
+ public static final ImageDescriptor OBJ_ADAPTER = getDescriptor(OBJ + "adapter.gif");
+
+ public static final ImageDescriptor OBJ_CHANNEL = getDescriptor(OBJ + "channel.gif");
+
+ public static final ImageDescriptor OBJ_CONNECTOR = getDescriptor(OBJ + "connector.gif");
+
+ public static final ImageDescriptor OBJ_FACTORY = getDescriptor(OBJ + "factory.gif");
+
+ public static final ImageDescriptor OBJ_FOLDER = getDescriptor(OBJ + "folder.gif");
+
+ public static Image getImage(String key)
+ {
+ ImageDescriptor descriptor = getDescriptor(key);
+ return descriptor.createImage();
+ }
+
+ public static ImageDescriptor getDescriptor(String key)
+ {
+ ImageDescriptor descriptor = REGISTRY.getDescriptor(key);
+ if (descriptor == null)
+ {
+ descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(CDOUI.BUNDLE_ID, key);
+ if (descriptor != null)
+ {
+ REGISTRY.put(key, descriptor);
+ }
+ }
+
+ return descriptor;
+ }
+
+ private static Display getDisplay()
+ {
+ Display display = Display.getCurrent();
+ if (display == null)
+ {
+ display = Display.getDefault();
+ }
+
+ if (display == null)
+ {
+ throw new IllegalStateException("display == null");
+ }
+
+ return display;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsItemProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsItemProvider.java
new file mode 100644
index 0000000..8b52810
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsItemProvider.java
@@ -0,0 +1,92 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.ui.views;
+
+import org.eclipse.emf.cdo.CDOSession;
+import org.eclipse.emf.cdo.container.CDOContainerAdapter;
+import org.eclipse.emf.cdo.internal.ui.bundle.SharedIcons;
+
+import org.eclipse.net4j.util.registry.IRegistryEvent;
+import org.eclipse.net4j.util.registry.IRegistryListener;
+
+import org.eclipse.swt.graphics.Image;
+
+import java.text.MessageFormat;
+import java.util.Collection;
+
+public class CDOSessionsItemProvider extends ItemProvider<CDOContainerAdapter> implements IRegistryListener
+{
+ public CDOSessionsItemProvider()
+ {
+ }
+
+ public Object getParent(Object child)
+ {
+ if (child instanceof CDOSession)
+ {
+ return getInput();
+ }
+
+ return null;
+ }
+
+ public Object[] getChildren(Object parent)
+ {
+ if (parent == getInput())
+ {
+ Collection values = getInput().getSessionRegistry().values();
+ return values.toArray(new Object[values.size()]);
+ }
+
+ return NO_CHILDREN;
+ }
+
+ public void notifyRegistryEvent(IRegistryEvent event)
+ {
+ refreshViewer(false);
+ }
+
+ @Override
+ public String getText(Object obj)
+ {
+ if (obj instanceof CDOSession)
+ {
+ CDOSession session = (CDOSession)obj;
+ return MessageFormat.format("[{0}] {1}@{2}", session.getSessionID(), session.getRepository().getName(), session
+ .getChannel().getConnector().getDescription());
+ }
+
+ return super.getText(obj);
+ }
+
+ @Override
+ public Image getImage(Object obj)
+ {
+ if (obj instanceof CDOSession)
+ {
+ return SharedIcons.OBJ_CHANNEL.createImage();
+ }
+
+ return null;
+ }
+
+ @Override
+ protected void connectInput(CDOContainerAdapter input)
+ {
+ input.getSessionRegistry().addRegistryListener(this);
+ }
+
+ @Override
+ protected void disconnectInput(CDOContainerAdapter input)
+ {
+ input.getSessionRegistry().removeRegistryListener(this);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsNameSorter.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsNameSorter.java
new file mode 100644
index 0000000..fd485dc
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsNameSorter.java
@@ -0,0 +1,17 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.ui.views;
+
+import org.eclipse.jface.viewers.ViewerSorter;
+
+public class CDOSessionsNameSorter extends ViewerSorter
+{
+} \ No newline at end of file
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
new file mode 100644
index 0000000..eb6758e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
@@ -0,0 +1,204 @@
+package org.eclipse.emf.cdo.internal.ui.views;
+
+import org.eclipse.emf.cdo.CDOConstants;
+import org.eclipse.emf.cdo.container.CDOContainerAdapter;
+
+import org.eclipse.net4j.container.Container;
+import org.eclipse.net4j.container.ContainerManager;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+public class CDOSessionsView extends ViewPart
+{
+ private static final Container CONTAINER = ContainerManager.INSTANCE.getContainer();
+
+ private static final CDOContainerAdapter CDO_ADAPTER = (CDOContainerAdapter)CONTAINER.getAdapter(CDOConstants.TYPE);
+
+ private static final ItemProvider ITEM_PROVIDER = new CDOSessionsItemProvider();
+
+ private StructuredViewer viewer;
+
+ // private DrillDownAdapter drillDownAdapter;
+
+ private Action openSessionAction;
+
+ private Action addConnectorAction;
+
+ private Action doubleClickAction;
+
+ public CDOSessionsView()
+ {
+ }
+
+ public void createPartControl(Composite parent)
+ {
+ viewer = new TreeViewer(parent, (SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL));
+ viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // drillDownAdapter = new DrillDownAdapter(viewer);
+ viewer.setContentProvider(ITEM_PROVIDER);
+ viewer.setLabelProvider(ITEM_PROVIDER);
+ viewer.setSorter(new CDOSessionsNameSorter());
+ viewer.setInput(CDO_ADAPTER);
+
+ makeActions();
+ hookContextMenu();
+ hookDoubleClickAction();
+ contributeToActionBars();
+ }
+
+ private void hookContextMenu()
+ {
+ MenuManager menuMgr = new MenuManager("#PopupMenu");
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener()
+ {
+ public void menuAboutToShow(IMenuManager manager)
+ {
+ CDOSessionsView.this.fillContextMenu(manager);
+ }
+ });
+ Menu menu = menuMgr.createContextMenu(getCurrentViewer().getControl());
+ getCurrentViewer().getControl().setMenu(menu);
+ getSite().registerContextMenu(menuMgr, getCurrentViewer());
+ }
+
+ private StructuredViewer getCurrentViewer()
+ {
+ return viewer;
+ }
+
+ private void contributeToActionBars()
+ {
+ IActionBars bars = getViewSite().getActionBars();
+ fillLocalPullDown(bars.getMenuManager());
+ fillLocalToolBar(bars.getToolBarManager());
+ }
+
+ private void fillLocalPullDown(IMenuManager manager)
+ {
+ manager.add(openSessionAction);
+ manager.add(addConnectorAction);
+ // manager.add(new Separator());
+ // manager.add(action2);
+ }
+
+ private void fillContextMenu(IMenuManager manager)
+ {
+ // manager.add(action2);
+ // manager.add(new Separator());
+ // drillDownAdapter.addNavigationActions(manager);
+
+ // Other plug-ins can contribute there actions here
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ private void fillLocalToolBar(IToolBarManager manager)
+ {
+ manager.add(openSessionAction);
+ manager.add(addConnectorAction);
+ // manager.add(action2);
+ // manager.add(new Separator());
+ // drillDownAdapter.addNavigationActions(manager);
+ }
+
+ private void makeActions()
+ {
+ openSessionAction = new Action()
+ {
+ public void run()
+ {
+ InputDialog dialog = new InputDialog(getCurrentViewer().getControl().getShell(), "CDO Sessions",
+ "Enter a session description:", null, null);
+ if (dialog.open() == InputDialog.OK)
+ {
+ String description = dialog.getValue();
+ Object object = CDO_ADAPTER.getSession(description);
+ if (object == null)
+ {
+ showMessage("Error while creating session for description" + description);
+ }
+ }
+ }
+ };
+ openSessionAction.setText("Open Session");
+ openSessionAction.setToolTipText("Open a CDO session");
+ openSessionAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
+ ISharedImages.IMG_TOOL_NEW_WIZARD));
+
+ addConnectorAction = new Action()
+ {
+ public void run()
+ {
+ InputDialog dialog = new InputDialog(getCurrentViewer().getControl().getShell(), "Net4j Explorer",
+ "Enter a connector description:", null, null);
+ if (dialog.open() == InputDialog.OK)
+ {
+ String description = dialog.getValue();
+ Object object = CONTAINER.getConnector(description);
+ if (object == null)
+ {
+ showMessage("Error while creating connector for description" + description);
+ }
+ }
+ }
+ };
+ addConnectorAction.setText("Add Connector");
+ addConnectorAction.setToolTipText("Add a connector");
+ addConnectorAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
+ ISharedImages.IMG_TOOL_NEW_WIZARD));
+
+ doubleClickAction = new Action()
+ {
+ public void run()
+ {
+ ISelection selection = getCurrentViewer().getSelection();
+ Object obj = ((IStructuredSelection)selection).getFirstElement();
+ showMessage("Double-click detected on " + obj.toString());
+ }
+ };
+ }
+
+ private void hookDoubleClickAction()
+ {
+ getCurrentViewer().addDoubleClickListener(new IDoubleClickListener()
+ {
+ public void doubleClick(DoubleClickEvent event)
+ {
+ doubleClickAction.run();
+ }
+ });
+ }
+
+ private void showMessage(String message)
+ {
+ MessageDialog.openInformation(getCurrentViewer().getControl().getShell(), "Net4j Explorer", message);
+ }
+
+ public void setFocus()
+ {
+ getCurrentViewer().getControl().setFocus();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/ItemProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/ItemProvider.java
new file mode 100644
index 0000000..359ddb5
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/ItemProvider.java
@@ -0,0 +1,161 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.ui.views;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+public abstract class ItemProvider<INPUT> extends LabelProvider implements IStructuredContentProvider,
+ ITreeContentProvider
+{
+ protected static final Object[] NO_CHILDREN = new Object[0];
+
+ private StructuredViewer viewer;
+
+ private INPUT input;
+
+ public ItemProvider()
+ {
+ }
+
+ public void dispose()
+ {
+ if (input != null)
+ {
+ disconnectInput(input);
+ input = null;
+ }
+ }
+
+ public StructuredViewer getViewer()
+ {
+ return viewer;
+ }
+
+ public INPUT getInput()
+ {
+ return input;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+ {
+ if (viewer instanceof StructuredViewer)
+ {
+ this.viewer = (StructuredViewer)viewer;
+
+ if (input != null)
+ {
+ disconnectInput(input);
+ }
+
+ try
+ {
+ input = (INPUT)newInput;
+ connectInput(input);
+ }
+ catch (Exception ex)
+ {
+ input = null;
+ }
+ }
+ }
+
+ public Object[] getElements(Object parent)
+ {
+ return getChildren(parent);
+ }
+
+ public boolean hasChildren(Object parent)
+ {
+ return getChildren(parent).length != 0;
+ }
+
+ public String getText(Object obj)
+ {
+ return obj.toString();
+ }
+
+ public Image getImage(Object obj)
+ {
+ String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
+ return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
+ }
+
+ protected void connectInput(INPUT input)
+ {
+ }
+
+ protected void disconnectInput(INPUT input)
+ {
+ }
+
+ protected void refreshViewer(boolean updateLabels)
+ {
+ refreshElement(null, updateLabels);
+ }
+
+ protected void refreshElement(final Object element, final boolean updateLabels)
+ {
+ if (isViewerActive())
+ {
+ getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ if (isViewerActive())
+ {
+ if (element != null)
+ {
+ viewer.refresh(element, updateLabels);
+ }
+ else
+ {
+ viewer.refresh(updateLabels);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ private Display getDisplay()
+ {
+ Display display = viewer.getControl().getDisplay();
+ if (display == null)
+ {
+ display = Display.getCurrent();
+ }
+
+ if (display == null)
+ {
+ display = Display.getDefault();
+ }
+
+ if (display == null)
+ {
+ throw new IllegalStateException("display == null");
+ }
+
+ return display;
+ }
+
+ private boolean isViewerActive()
+ {
+ return viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed();
+ }
+} \ No newline at end of file