| /***************************************************************************** |
| * Copyright (c) 2020 CEA LIST. |
| * |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Saadia Dhouib (CEA LIST) saadia.dhouib@cea.fr - Initial API and implementation |
| * |
| *****************************************************************************/ |
| |
| package org.eclipse.papyrus.aas.profile.ui.modelelement; |
| |
| import java.util.List; |
| |
| import org.eclipse.core.databinding.observable.IObservable; |
| import org.eclipse.emf.databinding.FeaturePath; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.emf.ecore.EStructuralFeature; |
| import org.eclipse.emf.edit.domain.EditingDomain; |
| import org.eclipse.papyrus.uml.properties.databinding.StereotypePropertyObservableList; |
| import org.eclipse.papyrus.uml.properties.modelelement.StereotypeModelElement; |
| import org.eclipse.uml2.uml.Element; |
| import org.eclipse.uml2.uml.Stereotype; |
| |
| /** |
| * @author AS247872 |
| * |
| */ |
| public class AssStereotypeModelElement extends StereotypeModelElement { |
| |
| /** |
| * Constructor. |
| * |
| * @param stereotypeApplication |
| * @param stereotype |
| * @param domain |
| */ |
| public AssStereotypeModelElement(EObject stereotypeApplication, Stereotype stereotype, EditingDomain domain) { |
| super(stereotypeApplication, stereotype, domain); |
| |
| |
| // TODO Auto-generated constructor stub |
| } |
| |
| /** |
| * @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#isFeatureEditable(java.lang.String) |
| * |
| * @param propertyPath |
| * @return |
| */ |
| @Override |
| protected boolean isFeatureEditable(String propertyPath) { |
| if (propertyPath.equals("idShort")) { |
| return false; |
| } else { |
| return true; |
| } |
| } |
| |
| @Override |
| public IObservable doGetObservable(String propertyPath) { |
| |
| if (propertyPath.equals("endpoint")) { |
| FeaturePath featurePath = getFeaturePath(propertyPath); |
| EStructuralFeature feature = getFeature(featurePath); |
| Element baseElement = org.eclipse.uml2.uml.util.UMLUtil.getBaseElement(source); |
| List<?> wrappedList = (List<?>) source.eGet(feature); |
| // this observable uses the SetStereotypeValueRequest |
| return (IObservable) new StereotypePropertyObservableList(wrappedList, domain, baseElement, feature, stereotype); |
| |
| } else { |
| return super.doGetObservable(propertyPath); |
| } |
| } |
| } |
| |
| |
| |
| |