diff options
author | Mickael ADAM | 2017-07-31 14:55:15 +0000 |
---|---|---|
committer | vincent lorenzo | 2017-08-29 16:07:59 +0000 |
commit | 00b61664f70c5c87c7abed65ca158d2d4f72f62f (patch) | |
tree | 2d28307a462d3f22b3ccbbb82b89a07e22c7c406 /plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement | |
parent | c440f9b5daaa5ef02d6dd46c5e54c4ed809a93f1 (diff) | |
download | org.eclipse.papyrus-00b61664f70c5c87c7abed65ca158d2d4f72f62f.tar.gz org.eclipse.papyrus-00b61664f70c5c87c7abed65ca158d2d4f72f62f.tar.xz org.eclipse.papyrus-00b61664f70c5c87c7abed65ca158d2d4f72f62f.zip |
Bug 515661 - [Diagram] Graphical direction on connectors
https://bugs.eclipse.org/bugs/show_bug.cgi?id=515661
Change-Id: Icdf68c95c9da7991b711b963363a4f6f51f7fd0c
Signed-off-by: Mickael ADAM <mickael.adam@all4tec.net>
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement')
-rw-r--r-- | plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/AdvanceStyleModelElement.java | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/AdvanceStyleModelElement.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/AdvanceStyleModelElement.java index 43f65b0dff5..7da4b2b0da5 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/AdvanceStyleModelElement.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/AdvanceStyleModelElement.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2016 CEA LIST and others. + * Copyright (c) 2016, 2017 CEA LIST, ALL4TEC 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,17 +8,27 @@ * * Contributors: * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation - bug 465297 + * Mickaƫl ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 515661 *****************************************************************************/ package org.eclipse.papyrus.infra.gmfdiag.properties.modelelement; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + import org.eclipse.core.databinding.observable.IObservable; +import org.eclipse.draw2d.RotatableDecoration; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.decoration.ConnectionDecorationRegistry; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.types.NotationTypesMap; import org.eclipse.papyrus.infra.gmfdiag.common.utils.LineStyleEnum; import org.eclipse.papyrus.infra.gmfdiag.common.utils.NamedStyleProperties; import org.eclipse.papyrus.infra.gmfdiag.common.utils.PortPositionEnum; import org.eclipse.papyrus.infra.gmfdiag.common.utils.PositionEnum; +import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.ConnectionDecorationStyleObservableValue; import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.CustomChildFloatingLabelBooleanStyleObservableValue; import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.CustomIntStyleCompartmentObservableValue; import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.CustomStringStyleCompartmentObservableValue; @@ -91,13 +101,17 @@ public class AdvanceStyleModelElement extends CustomStyleModelElement { if (propertyPath.equals(NamedStyleProperties.DISPLAY_FLOATING_LABEL) && !"FloatingLabel".equals(NotationTypesMap.instance.getHumanReadableType((View) source))) {// $NON-NLS-1$ // CustomStringObservableValue to set all compartment of the Shape observable = new CustomChildFloatingLabelBooleanStyleObservableValue(view, domain, propertyPath); - } else { + } else + // case of connector decorations + if (propertyPath.equals(ConnectionEditPart.TARGET_DECORATION) + || propertyPath.equals(ConnectionEditPart.SOURCE_DECORATION)) { + observable = new ConnectionDecorationStyleObservableValue(view, domain, propertyPath); + } else { observable = super.doGetObservable(propertyPath); } } return observable; - } /** @@ -157,6 +171,15 @@ public class AdvanceStyleModelElement extends CustomStyleModelElement { contentProvider = new StaticContentProvider(portPositions); } + // case connector decorations + if (propertyPath.equals(ConnectionEditPart.TARGET_DECORATION) + || propertyPath.equals(ConnectionEditPart.SOURCE_DECORATION)) { + Map<String, Class<? extends RotatableDecoration>> availableDecoration = ConnectionDecorationRegistry.getInstance().getAvailableDecoration(); + List<String> decorations = new ArrayList<String>(availableDecoration.keySet()); + decorations.addAll(Arrays.asList(ConnectionEditPart.DECORATION_VALUES)); + contentProvider = new StaticContentProvider(decorations.toArray()); + } + return null != contentProvider ? contentProvider : super.getContentProvider(propertyPath); } |