summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-07 00:30:27 (EDT)
committerEike Stepper2007-10-07 00:30:27 (EDT)
commit824fee0545cbddf45180f2efb84aa764d92a29cc (patch)
tree8c628eaed9ba6b91fff198e8ac0b48b869395221
parentf076658554d3703b458548a66d8cde16655b1a0a (diff)
downloadcdo-824fee0545cbddf45180f2efb84aa764d92a29cc.zip
cdo-824fee0545cbddf45180f2efb84aa764d92a29cc.tar.gz
cdo-824fee0545cbddf45180f2efb84aa764d92a29cc.tar.bz2
[205651] Implement transaction rollback
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205651
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CommitTransactionAction.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateCommitAction.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateRollbackAction.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java7
4 files changed, 81 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CommitTransactionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CommitTransactionAction.java
new file mode 100644
index 0000000..cc9aa10
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CommitTransactionAction.java
@@ -0,0 +1,25 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOView;
+
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CommitTransactionAction extends ViewAction
+{
+ private static final String TITLE = "Commit";
+
+ public CommitTransactionAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, TITLE, "Commit this transaction", null, view);
+ setEnabled(getTransaction().isDirty());
+ }
+
+ @Override
+ protected void doRun() throws Exception
+ {
+ getTransaction().commit();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateCommitAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateCommitAction.java
new file mode 100644
index 0000000..1b0cc58
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateCommitAction.java
@@ -0,0 +1,25 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOView;
+
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CreateCommitAction extends ViewAction
+{
+ private static final String TITLE = "Commit";
+
+ public CreateCommitAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, TITLE, "Commit this transaction", null, view);
+ setEnabled(getTransaction().isDirty());
+ }
+
+ @Override
+ protected void doRun() throws Exception
+ {
+ getTransaction().commit();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateRollbackAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateRollbackAction.java
new file mode 100644
index 0000000..18bdd29
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateRollbackAction.java
@@ -0,0 +1,25 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOView;
+
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CreateRollbackAction extends ViewAction
+{
+ private static final String TITLE = "Rollback";
+
+ public CreateRollbackAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, TITLE, "Rollback this transaction", null, view);
+ setEnabled(getTransaction().isDirty());
+ }
+
+ @Override
+ protected void doRun() throws Exception
+ {
+ getTransaction().rollback();
+ }
+} \ 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 563e499..b204523 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
@@ -20,7 +20,9 @@ import org.eclipse.emf.cdo.CDOViewEvent;
import org.eclipse.emf.cdo.internal.ui.SharedIcons;
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.CreateCommitAction;
import org.eclipse.emf.cdo.internal.ui.actions.CreateResourceAction;
+import org.eclipse.emf.cdo.internal.ui.actions.CreateRollbackAction;
import org.eclipse.emf.cdo.internal.ui.actions.LoadResourceAction;
import org.eclipse.emf.cdo.internal.ui.actions.ManagePackagesAction;
import org.eclipse.emf.cdo.internal.ui.actions.OpenAuditAction;
@@ -281,13 +283,16 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>>
protected void fillView(IMenuManager manager, CDOView view)
{
+ manager.add(new OpenViewEditorAction(page, view));
manager.add(new LoadResourceAction(page, view));
+ manager.add(new Separator());
if (view.getViewType() == CDOView.Type.TRANSACTION)
{
manager.add(new CreateResourceAction(page, view));
+ manager.add(new CreateCommitAction(page, view));
+ manager.add(new CreateRollbackAction(page, view));
}
- manager.add(new OpenViewEditorAction(page, view));
manager.add(new Separator());
manager.add(new CloseViewAction(page, view));
}