Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java')
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java33
1 files changed, 33 insertions, 0 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 85e555424c..9228fff853 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
@@ -13,6 +13,7 @@
package org.eclipse.emf.cdo.internal.ui.editor;
import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
@@ -32,6 +33,7 @@ import org.eclipse.emf.cdo.ui.shared.SharedIcons;
import org.eclipse.emf.cdo.util.CDOURIUtil;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.util.ValidationException;
+import org.eclipse.emf.cdo.view.CDOObjectHandler;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.emf.internal.cdo.view.CDOStateMachine;
@@ -225,6 +227,20 @@ public class CDOEditor extends MultiPageEditorPart
protected CDOEventHandler eventHandler;
/**
+ * @ADDED
+ */
+ protected CDOObjectHandler objectHandler = new CDOObjectHandler()
+ {
+ public void objectStateChanged(CDOView view, CDOObject object, CDOState oldState, CDOState newState)
+ {
+ if (object == viewerInput && newState == CDOState.INVALID)
+ {
+ closeEditor();
+ }
+ }
+ };
+
+ /**
* This keeps track of the editing domain that is used to track all changes to the model.
* <!-- begin-user-doc --> <!--
* end-user-doc -->
@@ -1041,6 +1057,11 @@ public class CDOEditor extends MultiPageEditorPart
{
URI resourceURI = CDOURIUtil.createResourceURI(view, resourcePath);
viewerInput = resourceSet.getResource(resourceURI, true);
+
+ if (!view.isReadOnly())
+ {
+ view.addObjectHandler(objectHandler);
+ }
}
// resourceSet.eAdapters().add(problemIndicationAdapter);
@@ -2176,6 +2197,18 @@ public class CDOEditor extends MultiPageEditorPart
{
try
{
+ if (objectHandler != null)
+ {
+ view.removeObjectHandler(objectHandler);
+ }
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
+
+ try
+ {
if (eventHandler != null)
{
eventHandler.dispose();

Back to the top