Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Schnekenburger2016-04-28 21:12:30 +0000
committerGerrit Code Review @ Eclipse.org2016-05-20 16:19:36 +0000
commitaea7ae97401e60b919cc0a824b8bdf12a40fb25a (patch)
tree958ecc24fa9584316adc16c351c3c43bbca0b5a1 /plugins/uml
parentc1d2ca47d0d4facc38baaf798714ac6f7000103c (diff)
downloadorg.eclipse.papyrus-aea7ae97401e60b919cc0a824b8bdf12a40fb25a.tar.gz
org.eclipse.papyrus-aea7ae97401e60b919cc0a824b8bdf12a40fb25a.tar.xz
org.eclipse.papyrus-aea7ae97401e60b919cc0a824b8bdf12a40fb25a.zip
Bug 492697: [UseCase Diagram] User should be able to change the
representation of an Actor with the TypeSymbolDefinition stereotype https://bugs.eclipse.org/bugs/show_bug.cgi?id=492697 Change-Id: I9178d26555a141ed22990a48f4ad8aa279735969 Signed-off-by: Remi Schnekenburger <remi.schnekenburger@cea.fr>
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/StereotypedElementShapeProvider.java529
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/TypedElementShapeProvider.java81
2 files changed, 378 insertions, 232 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/StereotypedElementShapeProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/StereotypedElementShapeProvider.java
index f28c5b42c7f..3ea2b95fa41 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/StereotypedElementShapeProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/StereotypedElementShapeProvider.java
@@ -1,231 +1,298 @@
-/*****************************************************************************
- * Copyright (c) 2012-2013 CEA LIST.
- *
- * 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:
- *
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.symbols.provider;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
-import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
-import org.eclipse.gmf.runtime.draw2d.ui.render.RenderedImage;
-import org.eclipse.gmf.runtime.draw2d.ui.render.factory.RenderedImageFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.AbstractShapeProvider;
-import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.ProviderNotificationManager;
-import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.ShapeService;
-import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
-import org.eclipse.papyrus.uml.diagram.symbols.Activator;
-import org.eclipse.papyrus.uml.tools.utils.ElementUtil;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Stereotype;
-import org.w3c.dom.svg.SVGDocument;
-
-/**
- * This provider is linked to the {@link ShapeService}. It returns the shapes for a given element corresponding to the stereotypes applied on the
- * business element.
- */
-public class StereotypedElementShapeProvider extends AbstractShapeProvider {
-
- private static final String SHAPE_CONSTANT = "shape";
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<RenderedImage> getShapes(EObject view) {
- if (!(view instanceof View)) {
- return null;
- }
- EObject element = ((View) view).getElement();
- if (element instanceof Element) {
- List<RenderedImage> images = new ArrayList<RenderedImage>();
- // it has already been checked that
-
- Iterator<Stereotype> appliedStereotypes = ((Element) element).getAppliedStereotypes().iterator();
- while (appliedStereotypes.hasNext()) {
- try {
- Stereotype appliedStereotype = appliedStereotypes.next();
- View stereotypeLabel = StereotypeDisplayUtil.getInstance().getStereotypeLabel(((View) view), appliedStereotype);
- if (stereotypeLabel != null && stereotypeLabel.isVisible()) {
- org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(((Element) element), appliedStereotype, SHAPE_CONSTANT);
- if (icon != null) {
- if (!"".equals(icon.getLocation()) && icon.getLocation() != null) {
- SVGDocument document = getSVGDocument(icon.getLocation());
- if (document != null) {
- images.add(renderSVGDocument(view, document));
- } else {
- URL url = new URL(icon.getLocation());
- images.add(RenderedImageFactory.getInstance(url));
- }
- }
- }
- }
- } catch (Exception ex) {
- Activator.log.error(ex);
- continue;
- }
- }
-
- return images;
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean providesShapes(EObject view) {
- if (!(view instanceof View)) {
- return false;
- }
-
- EObject element = ((View) view).getElement();
- if (element instanceof Element) {
-
- // This is an element. does it have stereotypes ? If yes, do the stereotypes have shapes associated ?
- Iterator<Stereotype> appliedStereotypes = ((Element) element).getAppliedStereotypes().iterator();
- while (appliedStereotypes.hasNext()) {
-
- Stereotype appliedStereotype = appliedStereotypes.next();
- View stereotypeLabel = StereotypeDisplayUtil.getInstance().getStereotypeLabel(((View) view), appliedStereotype);
- if (stereotypeLabel != null && stereotypeLabel.isVisible()) {
- org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(((Element) element), appliedStereotype, SHAPE_CONSTANT);
-
- if (icon != null) {
- if (icon.getLocation() != "" && icon.getLocation() != null) {
- return true;
- }
- }
- }
- }
-
-
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- */
- @Override
- public List<SVGDocument> getSVGDocument(EObject view) {
- if (!(view instanceof View)) {
- return null;
- }
- EObject element = ((View) view).getElement();
- if (element instanceof Element) {
- List<SVGDocument> images = new ArrayList<SVGDocument>();
- // it has already been checked that
- Iterator<Stereotype> appliedStereotypes = ((Element) element).getAppliedStereotypes().iterator();
- while (appliedStereotypes.hasNext()) {
-
- Stereotype appliedStereotype = appliedStereotypes.next();
- View stereotypeLabel = StereotypeDisplayUtil.getInstance().getStereotypeLabel(((View) view), appliedStereotype);
- if (stereotypeLabel != null && stereotypeLabel.isVisible()) {
- org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(((Element) element), appliedStereotype, SHAPE_CONSTANT);
- if (icon != null) {
- if (icon.getLocation() != "" && icon.getLocation() != null) {
- SVGDocument document = getSVGDocument(icon.getLocation());
- if (document != null) {
- images.add(document);
- }
- }
- }
- }
- }
- return images;
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ProviderNotificationManager createProviderNotificationManager(DiagramEventBroker diagramEventBroker, EObject view, NotificationListener listener) {
- // retrieve semantic element from the view and add a notification listener on the Type feature if the semantic element is a TypedElement
- if (view == null || !(view instanceof View)) {
- return null;
- }
-
- StereotypedElementShapeProviderNotificationManager notificationManager = new StereotypedElementShapeProviderNotificationManager(diagramEventBroker, view, listener);
- return notificationManager;
- }
-
- /**
- * Notification Manager for the {@link StereotypedElementShapeProvider}.
- */
- public class StereotypedElementShapeProviderNotificationManager extends ProviderNotificationManager implements NotificationListener {
-
- /**
- * Creates a new StereotypedElementShapeProviderNotificationManager.
- *
- * @param diagramEventBroker
- * event broker specific to the diargam displaying the shapes.
- * @param view
- * the view from which all elements to listen will be computed.
- * @param listener
- * the listener to which notifications will be forwarded.
- */
- public StereotypedElementShapeProviderNotificationManager(DiagramEventBroker diagramEventBroker, EObject view, NotificationListener listener) {
- super(diagramEventBroker, view, listener);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void registerListeners() {
- if (view == null || !(view instanceof View)) {
- return;
- }
- diagramEventBroker.addNotificationListener(view, this);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- if (view == null || !(view instanceof View)) {
- return;
- }
- diagramEventBroker.removeNotificationListener(view, this);
- super.dispose();
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification)
- *
- * @param notification
- */
- @Override
- public void notifyChanged(Notification notification) {
- // TODO
-
- }
-
-
-
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012-2013 CEA LIST.
+ *
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.symbols.provider;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
+import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
+import org.eclipse.gmf.runtime.draw2d.ui.render.RenderedImage;
+import org.eclipse.gmf.runtime.draw2d.ui.render.factory.RenderedImageFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.AbstractShapeProvider;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.ProviderNotificationManager;
+import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.ShapeService;
+import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
+import org.eclipse.papyrus.uml.diagram.symbols.Activator;
+import org.eclipse.papyrus.uml.tools.utils.ElementUtil;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Stereotype;
+import org.w3c.dom.svg.SVGDocument;
+
+/**
+ * This provider is linked to the {@link ShapeService}. It returns the shapes for a given element corresponding to the stereotypes applied on the
+ * business element.
+ */
+public class StereotypedElementShapeProvider extends AbstractShapeProvider {
+
+ private static final String SHAPE_CONSTANT = "shape";
+
+ /** name of the CSS property that manages the enablement of that provider */
+ protected static final String SHAPE_STEREOTYPE_PROPERTY = "shapeStereotype";
+
+ /** name of the CSS property that manages the enablement of that provider for decoration */
+ protected static final String SHAPE_DECORATION_STEREOTYPE_PROPERTY = "shapeDecorationStereotype";
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<RenderedImage> getShapes(EObject view) {
+ if (!(view instanceof View)) {
+ return null;
+ }
+ View v = (View) view;
+ // check the css property for the status (enable or not) of that provider
+ if (!isShapeStereotypeEnable(v)) {
+ return null;
+ }
+
+ return doGetShapes(v);
+ }
+
+ protected List<RenderedImage> doGetShapes(View view) {
+ EObject element = view.getElement();
+ if (element instanceof Element) {
+ List<RenderedImage> images = new ArrayList<RenderedImage>();
+ // it has already been checked that
+
+ Iterator<Stereotype> appliedStereotypes = ((Element) element).getAppliedStereotypes().iterator();
+ while (appliedStereotypes.hasNext()) {
+ try {
+ Stereotype appliedStereotype = appliedStereotypes.next();
+ View stereotypeLabel = StereotypeDisplayUtil.getInstance().getStereotypeLabel(view, appliedStereotype);
+ if (stereotypeLabel != null && stereotypeLabel.isVisible()) {
+ org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(((Element) element), appliedStereotype, SHAPE_CONSTANT);
+ if (icon != null) {
+ if (icon.getLocation() != null && !("".equals(icon.getLocation()))) {
+ SVGDocument document = getSVGDocument(icon.getLocation());
+ if (document != null) {
+ images.add(renderSVGDocument(view, document));
+ } else {
+ URL url = new URL(icon.getLocation());
+ images.add(RenderedImageFactory.getInstance(url));
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ continue;
+ }
+ }
+
+ return images;
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<RenderedImage> getShapesForDecoration(EObject view) {
+ if (!(view instanceof View)) {
+ return null;
+ }
+ View v = (View) view;
+ // check the css property for the status (enable or not) of that provider
+ if (!isShapeDecorationStereotypeEnable(v)) {
+ return null;
+ }
+
+ return doGetShapesForDecoration(v);
+ }
+
+ protected List<RenderedImage> doGetShapesForDecoration(View view) {
+ return doGetShapes(view);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean providesShapes(EObject view) {
+ if (!(view instanceof View)) {
+ return false;
+ }
+
+ View v = (View) view;
+ if (!isShapeStereotypeEnable(v)) {
+ return false;
+ }
+
+ EObject element = v.getElement();
+ if (element instanceof Element) {
+ // This is an element. does it have stereotypes ? If yes, do the stereotypes have shapes associated ?
+ Iterator<Stereotype> appliedStereotypes = ((Element) element).getAppliedStereotypes().iterator();
+ while (appliedStereotypes.hasNext()) {
+
+ Stereotype appliedStereotype = appliedStereotypes.next();
+ View stereotypeLabel = StereotypeDisplayUtil.getInstance().getStereotypeLabel(v, appliedStereotype);
+ if (stereotypeLabel != null && stereotypeLabel.isVisible()) {
+ org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(((Element) element), appliedStereotype, SHAPE_CONSTANT);
+
+ if (icon != null) {
+ if (!"".equals(icon.getLocation()) && icon.getLocation() != null) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns <code>false</code> if the given view specifically removes the support for shapes by stereotypes.
+ *
+ * @param view
+ * the view to check style
+ * @return <code>false</code> if the given view specifically removes the support for shapes by stereotypes, otherwise <code>true</code>.
+ */
+ private boolean isShapeStereotypeEnable(View view) {
+ return NotationUtils.getBooleanValue(view, SHAPE_STEREOTYPE_PROPERTY, true);
+ }
+
+ /**
+ * Returns <code>false</code> if the given view specifically removes the support for shapes as decoration by stereotypes.
+ *
+ * @param view
+ * the view to check style
+ * @return <code>false</code> if the given view specifically removes the support for shapes as decoration by stereotypes, otherwise <code>true</code>.
+ */
+ private boolean isShapeDecorationStereotypeEnable(View view) {
+ return NotationUtils.getBooleanValue(view, SHAPE_DECORATION_STEREOTYPE_PROPERTY, true);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ */
+ @Override
+ public List<SVGDocument> getSVGDocument(EObject view) {
+ if (!(view instanceof View)) {
+ return null;
+ }
+
+ View v = (View) view;
+ if (!isShapeStereotypeEnable(v)) {
+ return null;
+ }
+
+ EObject element = v.getElement();
+ if (element instanceof Element) {
+ List<SVGDocument> images = new ArrayList<SVGDocument>();
+ // it has already been checked that
+ Iterator<Stereotype> appliedStereotypes = ((Element) element).getAppliedStereotypes().iterator();
+ while (appliedStereotypes.hasNext()) {
+
+ Stereotype appliedStereotype = appliedStereotypes.next();
+ View stereotypeLabel = StereotypeDisplayUtil.getInstance().getStereotypeLabel(v, appliedStereotype);
+ if (stereotypeLabel != null && stereotypeLabel.isVisible()) {
+ org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(((Element) element), appliedStereotype, SHAPE_CONSTANT);
+ if (icon != null) {
+ if (icon.getLocation() != null && !("".equals(icon.getLocation()))) {
+ SVGDocument document = getSVGDocument(icon.getLocation());
+ if (document != null) {
+ images.add(document);
+ }
+ }
+ }
+ }
+ }
+ return images;
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ProviderNotificationManager createProviderNotificationManager(DiagramEventBroker diagramEventBroker, EObject view, NotificationListener listener) {
+ // retrieve semantic element from the view and add a notification listener on the Type feature if the semantic element is a TypedElement
+ if (view == null || !(view instanceof View)) {
+ return null;
+ }
+
+ StereotypedElementShapeProviderNotificationManager notificationManager = new StereotypedElementShapeProviderNotificationManager(diagramEventBroker, view, listener);
+ return notificationManager;
+ }
+
+ /**
+ * Notification Manager for the {@link StereotypedElementShapeProvider}.
+ */
+ public class StereotypedElementShapeProviderNotificationManager extends ProviderNotificationManager implements NotificationListener {
+
+ /**
+ * Creates a new StereotypedElementShapeProviderNotificationManager.
+ *
+ * @param diagramEventBroker
+ * event broker specific to the diargam displaying the shapes.
+ * @param view
+ * the view from which all elements to listen will be computed.
+ * @param listener
+ * the listener to which notifications will be forwarded.
+ */
+ public StereotypedElementShapeProviderNotificationManager(DiagramEventBroker diagramEventBroker, EObject view, NotificationListener listener) {
+ super(diagramEventBroker, view, listener);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void registerListeners() {
+ if (view == null || !(view instanceof View)) {
+ return;
+ }
+ diagramEventBroker.addNotificationListener(view, this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void dispose() {
+ if (view == null || !(view instanceof View)) {
+ return;
+ }
+ diagramEventBroker.removeNotificationListener(view, this);
+ super.dispose();
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ *
+ * @param notification
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ // TODO
+
+ }
+
+
+
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/TypedElementShapeProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/TypedElementShapeProvider.java
index e34d5a02626..cb764df4820 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/TypedElementShapeProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.symbols/src/org/eclipse/papyrus/uml/diagram/symbols/provider/TypedElementShapeProvider.java
@@ -31,6 +31,7 @@ import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
import org.eclipse.gmf.runtime.draw2d.ui.render.RenderedImage;
import org.eclipse.gmf.runtime.draw2d.ui.render.factory.RenderedImageFactory;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.AbstractShapeProvider;
import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.ProviderNotificationManager;
import org.eclipse.papyrus.infra.gmfdiag.common.service.shape.ShapeService;
@@ -50,11 +51,29 @@ import org.w3c.dom.svg.SVGDocument;
*/
public class TypedElementShapeProvider extends AbstractShapeProvider {
+ /** name of the CSS property that manages the enablement of that provider */
+ protected static final String SHAPE_TYPED_ELEMENT_PROPERTY = "shapeTypedElement";
+
+ /** name of the CSS property that manages the enablement of that provider as decoration */
+ protected static final String SHAPE_DECORATION_TYPED_ELEMENT_PROPERTY = "shapeDecorationTypedElement";
+
/**
* {@inheritDoc}
*/
@Override
public List<RenderedImage> getShapes(EObject view) {
+ if (!(view instanceof View)) {
+ return null;
+ }
+ View v = (View) view;
+ // check the css property for the status (enable or not) of that provider
+ if (!isShapeTypedElementEnable(v)) {
+ return null;
+ }
+ return doGetShapes(v);
+ }
+
+ protected List<RenderedImage> doGetShapes(View view) {
Type type = getType(view);
String path = getSymbolPath(type);
if (path != null && path.length() > 0) {
@@ -99,11 +118,62 @@ public class TypedElementShapeProvider extends AbstractShapeProvider {
}
/**
+ * Returns <code>false</code> if the given view specifically removes the support for shapes by type.
+ *
+ * @param view
+ * the view to check style
+ * @return <code>false</code> if the given view specifically removes the support for shapes by type, otherwise <code>true</code>.
+ */
+ private boolean isShapeTypedElementEnable(View view) {
+ return NotationUtils.getBooleanValue(view, SHAPE_TYPED_ELEMENT_PROPERTY, true);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<RenderedImage> getShapesForDecoration(EObject view) {
+ if (!(view instanceof View)) {
+ return null;
+ }
+ View v = (View) view;
+ // check the css property for the status (enable or not) of that provider
+ if (!isShapeDecorationTypedElementEnable(v)) {
+ return null;
+ }
+ return doGetShapesForDecoration(v);
+ }
+
+ protected List<RenderedImage> doGetShapesForDecoration(View view) {
+ return doGetShapes(view);
+ }
+
+ /**
+ * Returns <code>false</code> if the given view specifically removes the support for shapes decoration by type.
+ *
+ * @param view
+ * the view to check style
+ * @return <code>false</code> if the given view specifically removes the support for shapes decoration by type, otherwise <code>true</code>.
+ */
+ private boolean isShapeDecorationTypedElementEnable(View view) {
+ return NotationUtils.getBooleanValue(view, SHAPE_DECORATION_TYPED_ELEMENT_PROPERTY, true);
+ }
+
+ /**
* {@inheritDoc}
*/
@Override
public List<SVGDocument> getSVGDocument(EObject view) {
- Type type = getType(view);
+ if (!(view instanceof View)) {
+ return null;
+ }
+ View v = (View) view;
+ // check the css property for the status (enable or not) of that provider
+ if (!isShapeTypedElementEnable(v)) {
+ return null;
+ }
+
+ Type type = getType(v);
String path = getSymbolPath(type);
if (path != null && path.length() > 0) {
try {
@@ -134,6 +204,15 @@ public class TypedElementShapeProvider extends AbstractShapeProvider {
*/
@Override
public boolean providesShapes(EObject view) {
+ if (!(view instanceof View)) {
+ return false;
+ }
+ View v = (View) view;
+ // check the css property for the status (enable or not) of that provider
+ if (!isShapeTypedElementEnable(v)) {
+ return false;
+ }
+
Type type = getType(view);
String path = getSymbolPath(type);
if (path != null && path.length() > 0) {

Back to the top