| /***************************************************************************** |
| * Copyright (c) 2011 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.sysml.diagram.requirement.edit.part; |
| |
| import java.util.List; |
| |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.gmf.runtime.notation.View; |
| import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper; |
| import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassNameEditPart; |
| import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil; |
| import org.eclipse.swt.graphics.Image; |
| |
| public class CustomRequirementNameEditPart extends ClassNameEditPart { // NamedElementNodeLabelNameEditPart { |
| |
| /** Constructor */ |
| public CustomRequirementNameEditPart(View view) { |
| super(view); |
| } |
| |
| @Override |
| protected Image getLabelIcon() { |
| EObject parserElement = getParserElement(); |
| if (parserElement == null) { |
| return null; |
| } |
| |
| List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); |
| for (View view : views) { |
| if (AppearanceHelper.showElementIcon(view)) { |
| return org.eclipse.papyrus.sysml.diagram.common.Activator.getInstance().getLabelProvider().getImage(parserElement); |
| } |
| } |
| return null; |
| |
| } |
| } |