diff options
| author | Christian W. Damus | 2015-04-11 13:43:39 +0000 |
|---|---|---|
| committer | Camille Letavernier | 2015-04-21 14:27:01 +0000 |
| commit | 23d0944ec2ff4681c1699cf014205964a7e593ba (patch) | |
| tree | bd01c9725a683859278c9533a390f3fc7b12cd61 | |
| parent | fe53782c5e9e632257d8f41b29c0db7781682b4c (diff) | |
| download | org.eclipse.papyrus-23d0944ec2ff4681c1699cf014205964a7e593ba.tar.gz org.eclipse.papyrus-23d0944ec2ff4681c1699cf014205964a7e593ba.tar.xz org.eclipse.papyrus-23d0944ec2ff4681c1699cf014205964a7e593ba.zip | |
Bug 464443: [CSS] Diagrams are not CSSViews
https://bugs.eclipse.org/bugs/show_bug.cgi?id=464443
Let CSSDiagram be a CSSView.
Change-Id: I41dbdb040263a2421fd0cde2523152977c3fc9d2
Reviewed-on: https://git.eclipse.org/r/45696
Tested-by: Hudson CI
Reviewed-by: Camille Letavernier <camille.letavernier@cea.fr>
2 files changed, 78 insertions, 2 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagram.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagram.java index 9d1b5106384..43ba2fd0937 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagram.java +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagram.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2015 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,6 +8,7 @@ *
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus - bug 464443
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.notation;
@@ -15,6 +16,7 @@ import java.util.List; import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine;
+import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSView;
import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
/**
@@ -23,7 +25,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet; * @author Camille Letavernier
*
*/
-public interface CSSDiagram extends Diagram {
+public interface CSSDiagram extends Diagram, CSSView {
/**
* Returns the list of stylesheets directly owned by this diagram
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 c8243798369..4931c4b6855 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 @@ -10,6 +10,7 @@ * 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 * *****************************************************************************/ package org.eclipse.papyrus.infra.gmfdiag.css.notation; @@ -17,13 +18,18 @@ package org.eclipse.papyrus.infra.gmfdiag.css.notation; import java.util.LinkedList; import java.util.List; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.gmf.runtime.notation.EObjectListValueStyle; import org.eclipse.gmf.runtime.notation.NamedStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.Style; import org.eclipse.gmf.runtime.notation.impl.DiagramImpl; import org.eclipse.papyrus.infra.gmfdiag.css.engine.DiagramCSSEngine; import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine; import org.eclipse.papyrus.infra.gmfdiag.css.resource.CSSNotationResource; +import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSView; +import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSViewDelegate; import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet; import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference; import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsFactory; @@ -41,6 +47,8 @@ public class CSSDiagramImpl extends DiagramImpl implements CSSDiagram { protected ExtendedCSSEngine engine; + private CSSView cssView; + @Override public ExtendedCSSEngine getEngine() { if (engine == null) { @@ -124,4 +132,70 @@ public class CSSDiagramImpl extends DiagramImpl implements CSSDiagram { return ref; } + protected CSSView getCSSView() { + if (cssView == null) { + cssView = new CSSViewDelegate(this, getEngine()); + } + return cssView; + } + + // ////////////////////////////////// + // Implements the isVisible method // + // ////////////////////////////////// + + @Override + public boolean isVisible() { + // return super.isVisible(); + return isCSSVisible(); + } + + @Override + public boolean isCSSVisible() { + boolean value = super.isVisible(); + + if (ForceValueHelper.isSet(this, NotationPackage.eINSTANCE.getView_Visible(), value)) { + return value; + } else { + return getCSSView().isCSSVisible(); + } + } + + // ////////////////////////////////////// + // Implements the getNamedStyle method // + // ////////////////////////////////////// + + @Override + public NamedStyle getNamedStyle(EClass eClass, String name) { + return getCSSNamedStyle(eClass, name); + } + + @Override + public NamedStyle getCSSNamedStyle(EClass eClass, String name) { + NamedStyle userStyle = super.getNamedStyle(eClass, name); + if (userStyle != null) { + return userStyle; + } + + return getCSSView().getCSSNamedStyle(eClass, name); + } + + // ///////////////////////////////// + // Implements the getStyle method // + // ///////////////////////////////// + + @Override + public Style getStyle(EClass eClass) { + return getCSSStyle(eClass); + } + + @Override + public Style getCSSStyle(EClass eClass) { + Style userStyle = super.getStyle(eClass); + if (userStyle != null) { + return userStyle; + } + + return getCSSView().getCSSStyle(eClass); + } + } |
