Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'cdo/bundles/uml/org.eclipse.uml2.uml.cdo/src/org/eclipse/uml2/uml/cdo/internal/util/CDOElementImpl.java')
-rw-r--r--cdo/bundles/uml/org.eclipse.uml2.uml.cdo/src/org/eclipse/uml2/uml/cdo/internal/util/CDOElementImpl.java52
1 files changed, 52 insertions, 0 deletions
diff --git a/cdo/bundles/uml/org.eclipse.uml2.uml.cdo/src/org/eclipse/uml2/uml/cdo/internal/util/CDOElementImpl.java b/cdo/bundles/uml/org.eclipse.uml2.uml.cdo/src/org/eclipse/uml2/uml/cdo/internal/util/CDOElementImpl.java
new file mode 100644
index 00000000..0a03655d
--- /dev/null
+++ b/cdo/bundles/uml/org.eclipse.uml2.uml.cdo/src/org/eclipse/uml2/uml/cdo/internal/util/CDOElementImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2018 CEA, and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ *
+ */
+package org.eclipse.uml2.uml.cdo.internal.util;
+
+import org.eclipse.uml2.common.util.CacheAdapter;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class CDOElementImpl
+ extends org.eclipse.emf.cdo.ecore.impl.EModelElementImpl
+ implements Element {
+
+ protected CDOElementImpl() {
+ super();
+ }
+
+ @Override
+ public void cdoInternalPreAttach() {
+ try {
+ CacheAdapter cacheAdapter = getCacheAdapter();
+ if (cacheAdapter != null) {
+ eAdapters().remove(cacheAdapter);
+ }
+ } finally {
+ super.cdoInternalPreAttach();
+ }
+ }
+
+ protected abstract CacheAdapter getCacheAdapter();
+
+ static {
+ CacheAdapter cacheAdapter = CacheAdapter.getInstance();
+ if (cacheAdapter.getClass() != CDOCacheAdapter.class) {
+ if (!Boolean.getBoolean(
+ "org.eclipse.uml2.uml.cdo.internal.impl.ElementImpl.noCDOCacheAdapter")) {
+ CDOCacheAdapter.register(new CDOCacheAdapter());
+ }
+ }
+ }
+
+}

Back to the top