summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-07 07:37:16 (EDT)
committerEike Stepper2007-10-07 07:37:16 (EDT)
commitf30d8b750ca1a7c7c12140ed0fc192b1062a7f29 (patch)
treeb9d37b89a4c67ef7cd932160c69e969dbad2b74c
parent8af81db67ba8decc2607d2ae0f890b95eae1a5f2 (diff)
downloadcdo-f30d8b750ca1a7c7c12140ed0fc192b1062a7f29.zip
cdo-f30d8b750ca1a7c7c12140ed0fc192b1062a7f29.tar.gz
cdo-f30d8b750ca1a7c7c12140ed0fc192b1062a7f29.tar.bz2
[205650] Add transaction conflict resolution handling
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205650
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOLabelProvider.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOEventHandler.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java16
4 files changed, 45 insertions, 8 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
index a96d2d0..0129734 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
@@ -6,6 +6,7 @@
*/
package org.eclipse.emf.cdo.internal.ui.editor;
+import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOTransaction;
import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.eresource.CDOResource;
@@ -1197,6 +1198,30 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
}
@Override
+ protected void viewConflict(final CDOObject conflictingObject, boolean firstConflict)
+ {
+ try
+ {
+ selectionViewer.getControl().getDisplay().syncExec(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ selectionViewer.refresh(conflictingObject, true);
+ }
+ catch (Exception ignore)
+ {
+ }
+ }
+ });
+ }
+ catch (Exception ignore)
+ {
+ }
+ }
+
+ @Override
protected void viewClosed()
{
closeEditor();
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOLabelProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOLabelProvider.java
index 003f21d..af4d0fe 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOLabelProvider.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOLabelProvider.java
@@ -140,6 +140,7 @@ public class CDOLabelProvider extends AdapterFactoryLabelProvider implements ICo
{
case NEW:
case DIRTY:
+ case CONFLICT:
return bold;
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOEventHandler.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOEventHandler.java
index 0b3a4e5..56ed02f 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOEventHandler.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOEventHandler.java
@@ -10,7 +10,9 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.ui.views;
+import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOSessionInvalidationEvent;
+import org.eclipse.emf.cdo.CDOTransactionConflictEvent;
import org.eclipse.emf.cdo.CDOTransactionFinishedEvent;
import org.eclipse.emf.cdo.CDOTransactionStartedEvent;
import org.eclipse.emf.cdo.CDOView;
@@ -118,6 +120,11 @@ public class CDOEventHandler
{
viewDirtyStateChanged();
}
+ else if (event instanceof CDOTransactionConflictEvent)
+ {
+ CDOTransactionConflictEvent e = (CDOTransactionConflictEvent)event;
+ viewConflict(e.getConflictingObject(), e.isFirstConflict());
+ }
}
};
@@ -173,6 +180,10 @@ public class CDOEventHandler
{
}
+ protected void viewConflict(CDOObject conflictingObject, boolean firstConflict)
+ {
+ }
+
protected void viewClosed()
{
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
index 5354b4d..74889bd 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
@@ -98,14 +98,14 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent
init(CDOState.PROXY, CDOEvent.INVALIDATE, IGNORE);
init(CDOState.PROXY, CDOEvent.FINALIZE_ATTACH, IGNORE);
- init(CDOState.CONFLICT, CDOEvent.ATTACH, FAIL);
- init(CDOState.CONFLICT, CDOEvent.DETACH, FAIL);
- init(CDOState.CONFLICT, CDOEvent.READ, FAIL);
- init(CDOState.CONFLICT, CDOEvent.WRITE, FAIL);
- init(CDOState.CONFLICT, CDOEvent.COMMIT, FAIL);
- init(CDOState.CONFLICT, CDOEvent.ROLLBACK, FAIL);
- init(CDOState.CONFLICT, CDOEvent.INVALIDATE, FAIL);
- init(CDOState.CONFLICT, CDOEvent.FINALIZE_ATTACH, FAIL);
+ init(CDOState.CONFLICT, CDOEvent.ATTACH, IGNORE);
+ init(CDOState.CONFLICT, CDOEvent.DETACH, IGNORE);
+ init(CDOState.CONFLICT, CDOEvent.READ, IGNORE);
+ init(CDOState.CONFLICT, CDOEvent.WRITE, IGNORE);
+ init(CDOState.CONFLICT, CDOEvent.COMMIT, IGNORE);
+ init(CDOState.CONFLICT, CDOEvent.ROLLBACK, new RollbackTransition());
+ init(CDOState.CONFLICT, CDOEvent.INVALIDATE, IGNORE);
+ init(CDOState.CONFLICT, CDOEvent.FINALIZE_ATTACH, IGNORE);
}
public void attach(InternalCDOObject object, CDOResource resource, CDOViewImpl view)