diff options
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/OperationLabelHelper.java')
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/OperationLabelHelper.java | 74 |
1 files changed, 24 insertions, 50 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/OperationLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/OperationLabelHelper.java index 91ed5ca1469..da67378b3b1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/OperationLabelHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/OperationLabelHelper.java @@ -1,7 +1,7 @@ /***************************************************************************** * Copyright (c) 2008 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 @@ -16,17 +16,16 @@ package org.eclipse.papyrus.uml.diagram.common.helper; import java.util.Collection; import java.util.HashMap; import java.util.Map; -import java.util.Set; import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence; +import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; import org.eclipse.papyrus.uml.tools.utils.OperationUtil; import org.eclipse.uml2.uml.Operation; /** - * Helper for labels displaying {@link Property} + * Helper for labels displaying {@link Operation} */ public class OperationLabelHelper extends StereotypedElementLabelHelper { @@ -37,7 +36,7 @@ public class OperationLabelHelper extends StereotypedElementLabelHelper { /** * Returns the singleton instance of this class - * + * * @return the singleton instance. */ public static OperationLabelHelper getInstance() { @@ -48,39 +47,40 @@ public class OperationLabelHelper extends StereotypedElementLabelHelper { } /** Map for masks */ - protected final Map<Integer, String> masks = new HashMap<Integer, String>(7); + protected final Map<String, String> masks = new HashMap<String, String>(); /** * Creates a new Operation label helper. */ protected OperationLabelHelper() { // initialize the map - masks.put(ICustomAppearence.DISP_VISIBILITY, "Visibility"); - masks.put(ICustomAppearence.DISP_NAME, "Name"); - masks.put(ICustomAppearence.DISP_PARAMETER_NAME, "Parameters Name"); - masks.put(ICustomAppearence.DISP_PARAMETER_DIRECTION, "Parameters Direction"); - masks.put(ICustomAppearence.DISP_PARAMETER_TYPE, "Parameters Type"); - masks.put(ICustomAppearence.DISP_RT_TYPE, "Return Type"); - masks.put(ICustomAppearence.DISP_PARAMETER_MULTIPLICITY, "Parameters Multiplicity"); - masks.put(ICustomAppearence.DISP_PARAMETER_DEFAULT, "Parameters Default Value"); - masks.put(ICustomAppearence.DISP_PARAMETER_MODIFIERS, "Parameters Modifiers"); - masks.put(ICustomAppearence.DISP_MOFIFIERS, "Modifiers"); + masks.put(ICustomAppearance.DISP_VISIBILITY, "Visibility"); + masks.put(ICustomAppearance.DISP_NAME, "Name"); + masks.put(ICustomAppearance.DISP_PARAMETER_NAME, "Parameters Name"); + masks.put(ICustomAppearance.DISP_PARAMETER_DIRECTION, "Parameters Direction"); + masks.put(ICustomAppearance.DISP_PARAMETER_TYPE, "Parameters Type"); + masks.put(ICustomAppearance.DISP_RT_TYPE, "Return Type"); + masks.put(ICustomAppearance.DISP_PARAMETER_MULTIPLICITY, "Parameters Multiplicity"); + masks.put(ICustomAppearance.DISP_PARAMETER_DEFAULT, "Parameters Default Value"); + masks.put(ICustomAppearance.DISP_PARAMETER_MODIFIERS, "Parameters Modifiers"); + masks.put(ICustomAppearance.DISP_MODIFIERS, "Modifiers"); } /** * Computes the label that should be displayed by the figure managed by this * edit part. - * + * * @param editPart - * the edit part that controls the {@link Property} to be + * the edit part that controls the {@link Operation} to be * displayed * @return the label corresponding to the specific display of the property * ("default" display given by preferences or specific display given * by eAnnotation). */ + @Override protected String elementLabel(GraphicalEditPart editPart) { - int displayValue = ICustomAppearence.DEFAULT_UML_OPERATION; + Collection<String> displayValue = ICustomAppearance.DEFAULT_UML_OPERATION; IMaskManagedLabelEditPolicy policy = (IMaskManagedLabelEditPolicy)editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); if(policy != null) { @@ -90,44 +90,18 @@ public class OperationLabelHelper extends StereotypedElementLabelHelper { } /** - * Returns the mask name given the value of the mask - * - * @return the mask name or <code>null</code> if no masks has been found + * Returns the map of masks used to display an {@link Operation} + * + * @return the {@link Map} of masks used to display a {@link Operation} */ - public String getMaskLabel(int value) { - return masks.get(value); - } - - /** - * Returns the collection of mask names - * - * @return the collection of mask names - */ - public Collection<String> getMaskLabels() { - return masks.values(); - } - - /** - * Returns the map of masks used to display a {@link Property} - * - * @return the {@link Map} of masks used to display a {@link Property} - */ - public Map<Integer, String> getMasks() { + public Map<String, String> getMasks() { return masks; } /** - * Returns the collection of mask values - * - * @return the collection of mask values - */ - public Set<Integer> getMaskValues() { - return masks.keySet(); - } - - /** * {@inheritDoc} */ + @Override public Operation getUMLElement(GraphicalEditPart editPart) { return (Operation)((View)editPart.getModel()).getElement(); } |