| /******************************************************************************* |
| * Copyright (c) 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: |
| * Cedric Dumoulin - cedric.dumoulin@lifl.fr |
| ******************************************************************************/ |
| /** |
| */ |
| package org.eclipse.papyrus.internal.infra.gmfdiag.layers.model.layers.impl; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.gmf.runtime.notation.FontStyle; |
| import org.eclipse.gmf.runtime.notation.LineStyle; |
| import org.eclipse.gmf.runtime.notation.NotationPackage; |
| import org.eclipse.gmf.runtime.notation.View; |
| import org.eclipse.papyrus.internal.infra.gmfdiag.layers.model.layers.LayersPackage; |
| import org.eclipse.papyrus.internal.infra.gmfdiag.layers.model.layers.LineInstance; |
| import org.eclipse.papyrus.internal.infra.gmfdiag.layers.model.layers.LinePropertySetter; |
| import org.eclipse.papyrus.internal.infra.gmfdiag.layers.model.layers.TypeInstance; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Line Property Setter</b></em>'. |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public class LinePropertySetterImpl extends PropertySetterImpl implements LinePropertySetter { |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated NOT |
| */ |
| protected LinePropertySetterImpl() { |
| super(); |
| setPropertyName("line"); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return LayersPackage.Literals.LINE_PROPERTY_SETTER; |
| } |
| |
| /** |
| * Set the property of the specified view. |
| * |
| * @see org.eclipse.papyrus.internal.infra.gmfdiag.layers.model.layers.impl.PropertySetterImpl#setValue(org.eclipse.gmf.runtime.notation.View, org.eclipse.papyrus.internal.infra.gmfdiag.layers.model.layers.TypeInstance) |
| * |
| * @param view |
| * @param value |
| */ |
| @Override |
| public void setValue(View view, TypeInstance value) { |
| |
| |
| // Try to get the FontStyle object to modify |
| LineStyle style; |
| if (view instanceof FontStyle) { |
| // Try directly (case of Shape ...) |
| style = (LineStyle) view; |
| } else { |
| // Try as additionnal style |
| style = (LineStyle) view.getStyle(NotationPackage.eINSTANCE.getLineStyle()); |
| } |
| |
| // Set values |
| if (style != null) { |
| |
| |
| LineInstance lineValue = (LineInstance) value; |
| |
| style.setLineColor(lineValue.getLineColor()); |
| style.setLineWidth(lineValue.getLineWith()); |
| } |
| |
| } |
| |
| } // LinePropertySetterImpl |