Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-05-27 16:12:52 +0000
committerChristian W. Damus2016-05-27 20:37:23 +0000
commit32b629f6eee305519a62f4af0e52c2c8670eb902 (patch)
tree9199f14e32f61aa609241db07bbcc651cfb7cf1b /plugins
parent291c79f868c691c03d0a1688e6c3c6929b0cc019 (diff)
downloadorg.eclipse.papyrus-32b629f6eee305519a62f4af0e52c2c8670eb902.tar.gz
org.eclipse.papyrus-32b629f6eee305519a62f4af0e52c2c8670eb902.tar.xz
org.eclipse.papyrus-32b629f6eee305519a62f4af0e52c2c8670eb902.zip
Bug 436665: [CSS] Refresh issue when an element is moved to a different owner
https://bugs.eclipse.org/bugs/show_bug.cgi?id=436665 Ensure that the element-adapter containment is refreshed whenever notation view containment changes. As a related (similar) problem, also fix stale CSS Engines without parent engine (or other important state) remaining on some notation views that had initialized their CSS support during creation of a diagram, before it was attached to the resource (therefore not having the Model Engine). The root diagram would replace its engine on attachment to the resource, but not its contained views. Change-Id: Iaf1c56f7b1b0d64d11d8245cd846b3fef8722a49
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSBasicCompartmentImpl.java12
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSConnectorImpl.java12
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDecorationNodeImpl.java12
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEdgeImpl.java12
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSNodeImpl.java12
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSShapeImpl.java12
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSView.java25
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java32
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/StyleListener.java53
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagramImpl.java24
10 files changed, 174 insertions, 32 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSBasicCompartmentImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSBasicCompartmentImpl.java
index 98c0fee4d58..47450fc17c1 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSBasicCompartmentImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSBasicCompartmentImpl.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012, 2015 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,7 +8,7 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 433206
+ * Christian W. Damus - bugs 433206, 436665
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css;
@@ -26,7 +26,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSView;
import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSDrawerStyleDelegate;
import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSViewDelegate;
-public class CSSBasicCompartmentImpl extends BasicCompartmentImpl implements CSSDrawerStyle, CSSView {
+public class CSSBasicCompartmentImpl extends BasicCompartmentImpl implements CSSDrawerStyle, CSSView.Internal {
protected ExtendedCSSEngine engine;
@@ -54,6 +54,12 @@ public class CSSBasicCompartmentImpl extends BasicCompartmentImpl implements CSS
}
return cssView;
}
+
+ @Override
+ public void resetCSS() {
+ cssView = null;
+ engine = null;
+ }
// ////////////////////////////////////////
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSConnectorImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSConnectorImpl.java
index 85dec63d6c5..3434acef452 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSConnectorImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSConnectorImpl.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012, 2015 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,7 +8,7 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 433206
+ * Christian W. Damus - bugs 433206, 436665
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css;
@@ -30,7 +30,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSView;
import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSConnectorStyleDelegate;
import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSViewDelegate;
-public class CSSConnectorImpl extends ConnectorImpl implements CSSConnectorStyle, CSSView {
+public class CSSConnectorImpl extends ConnectorImpl implements CSSConnectorStyle, CSSView.Internal {
protected ExtendedCSSEngine engine;
@@ -58,6 +58,12 @@ public class CSSConnectorImpl extends ConnectorImpl implements CSSConnectorStyle
}
return cssView;
}
+
+ @Override
+ public void resetCSS() {
+ cssView = null;
+ engine = null;
+ }
// ////////////////////////////////////////
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDecorationNodeImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDecorationNodeImpl.java
index 47824d811bc..5aa5e95da79 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDecorationNodeImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDecorationNodeImpl.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2014, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,7 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- * Christian W. Damus - bug 433206
+ * Christian W. Damus - bugs 433206, 436665
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css;
@@ -27,7 +27,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSView;
import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSViewDelegate;
-public class CSSDecorationNodeImpl extends DecorationNodeImpl implements CustomStyle, CSSView {
+public class CSSDecorationNodeImpl extends DecorationNodeImpl implements CustomStyle, CSSView.Internal {
protected ExtendedCSSEngine engine;
@@ -55,6 +55,12 @@ public class CSSDecorationNodeImpl extends DecorationNodeImpl implements CustomS
}
return cssView;
}
+
+ @Override
+ public void resetCSS() {
+ cssView = null;
+ engine = null;
+ }
// ////////////////////////////////////////
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEdgeImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEdgeImpl.java
index cc3bc1c91fb..741c32ace7e 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEdgeImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEdgeImpl.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012, 2015 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,7 +8,7 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 433206
+ * Christian W. Damus - bugs 433206, 436665
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css;
@@ -26,7 +26,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.provider.CustomStyle;
import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSView;
import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSViewDelegate;
-public class CSSEdgeImpl extends EdgeImpl implements CSSView, CustomStyle {
+public class CSSEdgeImpl extends EdgeImpl implements CSSView.Internal, CustomStyle {
protected ExtendedCSSEngine engine;
@@ -47,6 +47,12 @@ public class CSSEdgeImpl extends EdgeImpl implements CSSView, CustomStyle {
}
return cssView;
}
+
+ @Override
+ public void resetCSS() {
+ cssView = null;
+ engine = null;
+ }
protected CustomStyle getCustomStyle() {
if (customStyle == null) {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSNodeImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSNodeImpl.java
index 4e1451bc005..0a48060cd0f 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSNodeImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSNodeImpl.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012, 2015 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,7 +8,7 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 433206
+ * Christian W. Damus - bugs 433206, 436665
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css;
@@ -26,7 +26,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.provider.CustomStyle;
import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSView;
import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSViewDelegate;
-public class CSSNodeImpl extends NodeImpl implements CSSView, CustomStyle {
+public class CSSNodeImpl extends NodeImpl implements CSSView.Internal, CustomStyle {
protected ExtendedCSSEngine engine;
@@ -47,6 +47,12 @@ public class CSSNodeImpl extends NodeImpl implements CSSView, CustomStyle {
}
return cssView;
}
+
+ @Override
+ public void resetCSS() {
+ cssView = null;
+ engine = null;
+ }
protected CustomStyle getCustomStyle() {
if (customStyle == null) {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSShapeImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSShapeImpl.java
index 02ae5223885..dd23ecbef0b 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSShapeImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSShapeImpl.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012, 2015 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,7 +8,7 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 433206
+ * Christian W. Damus - bugs 433206, 436665
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css;
@@ -28,7 +28,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSView;
import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSShapeStyleDelegate;
import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSViewDelegate;
-public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyle, CSSView {
+public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyle, CSSView.Internal {
protected ExtendedCSSEngine engine;
@@ -58,6 +58,12 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
return cssView;
}
+
+ @Override
+ public void resetCSS() {
+ cssView = null;
+ engine = null;
+ }
protected ExtendedCSSEngine getEngine() {
if (engine == null) {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSView.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSView.java
index b1c426e2ee1..5de889423cf 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSView.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/CSSView.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013, 2015 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2013, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,7 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- * Christian W. Damus - bug 433206
+ * Christian W. Damus - bugs 433206, 436665
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.style;
@@ -50,4 +50,25 @@ public interface CSSView {
* @see View#getStyle(EClass)
*/
public Style getCSSStyle(EClass eClass);
+
+ //
+ // Nested types
+ //
+
+ /**
+ * Private interface for management of CSS lifecycle and other
+ * internal concerns
+ *
+ * @since 1.2
+ *
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ interface Internal extends CSSView {
+ /**
+ * Resets my association with the CSS engine and any local caches
+ * thereof that I may have.
+ */
+ void resetCSS();
+ }
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java
index 57d55f86b4a..482aee3969c 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012, 2015 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,7 +8,7 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 461629
+ * Christian W. Damus - bugs 461629, 436665
* Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - bug 462381
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.dom;
@@ -279,7 +279,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
notationElement.eAdapters().add(cssStyleListener = new CustomStyleListener(notationElement, this, cssStyles));
}
- private ExtendedCSSEngine getEngine() {
+ ExtendedCSSEngine getEngine() {
return (ExtendedCSSEngine) engine;
}
@@ -605,6 +605,32 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
}
/**
+ * Handles a notification for change in notation view containment.
+ * <p>
+ * Source: styleListener
+ * </p>
+ */
+ public void childrenChanged() {
+ if (children != null) {
+ children = null;
+ getEngine().notifyChange(this);
+ }
+ }
+
+ /**
+ * Handles a notification for change in notation view containment.
+ * <p>
+ * Source: styleListener
+ * </p>
+ */
+ public void parentChanged() {
+ if (parentNode != null) {
+ parentNode = null;
+ getEngine().notifyChange(this);
+ }
+ }
+
+ /**
* Handles a notification for Custom style change.
* Source: cssStyleListener
*/
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/StyleListener.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/StyleListener.java
index f6f7c0126d9..007fed032a4 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/StyleListener.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/StyleListener.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012, 2015 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,15 +8,20 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 461629
+ * Christian W. Damus - bugs 461629, 436665
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.dom;
+import java.util.Collection;
+import java.util.stream.Stream;
+
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSAnnotations;
/**
@@ -57,6 +62,50 @@ public class StyleListener extends AdapterImpl {
if (shouldPropagateNotationEvent(notification)) {
elementAdapter.notationPropertyChanged();
}
+
+ // Handle view containment changes
+ if (notification.getFeature() instanceof EReference) {
+ EReference reference = (EReference) notification.getFeature();
+ if (reference.getEContainingClass() == NotationPackage.Literals.VIEW) {
+ switch (notification.getFeatureID(View.class)) {
+ case NotationPackage.VIEW__PERSISTED_CHILDREN:
+ case NotationPackage.VIEW__TRANSIENT_CHILDREN:
+ elementAdapter.childrenChanged();
+
+ Stream<?> changedViews;
+ switch (notification.getEventType()) {
+ case Notification.ADD:
+ changedViews = Stream.of(notification.getNewValue());
+ break;
+ case Notification.ADD_MANY:
+ changedViews = ((Collection<?>) notification.getNewValue()).stream();
+ break;
+ case Notification.REMOVE:
+ changedViews = Stream.of(notification.getOldValue());
+ break;
+ case Notification.REMOVE_MANY:
+ changedViews = ((Collection<?>) notification.getOldValue()).stream();
+ break;
+ case Notification.SET:
+ changedViews = Stream.of(notification.getNewValue(), notification.getOldValue());
+ break;
+ default:
+ // Shouldn't be here
+ changedViews = Stream.empty();
+ break;
+ }
+ changedViews
+ .map(View.class::cast)
+ .map(elementAdapter.getEngine()::getElement)
+ .filter(GMFElementAdapter.class::isInstance)
+ .map(GMFElementAdapter.class::cast)
+ .forEach(GMFElementAdapter::parentChanged);
+
+ break;
+ }
+ }
+ }
+
return;
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagramImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagramImpl.java
index 4931c4b6855..e27cd26cdfc 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagramImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagramImpl.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012, 2015 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,8 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - support adapter instead of custom resource impl for CSS (CDO)
- * Christian W. Damus - bug 433206
- * Christian W. Damus - bug 464443
+ * Christian W. Damus - bugs 433206, 464443, 436665
*
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.notation;
@@ -43,7 +42,7 @@ import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
* @author Camille letavernier
*/
@SuppressWarnings("restriction")
-public class CSSDiagramImpl extends DiagramImpl implements CSSDiagram {
+public class CSSDiagramImpl extends DiagramImpl implements CSSDiagram, CSSView.Internal {
protected ExtendedCSSEngine engine;
@@ -52,15 +51,26 @@ public class CSSDiagramImpl extends DiagramImpl implements CSSDiagram {
@Override
public ExtendedCSSEngine getEngine() {
if (engine == null) {
- engine = new DiagramCSSEngine(getModelEngine(), this);
+ ExtendedCSSEngine modelEngine = getModelEngine();
+ engine = new DiagramCSSEngine(modelEngine, this);
}
return engine;
}
- private void disposeEngine() {
+ @Override
+ public void resetCSS() {
if (engine != null) {
+ cssView = null;
+
engine.dispose();
engine = null;
+
+ // And walk our contents to make all views forget their engine
+ eAllContents().forEachRemaining(o -> {
+ if (o instanceof CSSView.Internal) {
+ ((CSSView.Internal) o).resetCSS();
+ }
+ });
}
}
@@ -73,7 +83,7 @@ public class CSSDiagramImpl extends DiagramImpl implements CSSDiagram {
if (oldResource != resource) {
// My engine is now invalid because my resource is different than before,
// which makes its parent engine is obsolete
- disposeEngine();
+ resetCSS();
}
}

Back to the top