Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fluegge2011-09-25 13:42:49 +0000
committerMartin Fluegge2011-09-25 13:42:49 +0000
commit9eec85bb8884ca82791f1f8bc4bb00f2f0d4af34 (patch)
tree0f7f60dd84b4f7b019cf3897afd3f2d98cb67869 /plugins/org.eclipse.emf.cdo.dawn.emf
parent4e7428cad8fb510b7b1dea2a6bf46105457f76cd (diff)
downloadcdo-9eec85bb8884ca82791f1f8bc4bb00f2f0d4af34.tar.gz
cdo-9eec85bb8884ca82791f1f8bc4bb00f2f0d4af34.tar.xz
cdo-9eec85bb8884ca82791f1f8bc4bb00f2f0d4af34.zip
[319486] [Dawn] Implement locking mechanism for extended editors
https://bugs.eclipse.org/bugs/show_bug.cgi?id=319486
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn.emf')
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.emf/src/org/eclipse/emf/cdo/dawn/emf/editors/impl/DawnEMFEditorSupport.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.emf/src/org/eclipse/emf/cdo/dawn/emf/notifications/impl/DawnEMFLockingHandler.java40
2 files changed, 16 insertions, 51 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.emf/src/org/eclipse/emf/cdo/dawn/emf/editors/impl/DawnEMFEditorSupport.java b/plugins/org.eclipse.emf.cdo.dawn.emf/src/org/eclipse/emf/cdo/dawn/emf/editors/impl/DawnEMFEditorSupport.java
index 1568d646ab..0da1605dd8 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.emf/src/org/eclipse/emf/cdo/dawn/emf/editors/impl/DawnEMFEditorSupport.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.emf/src/org/eclipse/emf/cdo/dawn/emf/editors/impl/DawnEMFEditorSupport.java
@@ -15,6 +15,7 @@ import org.eclipse.emf.cdo.dawn.editors.impl.DawnAbstractEditorSupport;
import org.eclipse.emf.cdo.dawn.emf.notifications.impl.DawnEMFHandler;
import org.eclipse.emf.cdo.dawn.emf.notifications.impl.DawnEMFLockingHandler;
import org.eclipse.emf.cdo.dawn.notifications.BasicDawnListener;
+import org.eclipse.emf.cdo.dawn.spi.DawnState;
import org.eclipse.emf.cdo.transaction.CDOTransactionHandlerBase;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.view.CDOView;
@@ -22,6 +23,8 @@ import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.emf.common.ui.viewer.IViewerProvider;
import org.eclipse.emf.ecore.EObject;
+import java.util.Map;
+
/**
* @author Martin Fluegge
* @since 1.0
@@ -42,19 +45,6 @@ public class DawnEMFEditorSupport extends DawnAbstractEditorSupport
}
}
- // public void registerListeners()
- // {
- // BasicDawnListener listener = new DawnEMFHandler(getEditor());
- // CDOView view = getView();
- // view.addListener(listener);
- //
- // if (view instanceof CDOTransaction)
- // {
- // CDOTransaction transaction = (CDOTransaction)view;
- // transaction.options().addChangeSubscriptionPolicy(CDOAdapterPolicy.CDO);
- // }
- // }
-
@Override
protected BasicDawnListener getBasicHandler()
{
@@ -99,4 +89,15 @@ public class DawnEMFEditorSupport extends DawnAbstractEditorSupport
CDOUtil.getCDOObject((EObject)objectToBeUnlocked).cdoWriteLock().unlock();
refresh();
}
+
+ public void handleRemoteLockChanges(Map<Object, DawnState> changedObjects)
+ {
+ getEditor().getSite().getShell().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ refresh();
+ }
+ });
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.emf/src/org/eclipse/emf/cdo/dawn/emf/notifications/impl/DawnEMFLockingHandler.java b/plugins/org.eclipse.emf.cdo.dawn.emf/src/org/eclipse/emf/cdo/dawn/emf/notifications/impl/DawnEMFLockingHandler.java
index fc6f21d4d7..36c5da2ddc 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.emf/src/org/eclipse/emf/cdo/dawn/emf/notifications/impl/DawnEMFLockingHandler.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.emf/src/org/eclipse/emf/cdo/dawn/emf/notifications/impl/DawnEMFLockingHandler.java
@@ -11,51 +11,15 @@
package org.eclipse.emf.cdo.dawn.emf.notifications.impl;
import org.eclipse.emf.cdo.dawn.editors.IDawnEditor;
-import org.eclipse.emf.cdo.dawn.notifications.BasicDawnListener;
-import org.eclipse.emf.cdo.transaction.CDOTransactionConflictEvent;
-import org.eclipse.emf.cdo.view.CDOViewInvalidationEvent;
-import org.eclipse.emf.cdo.view.CDOViewLocksChangedEvent;
-
-import org.eclipse.net4j.util.event.IEvent;
-
-import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+import org.eclipse.emf.cdo.dawn.notifications.BasicDawnLockingHandler;
/**
* @author Martin Fluegge
*/
-public class DawnEMFLockingHandler extends BasicDawnListener
+public class DawnEMFLockingHandler extends BasicDawnLockingHandler
{
public DawnEMFLockingHandler(IDawnEditor editor)
{
super(editor);
}
-
- public void handleViewInvalidationEvent(CDOViewInvalidationEvent event)
- {
- System.out.println("DawnEMFLockingHandler.handleViewInvalidationEvent()");
- }
-
- public void handleTransactionConflictEvent(CDOTransactionConflictEvent event)
- {
- System.out.println("DawnEMFLockingHandler.handleTransactionConflictEvent()");
- }
-
- public void handleEvent(IEvent event)
- {
- if (event instanceof CDOViewLocksChangedEvent)
- {
- refreshEditor();
- }
- }
-
- private void refreshEditor()
- {
- editor.getSite().getShell().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- ((IViewerProvider)editor).getViewer().refresh();
- }
- });
- }
}

Back to the top