summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-02-26 06:04:28 (EST)
committerEike Stepper2007-02-26 06:04:28 (EST)
commit0ceffebd837a372bcbdc394b0de982bebe620cae (patch)
tree3c4ea3f8621dbce715217e0808815117a7d099b6
parent403aa39e4e300d9e6c6c0d8b6b53d0da02d48252 (diff)
downloadcdo-0ceffebd837a372bcbdc394b0de982bebe620cae.zip
cdo-0ceffebd837a372bcbdc394b0de982bebe620cae.tar.gz
cdo-0ceffebd837a372bcbdc394b0de982bebe620cae.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons.sample/add.gifbin0 -> 274 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons.sample/add_obj.gifbin0 -> 318 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons.sample/edit/Kopie von doc_co.gifbin112 -> 79 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons.sample/time/synch_co.gifbin165 -> 164 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/etool16/open_editor.gifbin0 -> 367 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/etool16/open_session.gifbin0 -> 375 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor.gifbin0 -> 345 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor_historical.gifbin0 -> 367 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor_readonly.gifbin0 -> 369 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor_readwrite.gifbin0 -> 359 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/CDOUI.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/SharedIcons.java56
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsItemProvider.java18
-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.java91
15 files changed, 131 insertions, 53 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons.sample/add.gif b/plugins/org.eclipse.emf.cdo.ui/icons.sample/add.gif
new file mode 100644
index 0000000..7df3bfe
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons.sample/add.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons.sample/add_obj.gif b/plugins/org.eclipse.emf.cdo.ui/icons.sample/add_obj.gif
new file mode 100644
index 0000000..252d7eb
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons.sample/add_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons.sample/edit/Kopie von doc_co.gif b/plugins/org.eclipse.emf.cdo.ui/icons.sample/edit/Kopie von doc_co.gif
index 05ef403..52ef677 100644
--- a/plugins/org.eclipse.emf.cdo.ui/icons.sample/edit/Kopie von doc_co.gif
+++ b/plugins/org.eclipse.emf.cdo.ui/icons.sample/edit/Kopie von doc_co.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons.sample/time/synch_co.gif b/plugins/org.eclipse.emf.cdo.ui/icons.sample/time/synch_co.gif
index 5893bda..2069e1d 100644
--- a/plugins/org.eclipse.emf.cdo.ui/icons.sample/time/synch_co.gif
+++ b/plugins/org.eclipse.emf.cdo.ui/icons.sample/time/synch_co.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/full/etool16/open_editor.gif b/plugins/org.eclipse.emf.cdo.ui/icons/full/etool16/open_editor.gif
new file mode 100644
index 0000000..8838433
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/full/etool16/open_editor.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/full/etool16/open_session.gif b/plugins/org.eclipse.emf.cdo.ui/icons/full/etool16/open_session.gif
new file mode 100644
index 0000000..80d3143
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/full/etool16/open_session.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor.gif b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor.gif
new file mode 100644
index 0000000..acd9c16
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor_historical.gif b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor_historical.gif
new file mode 100644
index 0000000..dddb821
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor_historical.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor_readonly.gif b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor_readonly.gif
new file mode 100644
index 0000000..e5cc6b6
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor_readonly.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor_readwrite.gif b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor_readwrite.gif
new file mode 100644
index 0000000..93be7ea
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/cdo_editor_readwrite.gif
Binary files differ
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
index 688db5d..776bcf6 100644
--- 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
@@ -22,7 +22,7 @@ import org.eclipse.internal.net4j.util.om.OSGiActivator;
*/
public final class CDOUI
{
- public static final String BUNDLE_ID = "org.eclipse.net4j.container.ui"; //$NON-NLS-1$
+ public static final String BUNDLE_ID = "org.eclipse.emf.cdo.ui"; //$NON-NLS-1$
public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, CDOUI.class);
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
index 9adda86..2e1ef30 100644
--- 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
@@ -23,36 +23,59 @@ public class SharedIcons
{
private static final ImageRegistry REGISTRY = new ImageRegistry(getDisplay());
- private static final String OBJ = "icons/full/obj16/";
+ private static final String ETOOL = "etool16/";
- public static final ImageDescriptor OBJ_ACCEPTOR = getDescriptor(OBJ + "acceptor.gif");
+ private static final String OBJ = "obj16/";
- public static final ImageDescriptor OBJ_ADAPTER = getDescriptor(OBJ + "adapter.gif");
+ private static final String VIEW = "view16/";
- public static final ImageDescriptor OBJ_CHANNEL = getDescriptor(OBJ + "channel.gif");
+ public static final String ETOOL_OPEN_SESSION = ETOOL + "open_session";
- public static final ImageDescriptor OBJ_CONNECTOR = getDescriptor(OBJ + "connector.gif");
+ public static final String ETOOL_OPEN_EDITOR = ETOOL + "open_editor";
- public static final ImageDescriptor OBJ_FACTORY = getDescriptor(OBJ + "factory.gif");
+ public static final String OBJ_SESSION = OBJ + "cdo_session";
- public static final ImageDescriptor OBJ_FOLDER = getDescriptor(OBJ + "folder.gif");
+ public static final String OBJ_EDITOR = OBJ + "cdo_editor";
+
+ public static final String OBJ_EDITOR_READWRITE = OBJ + "cdo_editor_readwrite";
+
+ public static final String OBJ_EDITOR_READONLY = OBJ + "cdo_editor_readonly";
+
+ public static final String OBJ_EDITOR_HISTORICAL = OBJ + "cdo_editor_historical";
+
+ public static final String VIEW_SESSIONS = VIEW + "cdo_sessions";
public static Image getImage(String key)
{
- ImageDescriptor descriptor = getDescriptor(key);
- return descriptor.createImage();
+ key = mangleKey(key);
+ Image image = REGISTRY.get(key);
+ if (image == null)
+ {
+ createDescriptor(key);
+ image = REGISTRY.get(key);
+ }
+
+ return image;
}
public static ImageDescriptor getDescriptor(String key)
{
+ key = mangleKey(key);
ImageDescriptor descriptor = REGISTRY.getDescriptor(key);
if (descriptor == null)
{
- descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(CDOUI.BUNDLE_ID, key);
- if (descriptor != null)
- {
- REGISTRY.put(key, descriptor);
- }
+ descriptor = createDescriptor(key);
+ }
+
+ return descriptor;
+ }
+
+ private static ImageDescriptor createDescriptor(String key)
+ {
+ ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(CDOUI.BUNDLE_ID, key);
+ if (descriptor != null)
+ {
+ REGISTRY.put(key, descriptor);
}
return descriptor;
@@ -73,4 +96,9 @@ public class SharedIcons
return display;
}
+
+ private static String mangleKey(String key)
+ {
+ return "icons/full/" + key + ".gif";
+ }
}
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
index bfb6aa7..e9faa28 100644
--- 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
@@ -117,7 +117,23 @@ public class CDOSessionsItemProvider extends ItemProvider<CDOContainerAdapter> i
{
if (obj instanceof CDOSession)
{
- return SharedIcons.OBJ_CHANNEL.createImage();
+ return SharedIcons.getImage(SharedIcons.OBJ_SESSION);
+ }
+
+ if (obj instanceof CDOAdapter)
+ {
+ CDOAdapter adapter = (CDOAdapter)obj;
+ if (adapter.isHistorical())
+ {
+ return SharedIcons.getImage(SharedIcons.OBJ_EDITOR_HISTORICAL);
+ }
+
+ if (adapter.isReadOnly())
+ {
+ return SharedIcons.getImage(SharedIcons.OBJ_EDITOR_READONLY);
+ }
+
+ return SharedIcons.getImage(SharedIcons.OBJ_EDITOR);
}
return null;
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
deleted file mode 100644
index fd485dc..0000000
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsNameSorter.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/***************************************************************************
- * 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
index de608d4..a02971d 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
@@ -4,6 +4,7 @@ import org.eclipse.emf.cdo.CDOConstants;
import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.container.CDOContainerAdapter;
import org.eclipse.emf.cdo.internal.ui.bundle.CDOUI;
+import org.eclipse.emf.cdo.internal.ui.bundle.SharedIcons;
import org.eclipse.net4j.container.Container;
import org.eclipse.net4j.container.ContainerManager;
@@ -17,11 +18,10 @@ import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
public class CDOSessionsView extends StructuredView
{
@@ -35,7 +35,11 @@ public class CDOSessionsView extends StructuredView
private OpenSessionAction openSessionAction = new OpenSessionAction();
- private AttachAdapterAction attachAdapterAction = new AttachAdapterAction();
+ private OpenEditorAction openEditorAction = new OpenEditorAction();
+
+ private OpenEditorAction openEditorReadOnlyAction = new OpenEditorReadOnlyAction();
+
+ private OpenEditorAction openEditorHistoricalAction = new OpenEditorHistoricalAction();
public CDOSessionsView()
{
@@ -49,7 +53,7 @@ public class CDOSessionsView extends StructuredView
viewer.setContentProvider(ITEM_PROVIDER);
viewer.setLabelProvider(ITEM_PROVIDER);
- viewer.setSorter(new CDOSessionsNameSorter());
+ viewer.setSorter(new NameSorter());
viewer.setInput(CDO_ADAPTER);
}
@@ -68,8 +72,14 @@ public class CDOSessionsView extends StructuredView
Object element = selection.getFirstElement();
if (element instanceof CDOSession)
{
- attachAdapterAction.setSession((CDOSession)element);
- addContribution(manager, attachAdapterAction);
+ openEditorAction.setSession((CDOSession)element);
+ addContribution(manager, openEditorAction);
+
+ openEditorReadOnlyAction.setSession((CDOSession)element);
+ addContribution(manager, openEditorReadOnlyAction);
+
+ openEditorHistoricalAction.setSession((CDOSession)element);
+ addContribution(manager, openEditorHistoricalAction);
}
}
@@ -95,8 +105,8 @@ public class CDOSessionsView extends StructuredView
{
if (selectedElement instanceof CDOSession && !viewer.isExpandable(selectedElement))
{
- attachAdapterAction.setSession((CDOSession)selectedElement);
- attachAdapterAction.run();
+ openEditorAction.setSession((CDOSession)selectedElement);
+ openEditorAction.run();
}
else
{
@@ -104,6 +114,10 @@ public class CDOSessionsView extends StructuredView
}
}
+ private static final class NameSorter extends ViewerSorter
+ {
+ }
+
/**
* @author Eike Stepper
*/
@@ -113,8 +127,7 @@ public class CDOSessionsView extends StructuredView
{
setText("Open Session");
setToolTipText("Open a CDO session");
- setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
- ISharedImages.IMG_TOOL_NEW_WIZARD));
+ setImageDescriptor(SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_SESSION));
}
public void run()
@@ -138,21 +151,20 @@ public class CDOSessionsView extends StructuredView
/**
* @author Eike Stepper
*/
- private final class AttachAdapterAction extends Action
+ private class OpenEditorAction extends Action
{
private CDOSession session;
- public AttachAdapterAction()
+ public OpenEditorAction()
{
- setText("Attach Adapter");
- setToolTipText("Attach a CDO adapter");
- setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
- ISharedImages.IMG_TOOL_NEW_WIZARD));
+ this("Open Editor", "Open a CDO editor", SharedIcons.ETOOL_OPEN_EDITOR);
}
- public AttachAdapterAction(boolean readOnly)
+ protected OpenEditorAction(String text, String tooltip, String iconKey)
{
- this();
+ setText(text);
+ setToolTipText(tooltip);
+ setImageDescriptor(SharedIcons.getDescriptor(iconKey));
}
public CDOSession getSession()
@@ -170,13 +182,52 @@ public class CDOSessionsView extends StructuredView
{
try
{
- session.attach(new ResourceSetImpl());
+ openEditor(session);
}
catch (Exception ex)
{
CDOUI.LOG.error(ex);
- showMessage("Error while attaching adapter to session " + session);
+ showMessage("Error while opening editor on session " + session);
}
}
+
+ protected void openEditor(CDOSession session)
+ {
+ session.attach(new ResourceSetImpl());
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private class OpenEditorReadOnlyAction extends OpenEditorAction
+ {
+ public OpenEditorReadOnlyAction()
+ {
+ super("Open Editor in Read Only Mode", "Open a CDO editor in read only mode", null);
+ }
+
+ @Override
+ protected void openEditor(CDOSession session)
+ {
+ session.attach(new ResourceSetImpl(), true);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private class OpenEditorHistoricalAction extends OpenEditorAction
+ {
+ public OpenEditorHistoricalAction()
+ {
+ super("Open Editor in Historical Mode", "Open a CDO editor in historical mode", null);
+ }
+
+ @Override
+ protected void openEditor(CDOSession session)
+ {
+ session.attach(new ResourceSetImpl(), System.currentTimeMillis());
+ }
}
} \ No newline at end of file