summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-16 11:17:39 (EDT)
committerEike Stepper2007-07-16 11:17:39 (EDT)
commit0349c6691b715480880d58b48d880d790e3a3e91 (patch)
treea61b2c1171836ba801179539febc466bcbc21b61
parent6315958b766080fa8c6dbabe5344767bac5303b1 (diff)
downloadcdo-0349c6691b715480880d58b48d880d790e3a3e91.zip
cdo-0349c6691b715480880d58b48d880d790e3a3e91.tar.gz
cdo-0349c6691b715480880d58b48d880d790e3a3e91.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseViewAction.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceAction.java44
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EntryAction.java29
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/LoadResourceAction.java43
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenHistoricalViewAction.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SessionAction.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ShowEntryAction.java30
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ShowViewAction.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ViewAction.java29
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java271
14 files changed, 364 insertions, 264 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
index e9c3854..569d9d1 100644
--- a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
@@ -15,7 +15,9 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.cdo;visibility:=reexport,
org.eclipse.emf.cdo.edit,
org.eclipse.emf.cdo.server.db
-Export-Package: org.eclipse.emf.cdo.internal.ui.editor;version="0.8.0",
+Export-Package: org.eclipse.emf.cdo.internal.ui;version="0.8.0",
+ org.eclipse.emf.cdo.internal.ui.actions;version="0.8.0",
+ org.eclipse.emf.cdo.internal.ui.editor;version="0.8.0",
org.eclipse.emf.cdo.internal.ui.views;version="0.8.0",
org.eclipse.emf.cdo.internal.ui.wizards;version="0.8.0",
org.eclipse.emf.cdo.internal.ui.wizards.steps;version="0.8.0"
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java
new file mode 100644
index 0000000..84a60e1
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java
@@ -0,0 +1,23 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOSession;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CloseSessionAction extends SessionAction
+{
+ public CloseSessionAction(IWorkbenchPage page, CDOSession session)
+ {
+ super(page, "Close", "Close the CDO session", null, session);
+ }
+
+ @Override
+ protected void doRun(final IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ {
+ getSession().close();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseViewAction.java
new file mode 100644
index 0000000..17e8d51
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseViewAction.java
@@ -0,0 +1,23 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOView;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CloseViewAction extends ViewAction
+{
+ public CloseViewAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, "Close", "Close the CDO view", null, view);
+ }
+
+ @Override
+ protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ {
+ getView().close();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceAction.java
new file mode 100644
index 0000000..5e1498e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceAction.java
@@ -0,0 +1,44 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOView;
+import org.eclipse.emf.cdo.internal.ui.editor.CDOEditor;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CreateResourceAction extends ViewAction
+{
+ private String resourcePath;
+
+ public CreateResourceAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, "Create Resource", "Create a CDO resource", null, view);
+ }
+
+ @Override
+ protected void preRun(IWorkbenchPage page) throws Exception
+ {
+ InputDialog dialog = new InputDialog(page.getWorkbenchWindow().getShell(), "Create Resource",
+ "Enter resource path:", "/res" + (ViewAction.lastResourceNumber + 1), null);
+ if (dialog.open() == InputDialog.OK)
+ {
+ ++ViewAction.lastResourceNumber;
+ resourcePath = dialog.getValue();
+ }
+ else
+ {
+ cancel();
+ }
+ }
+
+ @Override
+ protected void doRun(final IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ {
+ getView().createResource(resourcePath);
+ CDOEditor.open(page, getView(), resourcePath);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EntryAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EntryAction.java
new file mode 100644
index 0000000..7e4d483
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EntryAction.java
@@ -0,0 +1,29 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.views.CDOViewHistory;
+import org.eclipse.emf.cdo.internal.ui.views.CDOViewHistory.Entry;
+
+import org.eclipse.net4j.ui.actions.LongRunningAction;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class EntryAction extends LongRunningAction
+{
+ private CDOViewHistory.Entry entry;
+
+ public EntryAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image,
+ CDOViewHistory.Entry entry)
+ {
+ super(page, text, toolTipText, image);
+ this.entry = entry;
+ }
+
+ public CDOViewHistory.Entry getEntry()
+ {
+ return entry;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/LoadResourceAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/LoadResourceAction.java
new file mode 100644
index 0000000..ed4b2ed
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/LoadResourceAction.java
@@ -0,0 +1,43 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOView;
+import org.eclipse.emf.cdo.internal.ui.editor.CDOEditor;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class LoadResourceAction extends ViewAction
+{
+ private String resourcePath;
+
+ public LoadResourceAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, "Load Resource", "Load a CDO resource", null, view);
+ }
+
+ @Override
+ protected void preRun(IWorkbenchPage page) throws Exception
+ {
+ String uri = ViewAction.lastResourceNumber == 0 ? "" : "/res" + ViewAction.lastResourceNumber;
+ InputDialog dialog = new InputDialog(page.getWorkbenchWindow().getShell(), "Load Resource",
+ "Enter resource path:", uri, null);
+ if (dialog.open() == InputDialog.OK)
+ {
+ resourcePath = dialog.getValue();
+ }
+ else
+ {
+ cancel();
+ }
+ }
+
+ @Override
+ protected void doRun(final IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ {
+ CDOEditor.open(page, getView(), resourcePath);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenHistoricalViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenHistoricalViewAction.java
new file mode 100644
index 0000000..caa006f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenHistoricalViewAction.java
@@ -0,0 +1,27 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOSession;
+import org.eclipse.emf.cdo.internal.ui.SharedIcons;
+import org.eclipse.emf.cdo.internal.ui.views.CDOItemProvider;
+
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class OpenHistoricalViewAction extends SessionAction
+{
+ public OpenHistoricalViewAction(IWorkbenchPage page, CDOSession session)
+ {
+ super(page, "Open Historical View", "Open a historical CDO view", SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_EDITOR), session);
+ }
+
+ @Override
+ protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ {
+ getSession().openView(new ResourceSetImpl(), System.currentTimeMillis());
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java
new file mode 100644
index 0000000..6ef4079
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java
@@ -0,0 +1,27 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOSession;
+import org.eclipse.emf.cdo.internal.ui.SharedIcons;
+import org.eclipse.emf.cdo.internal.ui.views.CDOItemProvider;
+
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class OpenTransactionAction extends SessionAction
+{
+ public OpenTransactionAction(IWorkbenchPage page, CDOSession session)
+ {
+ super(page, "Open Transaction", "Open a CDO transaction", SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_EDITOR), session);
+ }
+
+ @Override
+ protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ {
+ getSession().openView(new ResourceSetImpl());
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java
new file mode 100644
index 0000000..807708a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java
@@ -0,0 +1,27 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOSession;
+import org.eclipse.emf.cdo.internal.ui.SharedIcons;
+import org.eclipse.emf.cdo.internal.ui.views.CDOItemProvider;
+
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class OpenViewAction extends SessionAction
+{
+ public OpenViewAction(IWorkbenchPage page, CDOSession session)
+ {
+ super(page, "Open View", "Open a CDO view", SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_EDITOR), session);
+ }
+
+ @Override
+ protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ {
+ getSession().openView(new ResourceSetImpl(), true);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SessionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SessionAction.java
new file mode 100644
index 0000000..f8481b2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SessionAction.java
@@ -0,0 +1,27 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOSession;
+
+import org.eclipse.net4j.ui.actions.LongRunningAction;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class SessionAction extends LongRunningAction
+{
+ private CDOSession session;
+
+ public SessionAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image, CDOSession session)
+ {
+ super(page, text, toolTipText, image);
+ this.session = session;
+ }
+
+ public CDOSession getSession()
+ {
+ return session;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ShowEntryAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ShowEntryAction.java
new file mode 100644
index 0000000..d611824
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ShowEntryAction.java
@@ -0,0 +1,30 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOView;
+import org.eclipse.emf.cdo.internal.ui.editor.CDOEditor;
+import org.eclipse.emf.cdo.internal.ui.views.CDOViewHistory;
+import org.eclipse.emf.cdo.internal.ui.views.CDOViewHistory.Entry;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class ShowEntryAction extends EntryAction
+{
+ public ShowEntryAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image,
+ CDOViewHistory.Entry entry)
+ {
+ super(page, "Show Editor", "Show a CDO editor", null, entry);
+ }
+
+ @Override
+ protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ {
+ CDOView view = getEntry().getView();
+ String resourcePath = getEntry().getResourcePath();
+ CDOEditor.open(page, view, resourcePath);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ShowViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ShowViewAction.java
new file mode 100644
index 0000000..f13fed4
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ShowViewAction.java
@@ -0,0 +1,24 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOView;
+import org.eclipse.emf.cdo.internal.ui.editor.CDOEditor;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class ShowViewAction extends ViewAction
+{
+ public ShowViewAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, "Show Editor", "Show a CDO editor", null, view);
+ }
+
+ @Override
+ protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ {
+ CDOEditor.open(page, getView(), null);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ViewAction.java
new file mode 100644
index 0000000..0f75d38
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ViewAction.java
@@ -0,0 +1,29 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOView;
+
+import org.eclipse.net4j.ui.actions.LongRunningAction;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class ViewAction extends LongRunningAction
+{
+ protected static int lastResourceNumber = 0;
+
+ private CDOView view;
+
+ public ViewAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image, CDOView view)
+ {
+ super(page, text, toolTipText, image);
+ this.view = view;
+ }
+
+ public CDOView getView()
+ {
+ return view;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java
index cb892a9..e9c4dec 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java
@@ -16,22 +16,25 @@ import org.eclipse.emf.cdo.CDOViewCommittedEvent;
import org.eclipse.emf.cdo.CDOViewDirtyEvent;
import org.eclipse.emf.cdo.CDOViewEvent;
import org.eclipse.emf.cdo.internal.ui.SharedIcons;
-import org.eclipse.emf.cdo.internal.ui.editor.CDOEditor;
+import org.eclipse.emf.cdo.internal.ui.actions.CloseSessionAction;
+import org.eclipse.emf.cdo.internal.ui.actions.CloseViewAction;
+import org.eclipse.emf.cdo.internal.ui.actions.CreateResourceAction;
+import org.eclipse.emf.cdo.internal.ui.actions.LoadResourceAction;
+import org.eclipse.emf.cdo.internal.ui.actions.OpenHistoricalViewAction;
+import org.eclipse.emf.cdo.internal.ui.actions.OpenTransactionAction;
+import org.eclipse.emf.cdo.internal.ui.actions.OpenViewAction;
+import org.eclipse.emf.cdo.internal.ui.actions.ShowViewAction;
import org.eclipse.emf.cdo.internal.ui.views.CDOViewHistory.Entry;
import org.eclipse.net4j.IConnector;
-import org.eclipse.net4j.ui.actions.LongRunningAction;
import org.eclipse.net4j.ui.views.ContainerItemProvider;
import org.eclipse.net4j.ui.views.IElementFilter;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.swt.graphics.Image;
@@ -108,8 +111,6 @@ public class CDOItemProvider extends ContainerItemProvider
}
};
- private static int lastResourceNumber = 0;
-
public CDOItemProvider(IWorkbenchPage page, IElementFilter rootElementFilter)
{
super(rootElementFilter);
@@ -322,260 +323,4 @@ public class CDOItemProvider extends ContainerItemProvider
history.dispose();
}
}
-
- public static ImageDescriptor getOpenEditorImageDescriptor()
- {
- return SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_EDITOR);
- }
-
- /**
- * @author Eike Stepper
- */
- public static abstract class SessionAction extends LongRunningAction
- {
- private CDOSession session;
-
- public SessionAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image, CDOSession session)
- {
- super(page, text, toolTipText, image);
- this.session = session;
- }
-
- public CDOSession getSession()
- {
- return session;
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class OpenTransactionAction extends SessionAction
- {
- public OpenTransactionAction(IWorkbenchPage page, CDOSession session)
- {
- super(page, "Open Transaction", "Open a CDO transaction", getOpenEditorImageDescriptor(), session);
- }
-
- @Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
- {
- getSession().openView(new ResourceSetImpl());
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class OpenViewAction extends SessionAction
- {
- public OpenViewAction(IWorkbenchPage page, CDOSession session)
- {
- super(page, "Open View", "Open a CDO view", getOpenEditorImageDescriptor(), session);
- }
-
- @Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
- {
- getSession().openView(new ResourceSetImpl(), true);
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class OpenHistoricalViewAction extends SessionAction
- {
- public OpenHistoricalViewAction(IWorkbenchPage page, CDOSession session)
- {
- super(page, "Open Historical View", "Open a historical CDO view", getOpenEditorImageDescriptor(), session);
- }
-
- @Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
- {
- getSession().openView(new ResourceSetImpl(), System.currentTimeMillis());
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class CloseSessionAction extends SessionAction
- {
- public CloseSessionAction(IWorkbenchPage page, CDOSession session)
- {
- super(page, "Close", "Close the CDO session", null, session);
- }
-
- @Override
- protected void doRun(final IWorkbenchPage page, IProgressMonitor monitor) throws Exception
- {
- getSession().close();
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static abstract class ViewAction extends LongRunningAction
- {
- private CDOView view;
-
- public ViewAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image, CDOView view)
- {
- super(page, text, toolTipText, image);
- this.view = view;
- }
-
- public CDOView getView()
- {
- return view;
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class LoadResourceAction extends ViewAction
- {
- private String resourcePath;
-
- public LoadResourceAction(IWorkbenchPage page, CDOView view)
- {
- super(page, "Load Resource", "Load a CDO resource", null, view);
- }
-
- @Override
- protected void preRun(IWorkbenchPage page) throws Exception
- {
- String uri = lastResourceNumber == 0 ? "" : "/res" + lastResourceNumber;
- InputDialog dialog = new InputDialog(page.getWorkbenchWindow().getShell(), "Load Resource",
- "Enter resource path:", uri, null);
- if (dialog.open() == InputDialog.OK)
- {
- resourcePath = dialog.getValue();
- }
- else
- {
- cancel();
- }
- }
-
- @Override
- protected void doRun(final IWorkbenchPage page, IProgressMonitor monitor) throws Exception
- {
- CDOEditor.open(page, getView(), resourcePath);
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class CreateResourceAction extends ViewAction
- {
- private String resourcePath;
-
- public CreateResourceAction(IWorkbenchPage page, CDOView view)
- {
- super(page, "Create Resource", "Create a CDO resource", null, view);
- }
-
- @Override
- protected void preRun(IWorkbenchPage page) throws Exception
- {
- InputDialog dialog = new InputDialog(page.getWorkbenchWindow().getShell(), "Create Resource",
- "Enter resource path:", "/res" + (lastResourceNumber + 1), null);
- if (dialog.open() == InputDialog.OK)
- {
- ++lastResourceNumber;
- resourcePath = dialog.getValue();
- }
- else
- {
- cancel();
- }
- }
-
- @Override
- protected void doRun(final IWorkbenchPage page, IProgressMonitor monitor) throws Exception
- {
- getView().createResource(resourcePath);
- CDOEditor.open(page, getView(), resourcePath);
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class ShowViewAction extends ViewAction
- {
- public ShowViewAction(IWorkbenchPage page, CDOView view)
- {
- super(page, "Show Editor", "Show a CDO editor", null, view);
- }
-
- @Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
- {
- CDOEditor.open(page, getView(), null);
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class CloseViewAction extends ViewAction
- {
- public CloseViewAction(IWorkbenchPage page, CDOView view)
- {
- super(page, "Close", "Close the CDO view", null, view);
- }
-
- @Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
- {
- getView().close();
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static abstract class EntryAction extends LongRunningAction
- {
- private CDOViewHistory.Entry entry;
-
- public EntryAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image,
- CDOViewHistory.Entry entry)
- {
- super(page, text, toolTipText, image);
- this.entry = entry;
- }
-
- public CDOViewHistory.Entry getEntry()
- {
- return entry;
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class ShowEntryAction extends EntryAction
- {
- public ShowEntryAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image,
- CDOViewHistory.Entry entry)
- {
- super(page, "Show Editor", "Show a CDO editor", null, entry);
- }
-
- @Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
- {
- CDOView view = getEntry().getView();
- String resourcePath = getEntry().getResourcePath();
- CDOEditor.open(page, view, resourcePath);
- }
- }
}