Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/PreferenceConstantHelper.java')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/PreferenceConstantHelper.java211
1 files changed, 42 insertions, 169 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/PreferenceConstantHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/PreferenceConstantHelper.java
index 467878e69a7..42b109a99e6 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/PreferenceConstantHelper.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/PreferenceConstantHelper.java
@@ -13,6 +13,8 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.preferences.utils;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
+
/**
* <p>
* A class that defines the available preference type available through Papyrus.
@@ -39,196 +41,147 @@ package org.eclipse.papyrus.infra.gmfdiag.preferences.utils;
* It also helps to retrieve the string used to store the preference type for a given element.
* </p>
*
+ * @deprecated use org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper
*/
+@SuppressWarnings("restriction")
+@Deprecated
public class PreferenceConstantHelper {
/**
* Prefix for preference for Papyrus Level editor
*/
- public static String PAPYRUS_EDITOR_PREFERENCE_PREFIX = "PAPYRUS_EDITOR"; //$NON-NLS-1$
+ public static String PAPYRUS_EDITOR_PREFERENCE_PREFIX = PreferencesConstantsHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX;
/**
* Prefix for preference for Diagram Level
*/
- public static String DIAGRAM_PREFERENCE_PREFIX = "DIAGRAM_"; //$NON-NLS-1$
+ public static String DIAGRAM_PREFERENCE_PREFIX = PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX;
/**
* Prefix for preference for element Level
*/
- public static String DIAGRAM_ELEMENT = "ELEMENT_"; //$NON-NLS-1$
-
- private final static String COLOR = "color."; //$NON-NLS-1$
-
- private final static String GRADIENT = "gradient"; //$NON-NLS-1$
-
- private final static String POLICY = ".policy"; //$NON-NLS-1$
-
- private final static String JUMPLINK = "jumplink."; //$NON-NLS-1$
-
- private final static String ROUTING = "routing"; //$NON-NLS-1$
-
- private final static String ROUTING_POLICY = ROUTING + POLICY;
-
- private final static String COLOR_FILL_CONSTANT = COLOR + "fill"; //$NON-NLS-1$
-
- private final static String FONT_CONSTANT = "font"; //$NON-NLS-1$
-
- private final static String COLOR_FONT_CONSTANT = COLOR + FONT_CONSTANT;
-
- private final static String COLOR_LINE_CONSTANT = COLOR + "line"; //$NON-NLS-1$
-
- private final static String COLOR_GRADIENT_CONSTANT = COLOR + GRADIENT;
-
- private final static String GRADIENT_POLICY_CONSTANT = GRADIENT + POLICY;
-
- private final static String JUMPLINK_STATUS_CONSTANT = JUMPLINK + "status"; //$NON-NLS-1$
-
- private final static String JUMPLINK_REVERSE_CONSTANT = JUMPLINK + "reverse"; //$NON-NLS-1$
-
- private final static String JUMPLINK_TYPE_CONSTANT = JUMPLINK + "type"; //$NON-NLS-1$
+ public static String DIAGRAM_ELEMENT = PreferencesConstantsHelper.DIAGRAM_ELEMENT;
- private final static String ROUTING_POLICY_DISTANCE_CONSTANT = ROUTING_POLICY + ".distance"; //$NON-NLS-1$
-
- private final static String ROUTING_POLICY_OBSTRUCTION_CONSTANT = ROUTING_POLICY + ".obstruction"; //$NON-NLS-1$
-
- private final static String ROUTING_STYLE_CONSTANT = ROUTING + ".style"; //$NON-NLS-1$
-
- private final static String SMOOTHNESS_CONSTANT = "smoothness"; //$NON-NLS-1$
-
- private final static String SHADOW_CONSTANT = "shadow"; //$NON-NLS-1$
-
- private final static String ELEMENTICON_CONSTANT = "elementicon"; //$NON-NLS-1$
-
- private final static String QUALIFIEDNAME_CONSTANT = "qualifiedname"; //$NON-NLS-1$
-
- private final static String HEIGHT_CONSTANT = "height";//$NON-NLS-1$
-
- private final static String WIDTH_CONSTANT = "width"; //$NON-NLS-1$
-
- private final static String COMPARTMENT_VISIBILITY_CONSTANT = "compartment.visibility"; //$NON-NLS-1$
-
- private final static String COMPARTMENT_NAME_VISIBILITY_CONSTANT = "compartment_name.visibility"; //$NON-NLS-1$
-
- private final static String LABEL_VISIBILITY_CONSTANT = "label.visibility"; //$NON-NLS-1$
-
- private final static String LOCATION_X_CONSTANT = "location_x";//$NON-NLS-1$
-
- private final static String LOCATION_Y_CONSTANT = "location_y"; //$NON-NLS-1$
/**
* A preference of type COLOR FILL
*/
- public final static int COLOR_FILL = 0;
+ public final static int COLOR_FILL = PreferencesConstantsHelper.COLOR_FILL;
/**
* A preference of type FONT
*/
- public final static int FONT = COLOR_FILL + 1;
+ public final static int FONT = PreferencesConstantsHelper.FONT;
/**
* A preference of type COLOR FONT
*/
- public final static int COLOR_FONT = FONT + 1;
+ public final static int COLOR_FONT = PreferencesConstantsHelper.COLOR_FONT;
/**
* A preference of type COLOR LINE
*/
- public final static int COLOR_LINE = COLOR_FONT + 1;
+ public final static int COLOR_LINE = PreferencesConstantsHelper.COLOR_LINE;
/**
* A preference of type COLOR GRADIENT
*/
- public final static int COLOR_GRADIENT = COLOR_LINE + 1;
+ public final static int COLOR_GRADIENT = PreferencesConstantsHelper.COLOR_GRADIENT;
/**
* A preference of type GRADIENT POLICY
*/
- public final static int GRADIENT_POLICY = COLOR_GRADIENT + 1;
+ public final static int GRADIENT_POLICY = PreferencesConstantsHelper.GRADIENT_POLICY;
/**
* A preference of type JUMPLINK STATUS
*/
- public final static int JUMPLINK_STATUS = GRADIENT_POLICY + 1;
+ public final static int JUMPLINK_STATUS = PreferencesConstantsHelper.JUMPLINK_STATUS;
/**
* A preference of type JUMPLINK REVERSE
*/
- public final static int JUMPLINK_REVERSE = JUMPLINK_STATUS + 1;
+ public final static int JUMPLINK_REVERSE = PreferencesConstantsHelper.JUMPLINK_REVERSE;
/**
* A preference of type JUMPLINK TYPE
*/
- public final static int JUMPLINK_TYPE = JUMPLINK_REVERSE + 1;
+ public final static int JUMPLINK_TYPE = PreferencesConstantsHelper.JUMPLINK_TYPE;
/**
* A preference of type ROUTING POLICY DISTANCE
*/
- public final static int ROUTING_POLICY_DISTANCE = JUMPLINK_TYPE + 1;
+ public final static int ROUTING_POLICY_DISTANCE = PreferencesConstantsHelper.ROUTING_POLICY_DISTANCE;
/**
* A preference of type ROUTING POLICY OBSTRUCTION
*/
- public final static int ROUTING_POLICY_OBSTRUCTION = ROUTING_POLICY_DISTANCE + 1;
+ public final static int ROUTING_POLICY_OBSTRUCTION = PreferencesConstantsHelper.ROUTING_POLICY_OBSTRUCTION;
/**
* A preference of type ROUTING STYLE
*/
- public final static int ROUTING_STYLE = ROUTING_POLICY_OBSTRUCTION + 1;
+ public final static int ROUTING_STYLE = PreferencesConstantsHelper.ROUTING_STYLE;
/**
* A preference of type SMOOTHNESS
*/
- public final static int SMOOTHNESS = ROUTING_STYLE + 1;
+ public final static int SMOOTHNESS = PreferencesConstantsHelper.SMOOTHNESS;
/**
* A preference of type Shadow
*/
- public final static int SHADOW = SMOOTHNESS + 1;
+ public final static int SHADOW = PreferencesConstantsHelper.SHADOW;
/**
* A preference of type elementIcon
*/
- public final static int ELEMENTICON = SHADOW + 1;
+ public final static int ELEMENTICON = PreferencesConstantsHelper.ELEMENTICON;
/**
* A preference of type QualifiedName
*/
- public final static int QUALIFIEDNAME = ELEMENTICON + 1;
+ public final static int QUALIFIEDNAME = PreferencesConstantsHelper.QUALIFIEDNAME;
/**
* A preference of type height
*/
- public static final int HEIGHT = QUALIFIEDNAME + 1;
+ public static final int HEIGHT = PreferencesConstantsHelper.HEIGHT;
/**
* A preference of type width
*/
- public static final int WIDTH = HEIGHT + 1;
+ public static final int WIDTH = PreferencesConstantsHelper.WIDTH;
/**
* A preference of type compartment visibility
*/
- public static final int COMPARTMENT_VISIBILITY = WIDTH + 1;
+ public static final int COMPARTMENT_VISIBILITY = PreferencesConstantsHelper.COMPARTMENT_VISIBILITY;
/**
* A preference of type compartment visibility
*/
- public static final int COMPARTMENT_NAME_VISIBILITY = COMPARTMENT_VISIBILITY + 1;
+ public static final int COMPARTMENT_NAME_VISIBILITY = PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY;
/**
* A preference of type label visibility
*/
- public static final int LABEL_VISIBILITY = COMPARTMENT_NAME_VISIBILITY + 1;
+ public static final int LABEL_VISIBILITY = PreferencesConstantsHelper.LABEL_VISIBILITY;
/**
* A preference for label default location
*/
- public static final int LOCATION_X = LABEL_VISIBILITY + 1;
+ public static final int LOCATION_X = PreferencesConstantsHelper.LOCATION_X;
/**
* A preference for label default location
*/
- public static final int LOCATION_Y = LOCATION_X + 1;
+ public static final int LOCATION_Y = PreferencesConstantsHelper.LOCATION_Y;
+
+ /**
+ * A preference to diplay or not the rulers
+ */
+ public static final int SHOW_RULER = PreferencesConstantsHelper.VIEW_RULER;
/**
@@ -241,85 +194,7 @@ public class PreferenceConstantHelper {
* @return the constant used.
*/
public static String getConstant(String elementName, int preferenceType) {
- StringBuffer sb = new StringBuffer();
- sb.append(elementName);
- sb.append("."); //$NON-NLS-1$
-
- switch(preferenceType) {
- case COLOR_FILL:
- sb.append(COLOR_FILL_CONSTANT);
- break;
- case FONT:
- sb.append(FONT_CONSTANT);
- break;
- case COLOR_FONT:
- sb.append(COLOR_FONT_CONSTANT);
- break;
- case COLOR_LINE:
- sb.append(COLOR_LINE_CONSTANT);
- break;
- case COLOR_GRADIENT:
- sb.append(COLOR_GRADIENT_CONSTANT);
- break;
- case GRADIENT_POLICY:
- sb.append(GRADIENT_POLICY_CONSTANT);
- break;
- case JUMPLINK_STATUS:
- sb.append(JUMPLINK_STATUS_CONSTANT);
- break;
- case JUMPLINK_REVERSE:
- sb.append(JUMPLINK_REVERSE_CONSTANT);
- break;
- case JUMPLINK_TYPE:
- sb.append(JUMPLINK_TYPE_CONSTANT);
- break;
- case ROUTING_POLICY_DISTANCE:
- sb.append(ROUTING_POLICY_DISTANCE_CONSTANT);
- break;
- case ROUTING_POLICY_OBSTRUCTION:
- sb.append(ROUTING_POLICY_OBSTRUCTION_CONSTANT);
- break;
- case ROUTING_STYLE:
- sb.append(ROUTING_STYLE_CONSTANT);
- break;
- case SMOOTHNESS:
- sb.append(SMOOTHNESS_CONSTANT);
- break;
- case SHADOW:
- sb.append(SHADOW_CONSTANT);
- break;
- case ELEMENTICON:
- sb.append(ELEMENTICON_CONSTANT);
- break;
- case QUALIFIEDNAME:
- sb.append(QUALIFIEDNAME_CONSTANT);
- break;
- case HEIGHT:
- sb.append(HEIGHT_CONSTANT);
- break;
- case WIDTH:
- sb.append(WIDTH_CONSTANT);
- break;
- case COMPARTMENT_VISIBILITY:
- sb.append(COMPARTMENT_VISIBILITY_CONSTANT);
- break;
- case COMPARTMENT_NAME_VISIBILITY:
- sb.append(COMPARTMENT_NAME_VISIBILITY_CONSTANT);
- break;
- case LABEL_VISIBILITY:
- sb.append(LABEL_VISIBILITY_CONSTANT);
- break;
- case LOCATION_X:
- sb.append(LOCATION_X_CONSTANT);
- break;
- case LOCATION_Y:
- sb.append(LOCATION_Y_CONSTANT);
- break;
- default:
- break;
- }
-
- return sb.toString();
+ return PreferencesConstantsHelper.getConstant(elementName, preferenceType);
}
/**
@@ -331,7 +206,7 @@ public class PreferenceConstantHelper {
* @return the key for the element of a diagram
*/
public static String getElementConstant(String elementName, int preferenceType) {
- return DIAGRAM_ELEMENT + getConstant(elementName, preferenceType);
+ return PreferencesConstantsHelper.getElementConstant(elementName, preferenceType);
}
/**
@@ -345,8 +220,7 @@ public class PreferenceConstantHelper {
* @return the key for the element of a diagram
*/
public static String getCompartmentElementConstant(String elementName, String compartmentName, int preferenceType) {
- String tmp = getElementConstant(elementName, preferenceType);
- return tmp.replaceFirst("\\.", "_" + compartmentName + "."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return PreferencesConstantsHelper.getCompartmentElementConstant(elementName, compartmentName, preferenceType);
}
/**
@@ -361,8 +235,7 @@ public class PreferenceConstantHelper {
* @return the key for the element of a diagram
*/
public static String getLabelElementConstant(String elementName, String labelRole, int preferenceType) {
- String tmp = getElementConstant(elementName, preferenceType);
- return tmp.replaceFirst("\\.", "_" + labelRole + "."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return PreferencesConstantsHelper.getLabelElementConstant(elementName, labelRole, preferenceType);
}
/**
@@ -372,7 +245,7 @@ public class PreferenceConstantHelper {
* @return get the preference key at the papyrus editor level
*/
public static String getPapyrusEditorConstant(int preferenceType) {
- return getConstant(PAPYRUS_EDITOR_PREFERENCE_PREFIX, preferenceType);
+ return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
}
/**
@@ -384,7 +257,7 @@ public class PreferenceConstantHelper {
* @return the preference key at the diagram level
*/
public static String getDiagramConstant(String diagramKind, int preferenceType) {
- return DIAGRAM_PREFERENCE_PREFIX + getConstant(diagramKind, preferenceType);
+ return PreferencesConstantsHelper.getDiagramConstant(diagramKind, preferenceType);
}
}

Back to the top