From 59ce8f4db28685083549d1ea989f08b939f6af43 Mon Sep 17 00:00:00 2001
From: Vincent Lorenzo
Date: Wed, 11 Dec 2013 17:28:28 +0100
Subject: 422553: [Diagram] Status (checked/uncheked) of the grid actions are
not updated when we change a new diagram take the focus
https://bugs.eclipse.org/bugs/show_bug.cgi?id=422553
422406: Snap to grid disabled still makes snap to grid
https://bugs.eclipse.org/bugs/show_bug.cgi?id=422406
423799: [Diagram]Rulers and Grid preferences are not customizable for
each diagrams
https://bugs.eclipse.org/bugs/show_bug.cgi?id=423799
423805: [Preferences] Key used for Preferences is the string "null" for
all inherited diagrams (SysML Diagram + Uml Package +...)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=423805---
.../META-INF/MANIFEST.MF | 3 +-
.../common/SynchronizableGmfDiagramEditor.java | 98 +++-
.../infra/gmfdiag/common/messages/Messages.java | 21 +
.../gmfdiag/common/messages/messages.properties | 3 +
.../preferences/PreferencesConstantsHelper.java | 498 +++++++++++++++++++++
.../common/providers/LineStyleLabelProvider.java | 120 +++++
.../common/providers/UnitsLabelProvider.java | 106 +++++
.../infra/gmfdiag/common/utils/CommandIds.java | 32 ++
.../gmfdiag/common/utils/DiagramEditPartsUtil.java | 60 +++
.../infra/gmfdiag/common/utils/UnitsConstants.java | 48 ++
.../gmfdiag/common/utils/UnitsConverterUtils.java | 108 +++++
.../build.properties | 3 +-
.../plugin.pdoc | 4 +
.../META-INF/MANIFEST.MF | 4 +-
.../plugin.xml | 17 -
.../preferences/PapyrusPreferenceInitializer.java | 3 +-
.../preferences/PapyrusPreferenceStore.java | 22 +-
.../gmfdiag/preferences/messages/Messages.java | 22 +
.../preferences/messages/messages.properties | 6 +
.../AbstractPapyrusElementPreferencePage.java | 6 +-
.../preferences/pages/DiagramPreferencePage.java | 6 +-
.../pages/PapyrusAllDiagramsPreferencePage.java | 43 +-
.../PapyrusRulersAndGridPreferencePage.java | 72 ---
.../gmfdiag/preferences/ui/AbstractGroup.java | 6 +-
.../gmfdiag/preferences/ui/BackgroundColor.java | 6 +-
.../gmfdiag/preferences/ui/ConnectionGroup.java | 16 +-
.../gmfdiag/preferences/ui/DecorationGroup.java | 6 +
.../gmfdiag/preferences/ui/DimensionGroup.java | 6 +-
.../infra/gmfdiag/preferences/ui/FontGroup.java | 5 +-
.../infra/gmfdiag/preferences/ui/LabelGroup.java | 4 +-
.../gmfdiag/preferences/ui/LinkColorGroup.java | 6 +-
.../gmfdiag/preferences/ui/NodeColorGroup.java | 4 +-
.../preferences/ui/NodeCompartmentGroup.java | 6 +-
.../preferences/ui/OrderedCompartmentGroup.java | 6 +-
.../gmfdiag/preferences/ui/OrderedLabelGroup.java | 4 +-
.../gmfdiag/preferences/ui/RulersAndGridGroup.java | 494 ++++++++++++++++++++
.../ui/diagram/DiagramBackgroundColor.java | 4 +-
.../ui/diagram/DiagramConnectionGroup.java | 4 +-
.../ui/diagram/DiagramDecorationGroup.java | 1 -
.../ui/diagram/DiagramDimensionGroup.java | 4 +-
.../preferences/ui/diagram/DiagramFontGroup.java | 4 +-
.../ui/diagram/DiagramLinkColorGroup.java | 4 +-
.../ui/diagram/DiagramNodeColorGroup.java | 4 +-
.../ui/diagram/DiagramRulersAndGridGroup.java | 51 +++
.../ui/dialog/AbstractPreferenceKeyDialog.java | 22 +-
.../ui/editor/EditorBackgroundColor.java | 4 +-
.../ui/editor/EditorConnectionGroup.java | 4 +-
.../ui/editor/EditorDecorationGroup.java | 4 +-
.../ui/editor/EditorDimensionGroup.java | 4 +-
.../preferences/ui/editor/EditorFontGroup.java | 4 +-
.../ui/editor/EditorLinkColorGroup.java | 4 +-
.../ui/editor/EditorNodeColorGroup.java | 4 +-
.../ui/editor/EditorRulersAndGridGroup.java | 49 ++
.../utils/PreferenceConstantHelper.java | 211 ++-------
.../model/Environment.xmi | 51 ++-
.../model/notation/notation.ctx | 27 ++
.../model/notation/ui/SingleLocation.xwt | 5 +-
.../model/notation/ui/SingleRulersAndGrid.xwt | 2 +
.../IsSingleDiagramEditorConstraint.java | 42 ++
.../AbstractDiagramPreferencesObservableValue.java | 103 +++++
.../BooleanDiagramViewObservableValue.java | 79 ++++
.../DoubleDiagramViewObservaleValue.java | 83 ++++
.../IntegerDiagramViewObservableValue.java | 79 ++++
.../databinding/RulersUnitObservableValue.java | 65 +++
.../gmfdiag/properties/messages/Messages.java | 2 +
.../properties/messages/messages.properties | 1 +
.../modelelement/RulerAndGridModelElement.java | 191 ++++++++
.../RulersAndGridModelElementFactory.java | 61 +++
.../gmfdiag/properties/util/NotationUtil.java | 13 +
.../util/RulersAndGridPropertyConstants.java | 47 ++
.../widget/DiagramPreferencesDefaultButton.java | 159 +++++++
.../infra/tools/util/EclipseCommandUtils.java | 40 ++
72 files changed, 2928 insertions(+), 382 deletions(-)
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/Messages.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/messages.properties
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/LineStyleLabelProvider.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/UnitsLabelProvider.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/CommandIds.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/UnitsConstants.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/UnitsConverterUtils.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.pdoc
delete mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusRulersAndGridPreferencePage.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/RulersAndGridGroup.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramRulersAndGridGroup.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorRulersAndGridGroup.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/ui/SingleRulersAndGrid.xwt
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsSingleDiagramEditorConstraint.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/AbstractDiagramPreferencesObservableValue.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/BooleanDiagramViewObservableValue.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/DoubleDiagramViewObservaleValue.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/IntegerDiagramViewObservableValue.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/RulersUnitObservableValue.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/RulerAndGridModelElement.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/RulersAndGridModelElementFactory.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/RulersAndGridPropertyConstants.java
create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/widget/DiagramPreferencesDefaultButton.java
(limited to 'plugins/infra')
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
index 725995de2b5..80a1fd2e335 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
@@ -48,7 +48,8 @@ Require-Bundle: org.eclipse.emf.edit.ui;bundle-version="2.5.0",
org.apache.batik.dom.svg;bundle-version="[1.6.0,1.7.0)",
org.apache.batik.dom;bundle-version="[1.6.0,1.7.0)",
org.apache.batik.xml;bundle-version="[1.6.0,1.7.0)",
- org.eclipse.gmf.tooling.runtime
+ org.eclipse.gmf.tooling.runtime,
+ com.ibm.icu
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/SynchronizableGmfDiagramEditor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/SynchronizableGmfDiagramEditor.java
index 9e8cd47e2d4..03d97ac1ca3 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/SynchronizableGmfDiagramEditor.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/SynchronizableGmfDiagramEditor.java
@@ -21,15 +21,27 @@ import java.util.List;
import org.eclipse.gef.DefaultEditDomain;
import org.eclipse.gef.GraphicalViewer;
import org.eclipse.gef.commands.CommandStack;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.internal.properties.WorkspaceViewerProperties;
import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer;
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.papyrus.commands.CheckedDiagramCommandStack;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.CommandIds;
+import org.eclipse.papyrus.infra.tools.util.EclipseCommandUtils;
import org.eclipse.papyrus.infra.widgets.util.IRevealSemanticElement;
import org.eclipse.papyrus.infra.widgets.util.NavigationTarget;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
/**
*
@@ -37,6 +49,8 @@ import org.eclipse.papyrus.infra.widgets.util.NavigationTarget;
*
*/
+@SuppressWarnings("restriction")
+//suppress the warning for WorkspaceViewerProperties
public class SynchronizableGmfDiagramEditor extends DiagramDocumentEditor implements IRevealSemanticElement, NavigationTarget {
public SynchronizableGmfDiagramEditor(boolean hasFlyoutPalette) {
@@ -113,8 +127,11 @@ public class SynchronizableGmfDiagramEditor extends DiagramDocumentEditor implem
return false;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
- public Object getAdapter(Class type) {
+ public Object getAdapter(@SuppressWarnings("rawtypes") Class type) {
if(type == DiagramEditPart.class) {
return getDiagramEditPart();
}
@@ -149,4 +166,83 @@ public class SynchronizableGmfDiagramEditor extends DiagramDocumentEditor implem
DiagramEditDomain diagEditDomain = (DiagramEditDomain)getDiagramEditDomain();
diagEditDomain.setActionManager(createActionManager());
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setFocus() {
+ super.setFocus();
+ updateToggleActionState();
+ }
+
+
+ /**
+ * this command update the status of the toggle actions
+ */
+ protected void updateToggleActionState() {
+ final ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(ICommandService.class);
+ if(commandService != null) {
+ final IPreferenceStore wsPreferenceStore = ((DiagramGraphicalViewer)getDiagramGraphicalViewer()).getWorkspaceViewerPreferenceStore();
+ org.eclipse.core.commands.Command command = commandService.getCommand(CommandIds.VIEW_GRID_COMMAND);
+ EclipseCommandUtils.updateToggleCommandState(command, wsPreferenceStore.getBoolean(WorkspaceViewerProperties.VIEWGRID));
+
+ command = commandService.getCommand(CommandIds.VIEW_RULER_COMMAND);
+ EclipseCommandUtils.updateToggleCommandState(command, wsPreferenceStore.getBoolean(WorkspaceViewerProperties.VIEWRULERS));
+
+ command = commandService.getCommand(CommandIds.VIEW_PAGE_BREAK_COMMAND);
+ EclipseCommandUtils.updateToggleCommandState(command, wsPreferenceStore.getBoolean(WorkspaceViewerProperties.VIEWPAGEBREAKS));
+
+ command = commandService.getCommand(CommandIds.SNAP_TO_GRID_COMMAND);
+ EclipseCommandUtils.updateToggleCommandState(command, wsPreferenceStore.getBoolean(WorkspaceViewerProperties.SNAPTOGRID));
+
+ } else {
+ throw new RuntimeException(String.format("The Eclipse service {0} has not been found", ICommandService.class)); //$NON-NLS-1$
+ }
+ }
+
+
+ @Override
+ protected void addDefaultPreferences() {
+ super.addDefaultPreferences();
+ final PreferencesHint preferencesHint = getPreferencesHint();
+ final IPreferenceStore globalPreferenceStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
+ final String diagramType = getDiagram().getType();
+ //get the preferences
+ final boolean viewGrid = globalPreferenceStore.getBoolean(PreferencesConstantsHelper.getDiagramConstant(diagramType, PreferencesConstantsHelper.VIEW_GRID));
+ final boolean viewRuler = globalPreferenceStore.getBoolean(PreferencesConstantsHelper.getDiagramConstant(diagramType, PreferencesConstantsHelper.VIEW_RULER));
+ final int rulerUnit = globalPreferenceStore.getInt(PreferencesConstantsHelper.getDiagramConstant(diagramType, PreferencesConstantsHelper.RULER_UNITS));
+ final boolean snapToGrid = globalPreferenceStore.getBoolean(PreferencesConstantsHelper.getDiagramConstant(diagramType, PreferencesConstantsHelper.SNAP_TO_GRID));
+ final boolean snapToGeometry = globalPreferenceStore.getBoolean(PreferencesConstantsHelper.getDiagramConstant(diagramType, PreferencesConstantsHelper.SNAP_TO_GEOMETRY));
+ final RGB rgb = PreferenceConverter.getColor(globalPreferenceStore, PreferencesConstantsHelper.getDiagramConstant(diagramType, PreferencesConstantsHelper.GRID_LINE_COLOR));
+ final int gridLineColor = FigureUtilities.RGBToInteger(rgb);
+ final double gridSpacing = globalPreferenceStore.getDouble(PreferencesConstantsHelper.getDiagramConstant(diagramType, PreferencesConstantsHelper.GRID_SPACING));
+ final boolean gridOrder = globalPreferenceStore.getBoolean(PreferencesConstantsHelper.getDiagramConstant(diagramType, PreferencesConstantsHelper.GRID_ORDER));
+ final int gridLineStyle = globalPreferenceStore.getInt(PreferencesConstantsHelper.getDiagramConstant(diagramType, PreferencesConstantsHelper.GRID_LINE_STYLE));
+
+ //set the preferences
+ final IPreferenceStore localStore = getWorkspaceViewerPreferenceStore();
+ // localStore.setValue(PreferencesConstantsHelper.SHOW_GRID_CONSTANT, viewGrid);
+ // localStore.setValue(PreferencesConstantsHelper.SHOW_RULER_CONSTANT, viewRuler);
+ // localStore.setValue(PreferencesConstantsHelper.RULER_UNITS_CONSTANT, rulerUnit);
+ // localStore.setValue(PreferencesConstantsHelper.SNAP_TO_GRID_CONSTANT, snapToGrid);
+ // localStore.setValue(PreferencesConstantsHelper.SNAP_TO_SHAPE_CONSTANT, snapToGeometry);
+ // localStore.setValue(PreferencesConstantsHelper.GRID_COLOR_CONSTANT, gridLineColor);
+ // localStore.setValue(PreferencesConstantsHelper.GRID_SPACING_CONSTANT, gridSpacing);
+ // localStore.setValue(PreferencesConstantsHelper.GRID_ORDER_CONSTANT, gridOrder);
+ // localStore.setValue(PreferencesConstantsHelper.GRID_STYLE_CONSTANT, gridLineStyle);
+
+ localStore.setDefault(PreferencesConstantsHelper.VIEW_GRID_CONSTANT, viewGrid);
+ localStore.setDefault(PreferencesConstantsHelper.VIEW_RULERS_CONSTANT, viewRuler);
+ localStore.setDefault(PreferencesConstantsHelper.RULER_UNITS_CONSTANT, rulerUnit);
+ localStore.setDefault(PreferencesConstantsHelper.SNAP_TO_GRID_CONSTANT, snapToGrid);
+ localStore.setDefault(PreferencesConstantsHelper.SNAP_TO_GEOMETRY_CONSTANT, snapToGeometry);
+ localStore.setDefault(PreferencesConstantsHelper.GRID_LINE_COLOR_CONSTANT, gridLineColor);
+ localStore.setDefault(PreferencesConstantsHelper.GRID_SPACING_CONSTANT, gridSpacing);
+ localStore.setDefault(PreferencesConstantsHelper.GRID_ORDER_CONSTANT, gridOrder);
+ localStore.setDefault(PreferencesConstantsHelper.GRID_LINE_STYLE_CONSTANT, gridLineStyle);
+
+ }
+
+
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/Messages.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/Messages.java
new file mode 100644
index 00000000000..0843a4eafb7
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/Messages.java
@@ -0,0 +1,21 @@
+package org.eclipse.papyrus.infra.gmfdiag.common.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.gmfdiag.common.messages.messages"; //$NON-NLS-1$
+
+ public static String UnitsUtils_Centimeters;
+
+ public static String UnitsUtils_Inches;
+
+ public static String UnitsUtils_Pixels;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/messages.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/messages.properties
new file mode 100644
index 00000000000..1d8adde52ab
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/messages.properties
@@ -0,0 +1,3 @@
+UnitsUtils_Centimeters=Centimeters
+UnitsUtils_Inches=Inches
+UnitsUtils_Pixels=Pixels
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java
new file mode 100644
index 00000000000..abdbd81534a
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java
@@ -0,0 +1,498 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.preferences;
+
+import org.eclipse.gmf.runtime.diagram.ui.internal.properties.WorkspaceViewerProperties;
+
+
+
+/**
+ *
+ * A class that defines the available preference type available through Papyrus.
+ *
+ *
+ * It defines the following type:
+ *
+ *
+ * - COLOR_FILL
+ * - FONT
+ * - COLOR_FONT
+ * - COLOR_LINE
+ * - COLOR_GRADIENT
+ * - GRADIENT_POLICY
+ * - JUMPLINK_STATUS
+ * - JUMPLINK_REVERSE
+ * - JUMPLINK_TYPE
+ * - ROUTING_POLICY_DISTANCE
+ * - ROUTING_POLICY_OBSTRUCTION
+ * - ROUTING_STYLE
+ * - SMOOTHNESS
+ *
+ *
+ * It also helps to retrieve the string used to store the preference type for a given element.
+ *
+ *
+ */
+@SuppressWarnings("restriction")
+public class PreferencesConstantsHelper {
+
+ /**
+ * Prefix for preference for Papyrus Level editor
+ */
+ public static String PAPYRUS_EDITOR_PREFERENCE_PREFIX = "PAPYRUS_EDITOR"; //$NON-NLS-1$
+
+ /**
+ * Prefix for preference for Diagram Level
+ */
+ public static String DIAGRAM_PREFERENCE_PREFIX = "DIAGRAM_"; //$NON-NLS-1$
+
+ /**
+ * 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$
+
+ 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$
+
+ public final static String VIEW_RULERS_CONSTANT = WorkspaceViewerProperties.VIEWRULERS;
+
+ public final static String VIEW_GRID_CONSTANT = WorkspaceViewerProperties.VIEWGRID;
+
+ public final static String RULER_UNITS_CONSTANT = WorkspaceViewerProperties.RULERUNIT;
+
+ public final static String SNAP_TO_GRID_CONSTANT = WorkspaceViewerProperties.SNAPTOGRID;
+
+ public final static String SNAP_TO_GEOMETRY_CONSTANT = WorkspaceViewerProperties.SNAPTOGEOMETRY;
+
+ public final static String GRID_LINE_COLOR_CONSTANT = WorkspaceViewerProperties.GRIDLINECOLOR;
+
+ public final static String GRID_SPACING_CONSTANT = WorkspaceViewerProperties.GRIDSPACING;
+
+ public final static String GRID_ORDER_CONSTANT = WorkspaceViewerProperties.GRIDORDER;
+
+ public final static String GRID_LINE_STYLE_CONSTANT = WorkspaceViewerProperties.GRIDLINESTYLE;
+
+ public final static String VIEW_PAGE_BREAK_CONSTANT = WorkspaceViewerProperties.VIEWPAGEBREAKS;
+
+
+ /**
+ * A preference of type COLOR FILL
+ */
+ public final static int COLOR_FILL = 0;
+
+ /**
+ * A preference of type FONT
+ */
+ public final static int FONT = COLOR_FILL + 1;
+
+ /**
+ * A preference of type COLOR FONT
+ */
+ public final static int COLOR_FONT = FONT + 1;
+
+ /**
+ * A preference of type COLOR LINE
+ */
+ public final static int COLOR_LINE = COLOR_FONT + 1;
+
+ /**
+ * A preference of type COLOR GRADIENT
+ */
+ public final static int COLOR_GRADIENT = COLOR_LINE + 1;
+
+ /**
+ * A preference of type GRADIENT POLICY
+ */
+ public final static int GRADIENT_POLICY = COLOR_GRADIENT + 1;
+
+ /**
+ * A preference of type JUMPLINK STATUS
+ */
+ public final static int JUMPLINK_STATUS = GRADIENT_POLICY + 1;
+
+ /**
+ * A preference of type JUMPLINK REVERSE
+ */
+ public final static int JUMPLINK_REVERSE = JUMPLINK_STATUS + 1;
+
+ /**
+ * A preference of type JUMPLINK TYPE
+ */
+ public final static int JUMPLINK_TYPE = JUMPLINK_REVERSE + 1;
+
+ /**
+ * A preference of type ROUTING POLICY DISTANCE
+ */
+ public final static int ROUTING_POLICY_DISTANCE = JUMPLINK_TYPE + 1;
+
+ /**
+ * A preference of type ROUTING POLICY OBSTRUCTION
+ */
+ public final static int ROUTING_POLICY_OBSTRUCTION = ROUTING_POLICY_DISTANCE + 1;
+
+ /**
+ * A preference of type ROUTING STYLE
+ */
+ public final static int ROUTING_STYLE = ROUTING_POLICY_OBSTRUCTION + 1;
+
+ /**
+ * A preference of type SMOOTHNESS
+ */
+ public final static int SMOOTHNESS = ROUTING_STYLE + 1;
+
+ /**
+ * A preference of type Shadow
+ */
+ public final static int SHADOW = SMOOTHNESS + 1;
+
+ /**
+ * A preference of type elementIcon
+ */
+ public final static int ELEMENTICON = SHADOW + 1;
+
+ /**
+ * A preference of type QualifiedName
+ */
+ public final static int QUALIFIEDNAME = ELEMENTICON + 1;
+
+ /**
+ * A preference of type height
+ */
+ public static final int HEIGHT = QUALIFIEDNAME + 1;
+
+ /**
+ * A preference of type width
+ */
+ public static final int WIDTH = HEIGHT + 1;
+
+ /**
+ * A preference of type compartment visibility
+ */
+ public static final int COMPARTMENT_VISIBILITY = WIDTH + 1;
+
+ /**
+ * A preference of type compartment visibility
+ */
+ public static final int COMPARTMENT_NAME_VISIBILITY = COMPARTMENT_VISIBILITY + 1;
+
+ /**
+ * A preference of type label visibility
+ */
+ public static final int LABEL_VISIBILITY = COMPARTMENT_NAME_VISIBILITY + 1;
+
+ /**
+ * A preference for label default location
+ */
+ public static final int LOCATION_X = LABEL_VISIBILITY + 1;
+
+ /**
+ * A preference for label default location
+ */
+ public static final int LOCATION_Y = LOCATION_X + 1;
+
+ /**
+ * A preference to diplay or not the rulers
+ */
+ public static final int VIEW_RULER = LOCATION_Y + 1;
+
+ /**
+ * A preference to diplay or not the grid
+ */
+
+ public static final int VIEW_GRID = VIEW_RULER + 1;
+
+ /**
+ * A preference to change the ruler unit
+ */
+
+ public static final int RULER_UNITS = VIEW_GRID + 1;
+
+ /**
+ * A preference to snap the created element to the grid
+ */
+ public static final int SNAP_TO_GRID = RULER_UNITS + 1;
+
+ /**
+ * A preference to snap the created element to the shape
+ */
+ public static final int SNAP_TO_GEOMETRY = SNAP_TO_GRID + 1;
+
+ /**
+ * A preference to change the grid color
+ */
+ public static final int GRID_LINE_COLOR = SNAP_TO_GEOMETRY + 1;
+
+ /**
+ * A preference to change the grid spacing
+ */
+ public static final int GRID_SPACING = GRID_LINE_COLOR + 1;
+
+ /**
+ * A preference to change the Z order of the Grid
+ */
+ public static final int GRID_ORDER = GRID_SPACING + 1;
+
+ /**
+ * A preference to change the style of the grid
+ */
+ public static final int GRID_LINE_STYLE = GRID_ORDER + 1;
+
+ /**
+ * A preference to view the page break on the diagram
+ */
+ public static final int VIEW_PAGE_BREAK = GRID_LINE_STYLE + 1;
+
+
+ /**
+ * Get the preference constant used to store the preference of an element.
+ *
+ * @param elementName
+ * the name of the element
+ * @param preferenceType
+ * the type of preference to store. It must be a value defined in {@link 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;
+ case VIEW_RULER:
+ sb.append(VIEW_RULERS_CONSTANT);
+ break;
+ case VIEW_GRID:
+ sb.append(VIEW_GRID_CONSTANT);
+ break;
+ case RULER_UNITS:
+ sb.append(RULER_UNITS_CONSTANT);
+ break;
+ case SNAP_TO_GRID:
+ sb.append(SNAP_TO_GRID_CONSTANT);
+ break;
+ case SNAP_TO_GEOMETRY:
+ sb.append(SNAP_TO_GEOMETRY_CONSTANT);
+ break;
+ case GRID_LINE_COLOR:
+ sb.append(GRID_LINE_COLOR_CONSTANT);
+ break;
+ case GRID_SPACING:
+ sb.append(GRID_SPACING_CONSTANT);
+ break;
+ case GRID_ORDER:
+ sb.append(GRID_ORDER_CONSTANT);
+ break;
+ case GRID_LINE_STYLE:
+ sb.append(GRID_LINE_STYLE_CONSTANT);
+ break;
+ case VIEW_PAGE_BREAK:
+ sb.append(VIEW_PAGE_BREAK_CONSTANT);
+ break;
+ default:
+ break;
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ *
+ * @param elementName
+ * diagramKind+'_'+element
+ * @param preferenceType
+ * the type of preference to store. It must be a value defined in {@link PreferenceConstantHelper}
+ * @return the key for the element of a diagram
+ */
+ public static String getElementConstant(String elementName, int preferenceType) {
+ return DIAGRAM_ELEMENT + getConstant(elementName, preferenceType);
+ }
+
+ /**
+ *
+ * @param elementName
+ * diagramKind+'_'+element
+ * @param compartmentName
+ * the compartment name
+ * @param preferenceType
+ * the type of preference to store. It must be a value defined in {@link 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$
+ }
+
+ /**
+ *
+ *
+ * @param elementName
+ * diagramKind+'_'+element
+ * @param labelRole
+ * he role of the label
+ * @param preferenceType
+ * the type of preference to store. It must be a value defined in {@link 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$
+ }
+
+ /**
+ *
+ * @param preferenceType
+ * the type of preference to store. It must be a value defined in {@link PreferenceConstantHelper}
+ * @return get the preference key at the papyrus editor level
+ */
+ public static String getPapyrusEditorConstant(int preferenceType) {
+ return getConstant(PAPYRUS_EDITOR_PREFERENCE_PREFIX, preferenceType);
+ }
+
+ /**
+ *
+ * @param diagramKind
+ * the kind of diagram.
+ * @param preferenceType
+ * the type of preference to store. It must be a value defined in {@link PreferenceConstantHelper}
+ * @return the preference key at the diagram level
+ */
+ public static String getDiagramConstant(String diagramKind, int preferenceType) {
+ return DIAGRAM_PREFERENCE_PREFIX + getConstant(diagramKind, preferenceType);
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/LineStyleLabelProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/LineStyleLabelProvider.java
new file mode 100644
index 00000000000..2da396ee2a3
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/LineStyleLabelProvider.java
@@ -0,0 +1,120 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.providers;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ *
+ * Label Provider for line style
+ *
+ */
+public class LineStyleLabelProvider implements ILabelProvider {
+
+
+ public static final String LINE_STYLE_SOLID_STRING = "Solid";
+
+ public static final String LINE_STYLE_DASH_STRING = "Dash";
+
+ public static final String LINE_STYLE_DOT_STRING = "Dot";
+
+ public static final String LINE_STYLE_DASH_DOT_STRING = "Dash Dot";
+
+ public static final String LINE_STYLE_DASH_DOT_DOT_STRING = "Dash Dot Dot";
+
+ public static final String LINE_STYLE_CUSTOM = "Custom";
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ *
+ */
+ public void dispose() {
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+ *
+ * @param element
+ * @param property
+ * @return
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ public String getText(Object element) {
+ if(element instanceof Integer) {
+ int lineStyle = (Integer)element;
+ switch(lineStyle) {
+ case Graphics.LINE_SOLID:
+ return LINE_STYLE_SOLID_STRING;
+ case Graphics.LINE_DASH:
+ return LINE_STYLE_DASH_STRING;
+ case Graphics.LINE_DOT:
+ return LINE_STYLE_DOT_STRING;
+ case Graphics.LINE_DASHDOT:
+ return LINE_STYLE_DASH_DOT_STRING;
+ case Graphics.LINE_DASHDOTDOT:
+ return LINE_STYLE_DASH_DOT_DOT_STRING;
+ case Graphics.LINE_CUSTOM:
+ return LINE_STYLE_CUSTOM;
+ default:
+ break;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/UnitsLabelProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/UnitsLabelProvider.java
new file mode 100644
index 00000000000..e2357c150a2
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/UnitsLabelProvider.java
@@ -0,0 +1,106 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.providers;
+
+import org.eclipse.gef.rulers.RulerProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.UnitsConstants;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ *
+ * Label provider for Units
+ *
+ */
+public class UnitsLabelProvider implements ILabelProvider {
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
+ public void addListener(ILabelProviderListener listener) {
+ //not used
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ *
+ */
+ public void dispose() {
+ //not used
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+ *
+ * @param element
+ * @param property
+ * @return
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ //not used
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ public Image getImage(Object element) {
+ //not used
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ public String getText(Object element) {
+ if(element instanceof Integer) {
+ final int unit = (Integer)element;
+ switch(unit) {
+ case RulerProvider.UNIT_INCHES:
+ return UnitsConstants.INCHES;
+ case RulerProvider.UNIT_CENTIMETERS:
+ return UnitsConstants.CENTIMETERS;
+ case RulerProvider.UNIT_PIXELS:
+ return UnitsConstants.PIXELS;
+ default:
+ break;
+ }
+ }
+ return "";
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/CommandIds.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/CommandIds.java
new file mode 100644
index 00000000000..d5817c13ede
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/CommandIds.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.utils;
+
+
+public class CommandIds {
+
+ private CommandIds() {
+ //to prevent instanciation
+ }
+
+ public static final String VIEW_GRID_COMMAND = "org.eclipse.papyrus.infra.gmfdiag.menu.ViewGridCommand"; //$NON-NLS-1$
+
+ public static final String VIEW_RULER_COMMAND = "org.eclipse.papyrus.infra.gmfdiag.menu.ViewRulersCommand"; //$NON-NLS-1$
+
+ public static final String VIEW_PAGE_BREAK_COMMAND = "org.eclipse.papyrus.infra.gmfdiag.menu.ViewPageBreaksCommand"; //$NON-NLS-1$
+
+ public static final String SNAP_TO_GRID_COMMAND = "org.eclipse.papyrus.infra.gmfdiag.menu.SnapToGridCommand"; //$NON-NLS-1$
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramEditPartsUtil.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramEditPartsUtil.java
index 5cfb8066367..8bb8d38c5f9 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramEditPartsUtil.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramEditPartsUtil.java
@@ -18,16 +18,27 @@ import java.util.HashSet;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.tools.util.EditorHelper;
+import org.eclipse.ui.IWorkbenchPart;
/**
* Different utility methods to manage and manipulate edit parts in diagrams.
*/
public class DiagramEditPartsUtil {
+ private DiagramEditPartsUtil() {
+ //to prevent instanciation
+ }
+
/**
* Returns the edit part that controls the given view.
*
@@ -129,4 +140,53 @@ public class DiagramEditPartsUtil {
}
return null;
}
+
+
+ /**
+ * A utility method to return the active DiagramEditPart
if
+ * the current part implements IDiagramWorkbenchPart
+ *
+ * @return The current diagram if the parts implements IDiagramWorkbenchPart
; null
otherwise
+ */
+ public static final IDiagramGraphicalViewer getActiveDiagramGraphicalViewer() {
+ IDiagramWorkbenchPart part = getActiveDiagramWorkbenchPart();
+ return part != null ? part.getDiagramGraphicalViewer() : null;
+ }
+
+ /**
+ * A utility method to return the active part if it implements
+ * or adapts to the IDiagramWorkbenchPart
interface
+ *
+ * @return The current part if it implements or adapts to IDiagramWorkbenchPart
; null
otherwise
+ */
+ public static final IDiagramWorkbenchPart getActiveDiagramWorkbenchPart() {
+ IDiagramWorkbenchPart diagramPart = null;
+
+ IWorkbenchPart part = EditorHelper.getActivePart();
+
+ if(part instanceof IDiagramWorkbenchPart) {
+ diagramPart = (IDiagramWorkbenchPart)part;
+
+ } else if(part != null) {
+ diagramPart = (IDiagramWorkbenchPart)part.getAdapter(IDiagramWorkbenchPart.class);
+ }
+
+ return diagramPart;
+ }
+
+ /**
+ *
+ * @param anEditPart
+ * an edit part
+ * @return
+ * the preference store for the diagram owning this edit part or null
if not found
+ *
+ */
+ public static final IPreferenceStore getDiagramWorkspacePreferenceStore(final EditPart anEditPart) {
+ final EditPartViewer viewer = anEditPart.getViewer();
+ if(viewer instanceof DiagramGraphicalViewer) {
+ return ((DiagramGraphicalViewer)viewer).getWorkspaceViewerPreferenceStore();
+ }
+ return null;
+ }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/UnitsConstants.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/UnitsConstants.java
new file mode 100644
index 00000000000..3e1b8b7efa0
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/UnitsConstants.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.utils;
+
+import org.eclipse.papyrus.infra.gmfdiag.common.messages.Messages;
+
+/**
+ *
+ * This class provides useful constants for Units
+ *
+ */
+public class UnitsConstants {
+
+ private UnitsConstants() {
+ //to prevent instanciation
+ }
+
+ /**
+ * 1 inch is equivalent to 2.54 centimeters
+ */
+ public static final double INCH2CM = 2.54;
+
+ /**
+ * the string Inches
+ */
+ public static final String INCHES = Messages.UnitsUtils_Inches;
+
+ /**
+ * the string millimeters
+ */
+ public static final String CENTIMETERS = Messages.UnitsUtils_Centimeters;
+
+ /**
+ * the string pixels
+ */
+ public static final String PIXELS = Messages.UnitsUtils_Pixels;
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/UnitsConverterUtils.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/UnitsConverterUtils.java
new file mode 100644
index 00000000000..3471b80cfd7
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/UnitsConverterUtils.java
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.utils;
+
+import java.text.ParseException;
+
+import org.eclipse.gef.rulers.RulerProvider;
+import org.eclipse.swt.widgets.Display;
+
+import com.ibm.icu.text.NumberFormat;
+
+/**
+ *
+ * This class allows to convert easily units (Centimeters, Pixels and Inches)
+ *
+ */
+public class UnitsConverterUtils {
+
+ private UnitsConverterUtils() {
+ //to avoid instanciation
+ }
+
+ /**
+ *
+ * @param fromUnits
+ * the initial unity
+ * @param toUnits
+ * the new unity
+ * @param valueStr
+ * the value to convert
+ * @return
+ * the new String
+ */
+ public static final String convertUnits(final int fromUnits, final int toUnits, final String valueStr) {
+ // String valueStr = gridSpacing.getStringValue();
+ if(fromUnits == toUnits) {
+ return valueStr;
+ }
+
+ //Double value = Double.valueOf( valueStr );
+ NumberFormat numberFormatter = NumberFormat.getInstance();
+ Double value = new Double(0.125);
+ try {
+ value = forceDouble(numberFormatter.parse(valueStr));
+ } catch (ParseException e) {
+ // Use the default
+ }
+ double pixelValue = 0;
+
+ Display display = Display.getDefault();
+
+ switch(fromUnits) {
+ case RulerProvider.UNIT_INCHES:
+ pixelValue = value.doubleValue() * display.getDPI().x;
+ break;
+ case RulerProvider.UNIT_CENTIMETERS:
+ pixelValue = value.doubleValue() * display.getDPI().x / UnitsConstants.INCH2CM;
+ break;
+ case RulerProvider.UNIT_PIXELS:
+ pixelValue = value.intValue();
+ break;
+ default:
+ break;
+ }
+
+ double returnValue = 0;
+ switch(toUnits) {
+ case RulerProvider.UNIT_INCHES:
+ returnValue = pixelValue / display.getDPI().x;
+ break;
+ case RulerProvider.UNIT_CENTIMETERS:
+ returnValue = pixelValue * UnitsConstants.INCH2CM / display.getDPI().x;
+ break;
+ case RulerProvider.UNIT_PIXELS:
+ returnValue = pixelValue;
+ break;
+ default:
+ break;
+ }
+
+ return numberFormatter.format(returnValue);
+ }
+
+ /**
+ *
+ * @param number
+ * a number
+ * @return
+ * a double
+ */
+ private static final Double forceDouble(final Number number) {
+ if(!(number instanceof Double)) {
+ return new Double(number.doubleValue());
+ }
+ return (Double)number;
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/build.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/build.properties
index 33bbfa24829..3b1a0489a19 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/build.properties
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/build.properties
@@ -5,5 +5,6 @@ bin.includes = META-INF/,\
plugin.xml,\
OSGI-INF/,\
about.html,\
- icons/
+ icons/,\
+ plugin.pdoc
src.includes = about.html
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.pdoc b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.pdoc
new file mode 100644
index 00000000000..80c51623b33
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.pdoc
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/META-INF/MANIFEST.MF
index 0c51d06a057..7690f0eab37 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/META-INF/MANIFEST.MF
@@ -1,6 +1,8 @@
Manifest-Version: 1.0
Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.properties,
- org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0"
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0",
+ com.ibm.icu
Export-Package: org.eclipse.papyrus.infra.gmfdiag.preferences,
org.eclipse.papyrus.infra.gmfdiag.preferences.initializer,
org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference;x-internal:=true,
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml
index 65c0af373e8..d9d530745f0 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml
@@ -14,12 +14,6 @@
id="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams"
name="Diagrams">
-
-
-
-
-
-
-
-
= minValidValue && number <= maxValidValue && parsePosition.getIndex() == text.getText().length()) {
+ clearErrorMessage();
+ return true;
+ } else {
+ showErrorMessage();
+ return false;
+ }
+ } catch (NumberFormatException e1) {
+ showErrorMessage();
+ }
+
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.StringFieldEditor#doLoadDefault()
+ */
+ protected void doLoadDefault() {
+ Text text = getTextControl();
+ if(text != null) {
+ double value = getPreferenceStore().getDefaultDouble(getPreferenceName());
+ NumberFormat numberFormatter = NumberFormat.getNumberInstance();
+ text.setText(numberFormatter.format(value));
+ }
+ valueChanged();
+ }
+
+ /*
+ * (non-Javadoc)
+ * Method declared on FieldEditor.
+ */
+ protected void doLoad() {
+ Text text = getTextControl();
+ if(text != null) {
+ double value = getPreferenceStore().getDouble(getPreferenceName());
+ NumberFormat numberFormatter = NumberFormat.getNumberInstance();
+ text.setText(numberFormatter.format(value));
+ }
+ }
+
+ protected void doStore() {
+ NumberFormat numberFormatter = NumberFormat.getInstance();
+ Double gridWidth;
+ try {
+ gridWidth = forceDouble(numberFormatter.parse(getTextControl().getText()));
+ getPreferenceStore().setValue(getPreferenceName(), gridWidth.doubleValue());
+ } catch (ParseException e) {
+ showErrorMessage();
+ }
+
+ }
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramBackgroundColor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramBackgroundColor.java
index b1d211866b6..b4ebd32d316 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramBackgroundColor.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramBackgroundColor.java
@@ -14,8 +14,8 @@
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.BackgroundColor;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
@@ -38,6 +38,6 @@ public class DiagramBackgroundColor extends BackgroundColor {
}
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getDiagramConstant(getKey(), preferenceType);
+ return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramConnectionGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramConnectionGroup.java
index 63ecd518ceb..adeea8d27b4 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramConnectionGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramConnectionGroup.java
@@ -14,8 +14,8 @@
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.ConnectionGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
@@ -39,6 +39,6 @@ public class DiagramConnectionGroup extends ConnectionGroup {
}
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getDiagramConstant(getKey(), preferenceType);
+ return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDecorationGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDecorationGroup.java
index d936311bdeb..8e1e89951c1 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDecorationGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDecorationGroup.java
@@ -18,7 +18,6 @@ import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DecorationGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
-// TODO: Auto-generated Javadoc
/**
* The Class DiagramDecorationGroupthat specialize Decoration group for the diagram level
*/
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDimensionGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDimensionGroup.java
index de502c5285a..dfe967e49b2 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDimensionGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDimensionGroup.java
@@ -14,8 +14,8 @@
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DimensionGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
@@ -43,6 +43,6 @@ public class DiagramDimensionGroup extends DimensionGroup {
* @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getDiagramConstant(getKey(), preferenceType);
+ return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramFontGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramFontGroup.java
index c1da2dadbd7..6958bcf7f6e 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramFontGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramFontGroup.java
@@ -14,8 +14,8 @@
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.FontGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
@@ -43,6 +43,6 @@ public class DiagramFontGroup extends FontGroup {
* @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getDiagramConstant(getKey(), preferenceType);
+ return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramLinkColorGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramLinkColorGroup.java
index aa8cc6fd78b..c9f0adadc4f 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramLinkColorGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramLinkColorGroup.java
@@ -14,8 +14,8 @@
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.LinkColorGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
@@ -43,6 +43,6 @@ public class DiagramLinkColorGroup extends LinkColorGroup {
* @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getDiagramConstant(getKey(), preferenceType);
+ return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramNodeColorGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramNodeColorGroup.java
index f4440e4786d..5cd417b0f30 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramNodeColorGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramNodeColorGroup.java
@@ -14,8 +14,8 @@
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeColorGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
@@ -43,6 +43,6 @@ public class DiagramNodeColorGroup extends NodeColorGroup {
* @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getDiagramConstant(getKey(), preferenceType);
+ return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramRulersAndGridGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramRulersAndGridGroup.java
new file mode 100644
index 00000000000..b4c5a83b9f5
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramRulersAndGridGroup.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram;
+
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.RulersAndGridGroup;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ *
+ * @author vl222926
+ *
+ */
+public class DiagramRulersAndGridGroup extends RulersAndGridGroup {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * @param key
+ * @param dialogPage
+ */
+ public DiagramRulersAndGridGroup(Composite parent, String key, DialogPage dialogPage) {
+ super(parent, key, dialogPage);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.RulersAndGridGroup#getPreferenceConstant(int)
+ *
+ * @param preferenceType
+ * @return
+ */
+ protected String getPreferenceConstant(int preferenceType) {
+ return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/dialog/AbstractPreferenceKeyDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/dialog/AbstractPreferenceKeyDialog.java
index 1aa79b9fd94..6f44dee5bdb 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/dialog/AbstractPreferenceKeyDialog.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/dialog/AbstractPreferenceKeyDialog.java
@@ -23,8 +23,8 @@ import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
@@ -126,10 +126,10 @@ public class AbstractPreferenceKeyDialog extends org.eclipse.jface.dialogs.Statu
*/
public Image getColumnImage(Object element, int columnIndex) {
if(columnIndex == 0) {
- if(element.toString().startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)) {
+ if(element.toString().startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) {
return Activator.getPluginIconImage(Activator.PLUGIN_ID, "/icons/pref.gif");
}
- if(element.toString().startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)) {
+ if(element.toString().startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) {
return Activator.getPluginIconImage(Activator.PLUGIN_ID, "/icons/diag.gif");
}
}
@@ -148,16 +148,16 @@ public class AbstractPreferenceKeyDialog extends org.eclipse.jface.dialogs.Statu
out = out.substring(out.indexOf(".") + 1, out.length()).toUpperCase();
}
if(columnIndex == 1) {
- if(element.toString().startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)) {
+ if(element.toString().startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) {
return "ELEMENT";
}
- if(element.toString().startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)) {
+ if(element.toString().startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) {
return "DIAGRAM";
}
}
if(columnIndex == 2) {
- if(initialKey.startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)) {
- out = initialKey.toString().replaceAll(PreferenceConstantHelper.DIAGRAM_ELEMENT, "");
+ if(initialKey.startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) {
+ out = initialKey.toString().replaceAll(PreferencesConstantsHelper.DIAGRAM_ELEMENT, "");
// Reorganize display
if(out.indexOf(".") > 0) {
String beforePoint = out.substring(0, out.indexOf("."));
@@ -166,8 +166,8 @@ public class AbstractPreferenceKeyDialog extends org.eclipse.jface.dialogs.Statu
}
}
}
- if(initialKey.startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)) {
- out = initialKey.toString().replaceAll(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX, "");
+ if(initialKey.startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) {
+ out = initialKey.toString().replaceAll(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX, "");
out = out.substring(0, out.indexOf("."));
}
}
@@ -205,10 +205,10 @@ public class AbstractPreferenceKeyDialog extends org.eclipse.jface.dialogs.Statu
public Object[] getElements(Object inputElement) {
ArrayList result = new ArrayList();
for(int i = 0; i < keys.length; i++) {
- if(keys[i].startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)) {
+ if(keys[i].startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) {
result.add(keys[i]);
}
- if(keys[i].startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)) {
+ if(keys[i].startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) {
result.add(keys[i]);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorBackgroundColor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorBackgroundColor.java
index 92ad3b765c5..013ef1d6970 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorBackgroundColor.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorBackgroundColor.java
@@ -14,8 +14,8 @@
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.BackgroundColor;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
@@ -43,6 +43,6 @@ public class EditorBackgroundColor extends BackgroundColor {
* @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getPapyrusEditorConstant(preferenceType);
+ return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorConnectionGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorConnectionGroup.java
index efbeed08d6b..a52aab81add 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorConnectionGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorConnectionGroup.java
@@ -14,8 +14,8 @@
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.ConnectionGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
@@ -43,6 +43,6 @@ public class EditorConnectionGroup extends ConnectionGroup {
* @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getPapyrusEditorConstant(preferenceType);
+ return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDecorationGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDecorationGroup.java
index 1a2dc982b0a..e789b80b478 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDecorationGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDecorationGroup.java
@@ -14,8 +14,8 @@
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DecorationGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
@@ -43,6 +43,6 @@ public class EditorDecorationGroup extends DecorationGroup {
* @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getPapyrusEditorConstant(preferenceType);
+ return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDimensionGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDimensionGroup.java
index f8f2cf92ce7..962d5c9539c 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDimensionGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDimensionGroup.java
@@ -14,8 +14,8 @@
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DimensionGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
@@ -43,6 +43,6 @@ public class EditorDimensionGroup extends DimensionGroup {
* @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getPapyrusEditorConstant(preferenceType);
+ return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorFontGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorFontGroup.java
index 5fb9adf3920..87fd235e3ca 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorFontGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorFontGroup.java
@@ -14,8 +14,8 @@
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.FontGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
@@ -43,6 +43,6 @@ public class EditorFontGroup extends FontGroup {
* @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getPapyrusEditorConstant(preferenceType);
+ return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorLinkColorGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorLinkColorGroup.java
index 3066fde767a..5d9e42b413d 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorLinkColorGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorLinkColorGroup.java
@@ -14,8 +14,8 @@
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.LinkColorGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
@@ -43,6 +43,6 @@ public class EditorLinkColorGroup extends LinkColorGroup {
* @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getPapyrusEditorConstant(preferenceType);
+ return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorNodeColorGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorNodeColorGroup.java
index c5b51a67abd..0e6326a96fc 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorNodeColorGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorNodeColorGroup.java
@@ -14,8 +14,8 @@
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeColorGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
@@ -43,6 +43,6 @@ public class EditorNodeColorGroup extends NodeColorGroup {
* @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
*/
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getPapyrusEditorConstant(preferenceType);
+ return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorRulersAndGridGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorRulersAndGridGroup.java
new file mode 100644
index 00000000000..35f0d469373
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorRulersAndGridGroup.java
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor;
+
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.RulersAndGridGroup;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * The Class EditorRulersAndGridGroup is the rulers and grid group specialized at the papyrus editor level.
+ */
+public class EditorRulersAndGridGroup extends RulersAndGridGroup {
+
+ /**
+ * Instantiates a new editor background color.
+ *
+ * @param parent
+ * the parent composite
+ * @param key
+ * the key of the preference
+ * @param dialogPage
+ * the dialog page
+ */
+ public EditorRulersAndGridGroup(Composite parent, String key, DialogPage dialogPage) {
+ super(parent, key, dialogPage);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
+ */
+ protected String getPreferenceConstant(int preferenceType) {
+ return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
+ }
+}
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;
+
/**
*
* 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.
*
*
+ * @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);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi
index 7c44093d06f..2f94e101562 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi
@@ -1,12 +1,43 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/notation.ctx b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/notation.ctx
index 244e96c83c8..ba0a3c0b90d 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/notation.ctx
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/notation.ctx
@@ -179,6 +179,11 @@
+
+
+
+
+
@@ -387,6 +392,12 @@
+
+
+
+
+
+
@@ -679,4 +690,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/ui/SingleLocation.xwt b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/ui/SingleLocation.xwt
index 89517d2ad16..d69369c20ec 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/ui/SingleLocation.xwt
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/ui/SingleLocation.xwt
@@ -1,8 +1,7 @@
-
+ xmlns:j="clr-namespace:java.lang" xmlns:x="http://www.eclipse.org/xwt">
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/ui/SingleRulersAndGrid.xwt b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/ui/SingleRulersAndGrid.xwt
new file mode 100644
index 00000000000..1f133dd89e9
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/ui/SingleRulersAndGrid.xwt
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsSingleDiagramEditorConstraint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsSingleDiagramEditorConstraint.java
new file mode 100644
index 00000000000..a68337a0f75
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsSingleDiagramEditorConstraint.java
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.constraint;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.papyrus.infra.constraints.constraints.JavaQuery;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
+
+/**
+ *
+ * A constraint to know if we are able to get a diagram editor from the selection
+ *
+ */
+public class IsSingleDiagramEditorConstraint implements JavaQuery {
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.constraints.constraints.JavaQuery#match(java.lang.Object)
+ *
+ * @param selection
+ * @return
+ */
+ public boolean match(Object selection) {
+ if(selection instanceof EditPart) {
+ return DiagramEditPartsUtil.getDiagramWorkspacePreferenceStore((EditPart)selection) != null;
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/AbstractDiagramPreferencesObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/AbstractDiagramPreferencesObservableValue.java
new file mode 100644
index 00000000000..95ce8f2d3e8
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/AbstractDiagramPreferencesObservableValue.java
@@ -0,0 +1,103 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding;
+
+import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
+import org.eclipse.core.databinding.observable.value.ValueDiff;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+
+/**
+ *
+ * This observable value listen the preference store to send event and refresh itself when a preferences has changed
+ *
+ */
+public abstract class AbstractDiagramPreferencesObservableValue extends AbstractObservableValue {
+
+ /**
+ * the name of the edited preference
+ */
+ private String preferenceName;
+
+ /**
+ * the edited preference store
+ */
+ private IPreferenceStore editedPreferenceStore;
+
+ /**
+ * the listener on the preference store used to force refresh
+ */
+ private IPropertyChangeListener listener;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param diagram
+ * the diagram for which we re editing a preference
+ * @param preferenceName
+ * the name of edited the preference
+ */
+ public AbstractDiagramPreferencesObservableValue(final Diagram diagram, final String preferenceName, final IPreferenceStore editedPreferenceStore) {
+ this.preferenceName = preferenceName;
+ this.editedPreferenceStore = editedPreferenceStore;
+ this.editedPreferenceStore.addPropertyChangeListener(this.listener = new IPropertyChangeListener() {
+
+ public void propertyChange(final PropertyChangeEvent event) {
+ if(getEditedPreference().equals(event.getProperty())) {
+ ValueDiff diff = new ValueDiff() {
+
+ @Override
+ public Object getOldValue() {
+ return event.getOldValue();
+ }
+
+ @Override
+ public Object getNewValue() {
+ return event.getNewValue();
+ }
+ };
+ fireValueChange(diff);
+ }
+ }
+ });
+ }
+
+
+ @Override
+ public synchronized void dispose() {
+ super.dispose();
+ this.editedPreferenceStore.removePropertyChangeListener(this.listener);
+ }
+
+ /**
+ *
+ * @return
+ * the edited preferences
+ */
+ public final String getEditedPreference() {
+ return this.preferenceName;
+ }
+
+ /**
+ *
+ * @return
+ * the edited preference store
+ */
+ public final IPreferenceStore getEditedPreferenceStore() {
+ return this.editedPreferenceStore;
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/BooleanDiagramViewObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/BooleanDiagramViewObservableValue.java
new file mode 100644
index 00000000000..fb94fe629e4
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/BooleanDiagramViewObservableValue.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ *
+ * Class used to edit boolean preference
+ *
+ */
+public class BooleanDiagramViewObservableValue extends AbstractDiagramPreferencesObservableValue {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param diagram
+ * the edited diagram
+ * @param preferenceName
+ * the edited preference
+ * @param preferenceStore
+ * the edited preference store
+ */
+ public BooleanDiagramViewObservableValue(final Diagram diagram, final String preferenceName, IPreferenceStore preferenceStore) {
+ super(diagram, preferenceName, preferenceStore);
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType()
+ *
+ * @return
+ */
+ public final Object getValueType() {
+ return EcorePackage.eINSTANCE.getEBoolean();
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue()
+ *
+ * @return
+ */
+ @Override
+ protected final Object doGetValue() {
+ final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore();
+ return wsPreferenceStore.getBoolean(getEditedPreference());
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object)
+ *
+ * @param value
+ */
+ @Override
+ protected void doSetValue(Object value) {
+ if(value instanceof Boolean) {
+ final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore();
+ wsPreferenceStore.setValue(getEditedPreference(), ((Boolean)value).booleanValue());
+ }
+ }
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/DoubleDiagramViewObservaleValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/DoubleDiagramViewObservaleValue.java
new file mode 100644
index 00000000000..2702a1cda47
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/DoubleDiagramViewObservaleValue.java
@@ -0,0 +1,83 @@
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding;
+
+import org.eclipse.core.databinding.observable.value.ValueDiff;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ *
+ * Class used to edit double preferences
+ *
+ */
+public class DoubleDiagramViewObservaleValue extends AbstractDiagramPreferencesObservableValue {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param diagram
+ * the edited diagram
+ * @param preferenceName
+ * the edited preference
+ * @param store
+ * the edited preference store
+ */
+ public DoubleDiagramViewObservaleValue(final Diagram diagram, final String preferenceName, final IPreferenceStore store) {
+ super(diagram, preferenceName, store);
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType()
+ *
+ * @return
+ */
+ public final Object getValueType() {
+ return EcorePackage.eINSTANCE.getEFloat();
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue()
+ *
+ * @return
+ */
+ @Override
+ protected Object doGetValue() {
+ final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore();
+ return wsPreferenceStore.getDouble(getEditedPreference());
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object)
+ *
+ * @param value
+ */
+ @Override
+ protected void doSetValue(final Object value) {
+ if(value instanceof Float) {
+ final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore();
+ final double oldValue = (Double)doGetValue();
+ wsPreferenceStore.setValue(getEditedPreference(), ((Float)value).doubleValue());
+ final ValueDiff diff = new ValueDiff() {
+
+ @Override
+ public Object getOldValue() {
+ return oldValue;
+ }
+
+ @Override
+ public Object getNewValue() {
+ return ((Float)value).doubleValue();
+ }
+ };
+ fireValueChange(diff);
+ }
+ }
+
+
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/IntegerDiagramViewObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/IntegerDiagramViewObservableValue.java
new file mode 100644
index 00000000000..f89b117504a
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/IntegerDiagramViewObservableValue.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ *
+ * Class used to edit integer preferences
+ *
+ */
+public class IntegerDiagramViewObservableValue extends AbstractDiagramPreferencesObservableValue {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param diagram
+ * the edited diagram
+ * @param preferenceName
+ * the name of the edited preference
+ * @param store
+ * the edited preference store
+ */
+ public IntegerDiagramViewObservableValue(final Diagram diagram, final String preferenceName, final IPreferenceStore store) {
+ super(diagram, preferenceName, store);
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType()
+ *
+ * @return
+ */
+ public final Object getValueType() {
+ return EcorePackage.eINSTANCE.getEInt();
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue()
+ *
+ * @return
+ */
+ @Override
+ protected final Object doGetValue() {
+ final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore();
+ return wsPreferenceStore.getInt(getEditedPreference());
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object)
+ *
+ * @param value
+ */
+ @Override
+ protected void doSetValue(Object value) {
+ if(value instanceof Integer) {
+ final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore();
+ wsPreferenceStore.setValue(getEditedPreference(), ((Integer)value).intValue());
+ }
+ }
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/RulersUnitObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/RulersUnitObservableValue.java
new file mode 100644
index 00000000000..7702194e980
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/RulersUnitObservableValue.java
@@ -0,0 +1,65 @@
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding;
+
+import java.text.NumberFormat;
+import java.text.ParseException;
+
+import org.eclipse.gmf.runtime.diagram.ui.internal.properties.WorkspaceViewerProperties;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.UnitsConverterUtils;
+
+
+
+@SuppressWarnings("restriction")
+//suppress warning for WorkspaceViewerProperties
+public class RulersUnitObservableValue extends IntegerDiagramViewObservableValue {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param view
+ * the view
+ * @param store
+ * the edited preference store
+ */
+ public RulersUnitObservableValue(final Diagram view, final IPreferenceStore store) {
+ super(view, WorkspaceViewerProperties.RULERUNIT, store);
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.gmfdiag.properties.databinding.IntegerDiagramViewObservableValue#doSetValue(java.lang.Object)
+ *
+ * @param value
+ */
+ @Override
+ protected void doSetValue(final Object value) {
+ if(value instanceof Integer) {
+ final Integer oldValue = (Integer)doGetValue();
+ final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore();
+ final Double oldGridSpacing = wsPreferenceStore.getDouble(WorkspaceViewerProperties.GRIDSPACING);
+
+
+ final String newValue = UnitsConverterUtils.convertUnits((Integer)oldValue, (Integer)value, NumberFormat.getInstance().format(oldGridSpacing));
+
+ Number number = null;
+ try {
+ number = NumberFormat.getInstance().parse(newValue);
+ } catch (ParseException e) {
+ //nothing to do
+ number = null;
+ return;
+ }
+
+ //we set the new unit value
+ super.doSetValue(value);
+
+ //we set the new spacing value
+ final double newGridSpacing = number.doubleValue();
+ wsPreferenceStore.setValue(WorkspaceViewerProperties.GRIDSPACING, newGridSpacing);
+ }
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/Messages.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/Messages.java
index 6efd7d9683c..88269b2493c 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/Messages.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/Messages.java
@@ -35,6 +35,8 @@ public class Messages extends NLS {
public static String DecoratedModelElement_WEST;
+ public static String DiagramPreferencesDefaultButton_ResetDefault;
+
public static String GradientDataModelElement_Horizontal;
public static String GradientDataModelElement_Vertical;
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/messages.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/messages.properties
index 2c1a13cf3d3..7da85c2df8a 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/messages.properties
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/messages.properties
@@ -7,5 +7,6 @@ DecoratedModelElement_SOUTH=Bottom
DecoratedModelElement_SOUTH_EAST=Bottom Right
DecoratedModelElement_SOUTH_WEST=Bottom Left
DecoratedModelElement_WEST=Left
+DiagramPreferencesDefaultButton_ResetDefault=Reset Default
GradientDataModelElement_Horizontal=Horizontal
GradientDataModelElement_Vertical=Vertical
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/RulerAndGridModelElement.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/RulerAndGridModelElement.java
new file mode 100644
index 00000000000..87f0f8cfd2b
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/RulerAndGridModelElement.java
@@ -0,0 +1,191 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.modelelement;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gef.rulers.RulerProvider;
+import org.eclipse.gmf.runtime.diagram.ui.internal.properties.WorkspaceViewerProperties;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.gmfdiag.common.providers.LineStyleLabelProvider;
+import org.eclipse.papyrus.infra.gmfdiag.common.providers.UnitsLabelProvider;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.BooleanDiagramViewObservableValue;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.DoubleDiagramViewObservaleValue;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.IntegerDiagramViewObservableValue;
+import org.eclipse.papyrus.infra.gmfdiag.properties.databinding.RulersUnitObservableValue;
+import org.eclipse.papyrus.infra.gmfdiag.properties.util.RulersAndGridPropertyConstants;
+import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.StaticContentProvider;
+import org.eclipse.papyrus.views.properties.contexts.DataContextElement;
+import org.eclipse.papyrus.views.properties.modelelement.AbstractModelElement;
+
+/**
+ *
+ * @author vl222926
+ * This class provides the ModelElement for the property view
+ */
+@SuppressWarnings("restriction")
+//suppress the warning for WorkspaceViewerProperties
+public class RulerAndGridModelElement extends AbstractModelElement {
+
+
+
+ /**
+ * the diagram for which we are editing preferences
+ */
+ private Diagram diagram;
+
+ /**
+ * the edited preference store
+ */
+ private IPreferenceStore store;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param view
+ * the diagram for which we are editing preferences
+ * @param domain
+ * the editing domain
+ * @param context
+ * the data context
+ * @param preferenceStore
+ * the edited preference store
+ */
+ public RulerAndGridModelElement(final Diagram view, final EditingDomain domain, final DataContextElement context, final IPreferenceStore preferenceStore) {
+ this.diagram = view;
+ this.store = preferenceStore;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.properties.modelelement.AbstractModelElement#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ this.diagram = null;
+ this.store = null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.properties.modelelement.AbstractModelElement#doGetObservable(java.lang.String)
+ *
+ * @param propertyPath
+ * @return
+ */
+ @Override
+ protected IObservable doGetObservable(final String propertyPath) {
+ IObservable observable = null;
+ if(RulersAndGridPropertyConstants.GRID_IS_DISPLAYING_GRID.equals(propertyPath)) {
+ observable = new BooleanDiagramViewObservableValue(this.diagram, WorkspaceViewerProperties.VIEWGRID, this.store);
+ }
+ if(RulersAndGridPropertyConstants.RULERS_IS_DISPLAYING_RULER.equals(propertyPath)) {
+ observable = new BooleanDiagramViewObservableValue(this.diagram, WorkspaceViewerProperties.VIEWRULERS, this.store);
+ }
+ if(RulersAndGridPropertyConstants.GRID_IS_IN_FRONT.equals(propertyPath)) {
+ observable = new BooleanDiagramViewObservableValue(diagram, WorkspaceViewerProperties.GRIDORDER, this.store);
+ }
+ if(RulersAndGridPropertyConstants.GRID_COLOR.equals(propertyPath)) {
+ observable = new IntegerDiagramViewObservableValue(diagram, WorkspaceViewerProperties.GRIDLINECOLOR, this.store);
+ }
+ if(RulersAndGridPropertyConstants.GRID_STYLE.equals(propertyPath)) {
+ observable = new IntegerDiagramViewObservableValue(diagram, WorkspaceViewerProperties.GRIDLINESTYLE, this.store);
+ }
+ if(RulersAndGridPropertyConstants.GRID_SPACING.equals(propertyPath)) {
+ observable = new DoubleDiagramViewObservaleValue(diagram, WorkspaceViewerProperties.GRIDSPACING, this.store);
+ }
+ if(RulersAndGridPropertyConstants.GRID_IS_SNAP_TO_GRID.equals(propertyPath)) {
+ observable = new BooleanDiagramViewObservableValue(this.diagram, WorkspaceViewerProperties.SNAPTOGRID, this.store);
+ }
+ if(RulersAndGridPropertyConstants.GRID_IS_SNAP_TO_SHAPE.equals(propertyPath)) {
+ observable = new BooleanDiagramViewObservableValue(this.diagram, WorkspaceViewerProperties.SNAPTOGEOMETRY, this.store);
+ }
+ if(RulersAndGridPropertyConstants.RULERS_UNITS.equals(propertyPath)) {
+ observable = new RulersUnitObservableValue(diagram, this.store);
+ }
+ return observable;
+ }
+
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.properties.modelelement.AbstractModelElement#getContentProvider(java.lang.String)
+ *
+ * @param propertyPath
+ * @return
+ */
+ @Override
+ public IStaticContentProvider getContentProvider(String propertyPath) {
+ if(RulersAndGridPropertyConstants.GRID_STYLE.equals(propertyPath)) {
+ return new StaticContentProvider(new Object[]{ Graphics.LINE_DASH, Graphics.LINE_DASHDOT, Graphics.LINE_DASHDOTDOT, Graphics.LINE_DOT, Graphics.LINE_SOLID, Graphics.LINE_CUSTOM });
+ }
+ if(RulersAndGridPropertyConstants.RULERS_UNITS.equals(propertyPath)) {
+ return new StaticContentProvider(new Object[]{ RulerProvider.UNIT_INCHES, RulerProvider.UNIT_CENTIMETERS, RulerProvider.UNIT_PIXELS });
+ }
+ return super.getContentProvider(propertyPath);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.properties.modelelement.AbstractModelElement#getLabelProvider(java.lang.String)
+ *
+ * @param propertyPath
+ * @return
+ */
+ @Override
+ public ILabelProvider getLabelProvider(final String propertyPath) {
+ if(RulersAndGridPropertyConstants.GRID_STYLE.equals(propertyPath)) {
+ return new LineStyleLabelProvider();
+ }
+ if(RulersAndGridPropertyConstants.RULERS_UNITS.equals(propertyPath)) {
+ return new UnitsLabelProvider();
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.properties.modelelement.AbstractModelElement#isMandatory(java.lang.String)
+ *
+ * @param propertyPath
+ * @return
+ */
+ @Override
+ public boolean isMandatory(final String propertyPath) {
+ if(RulersAndGridPropertyConstants.GRID_STYLE.equals(propertyPath) || RulersAndGridPropertyConstants.RULERS_UNITS.equals(propertyPath)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.properties.modelelement.AbstractModelElement#forceRefresh(java.lang.String)
+ *
+ * @param propertyPath
+ * @return
+ */
+ @Override
+ public boolean forceRefresh(final String propertyPath) {
+ return true;
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/RulersAndGridModelElementFactory.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/RulersAndGridModelElementFactory.java
new file mode 100644
index 00000000000..0709999a89e
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/RulersAndGridModelElementFactory.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.modelelement;
+
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
+import org.eclipse.papyrus.infra.gmfdiag.properties.Activator;
+import org.eclipse.papyrus.views.properties.contexts.DataContextElement;
+import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
+import org.eclipse.papyrus.views.properties.modelelement.ModelElementFactory;
+
+/**
+ *
+ * @author vl222926
+ * The factory used to edit Rulers and Grid properties
+ */
+public class RulersAndGridModelElementFactory implements ModelElementFactory {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.properties.modelelement.ModelElementFactory#createFromSource(java.lang.Object,
+ * org.eclipse.papyrus.views.properties.contexts.DataContextElement)
+ *
+ * @param sourceElement
+ * @param context
+ * @return
+ */
+ public ModelElement createFromSource(Object sourceElement, DataContextElement context) {
+ if(sourceElement instanceof EditPart) {
+ final IPreferenceStore preferenceStore = DiagramEditPartsUtil.getDiagramWorkspacePreferenceStore((EditPart)sourceElement);
+ View view = NotationHelper.findView(DiagramEditPartsUtil.getDiagramEditPart((EditPart)sourceElement));
+ if(preferenceStore != null && view instanceof Diagram) {
+ EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(view);
+ return new RulerAndGridModelElement((Diagram)view, domain, context, preferenceStore);
+ }
+ }
+
+ Activator.log.warn("The selected element cannot be resolved to a Diagram View"); //$NON-NLS-1$
+ return null;
+ }
+
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/NotationUtil.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/NotationUtil.java
index 18ca429fd7e..1fbdd42e1ac 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/NotationUtil.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/NotationUtil.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.properties.util;
import org.eclipse.core.runtime.IAdaptable;
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/RulersAndGridPropertyConstants.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/RulersAndGridPropertyConstants.java
new file mode 100644
index 00000000000..03ae14a07fe
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/RulersAndGridPropertyConstants.java
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.util;
+
+/**
+ *
+ *
+ * This class provides the constants used in the declaration of the property view for Rulers and Grid
+ */
+public class RulersAndGridPropertyConstants {
+
+ private RulersAndGridPropertyConstants() {
+ // to prevent instanciation
+ }
+
+ /**
+ * the edited data
+ */
+ public static final String GRID_IS_DISPLAYING_GRID = "grid.isDisplayingGrid";
+
+ public static final String RULERS_IS_DISPLAYING_RULER = "rulers.isDisplayingRulers";
+
+ public static final String GRID_IS_IN_FRONT = "grid.isInFront";
+
+ public static final String GRID_COLOR = "grid.color";
+
+ public static final String GRID_STYLE = "grid.style";
+
+ public static final String GRID_SPACING = "grid.spacing";
+
+ public static final String GRID_IS_SNAP_TO_GRID = "grid.isSnapToGrid";
+
+ public static final String GRID_IS_SNAP_TO_SHAPE = "grid.isSnapToShapes";
+
+ public static final String RULERS_UNITS = "rulers.units";
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/widget/DiagramPreferencesDefaultButton.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/widget/DiagramPreferencesDefaultButton.java
new file mode 100644
index 00000000000..c565cd235a5
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/widget/DiagramPreferencesDefaultButton.java
@@ -0,0 +1,159 @@
+/*****************************************************************************
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.properties.widget;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
+import org.eclipse.papyrus.infra.gmfdiag.properties.messages.Messages;
+import org.eclipse.papyrus.views.properties.modelelement.DataSource;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ *
+ * The button used to reset the preference of the diagram to the defaut values
+ *
+ */
+public class DiagramPreferencesDefaultButton extends Composite {
+
+ private Button button;
+
+ private SelectionListener listener;
+
+ protected DataSource input;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * @param style
+ */
+ public DiagramPreferencesDefaultButton(Composite parent, int style) {
+ super(parent, style);
+ GridLayout layout = new GridLayout(1, false);
+ setLayout(layout);
+ createButton();
+ }
+
+ /**
+ * create the reset button
+ */
+ protected void createButton() {
+ button = new Button(this, SWT.NONE);
+ button.setText(Messages.DiagramPreferencesDefaultButton_ResetDefault);
+ this.listener = createListener();
+ button.addSelectionListener(this.listener);
+ }
+
+ /**
+ * Sets the input DataSource for this Property editor.
+ *
+ * @param input
+ */
+ public void setInput(DataSource input) {
+ this.input = input;
+ }
+
+ /**
+ * @return the input DataSource for this Property editor
+ */
+ public DataSource getInput() {
+ return input;
+ }
+
+
+ /**
+ *
+ * @return
+ * the listener to use for the button
+ */
+ private SelectionListener createListener() {
+ final SelectionListener listener = new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ resetProperties();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ //nothing to do
+ }
+ };
+ return listener;
+ }
+
+ /**
+ *
+ * @see org.eclipse.swt.widgets.Widget#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ this.button.removeSelectionListener(this.listener);
+ this.input = null;
+ }
+
+ /**
+ * Reset the properties to their default values
+ */
+ protected void resetProperties() {
+ final IPreferenceStore store = getPreferencesStore();
+ if(store != null) {
+ store.setValue(PreferencesConstantsHelper.VIEW_GRID_CONSTANT, store.getDefaultBoolean(PreferencesConstantsHelper.VIEW_GRID_CONSTANT));
+ store.setValue(PreferencesConstantsHelper.VIEW_RULERS_CONSTANT, store.getDefaultBoolean(PreferencesConstantsHelper.VIEW_RULERS_CONSTANT));
+ store.setValue(PreferencesConstantsHelper.GRID_ORDER_CONSTANT, store.getDefaultBoolean(PreferencesConstantsHelper.GRID_ORDER_CONSTANT));
+ store.setValue(PreferencesConstantsHelper.GRID_LINE_COLOR_CONSTANT, store.getDefaultInt(PreferencesConstantsHelper.GRID_LINE_COLOR_CONSTANT));
+ store.setValue(PreferencesConstantsHelper.GRID_LINE_STYLE_CONSTANT, store.getDefaultBoolean(PreferencesConstantsHelper.GRID_LINE_STYLE_CONSTANT));
+ store.setValue(PreferencesConstantsHelper.GRID_SPACING_CONSTANT, store.getDefaultDouble(PreferencesConstantsHelper.GRID_SPACING_CONSTANT));
+ store.setValue(PreferencesConstantsHelper.SNAP_TO_GRID_CONSTANT, store.getDefaultBoolean(PreferencesConstantsHelper.SNAP_TO_GRID_CONSTANT));
+ store.setValue(PreferencesConstantsHelper.SNAP_TO_GEOMETRY_CONSTANT, store.getDefaultBoolean(PreferencesConstantsHelper.SNAP_TO_GEOMETRY_CONSTANT));
+ store.setValue(PreferencesConstantsHelper.RULER_UNITS_CONSTANT, store.getDefaultInt(PreferencesConstantsHelper.RULER_UNITS_CONSTANT));
+
+ //doesn't work (ClassCastException due to GMF)
+ // store.setToDefault(PreferencesConstantsHelper.SHOW_GRID_CONSTANT);
+ // store.setToDefault(PreferencesConstantsHelper.SHOW_RULER_CONSTANT);
+ // store.setToDefault(PreferencesConstantsHelper.GRID_ORDER_CONSTANT);
+ // store.setToDefault(PreferencesConstantsHelper.GRID_COLOR_CONSTANT);
+ // store.setToDefault(PreferencesConstantsHelper.GRID_STYLE_CONSTANT);
+ // store.setToDefault(PreferencesConstantsHelper.GRID_SPACING_CONSTANT);
+ // store.setToDefault(PreferencesConstantsHelper.SNAP_TO_GRID_CONSTANT);
+ // store.setToDefault(PreferencesConstantsHelper.SNAP_TO_SHAPE_CONSTANT);
+ // store.setToDefault(PreferencesConstantsHelper.RULER_UNITS_CONSTANT);
+ }
+ }
+
+
+ /**
+ *
+ * @return
+ * the preference store
+ */
+ protected IPreferenceStore getPreferencesStore() {
+ final IStructuredSelection selection = this.input.getSelection();
+ final Object firstElement = selection.getFirstElement();
+ if(firstElement instanceof EditPart) {
+ return DiagramEditPartsUtil.getDiagramWorkspacePreferenceStore((EditPart)firstElement);
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EclipseCommandUtils.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EclipseCommandUtils.java
index 28eed32b17c..89358f2a396 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EclipseCommandUtils.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EclipseCommandUtils.java
@@ -19,6 +19,7 @@ import java.util.TreeSet;
import org.eclipse.core.commands.Category;
import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.State;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.infra.tools.Activator;
@@ -39,6 +40,11 @@ public class EclipseCommandUtils {
//to prevent instanciation
}
+ public static final String TOGGLE_STATE = "org.eclipse.ui.commands.toggleState"; //$NON-NLS-1$
+
+ public static final String RADIO_STATE = "org.eclipse.ui.commands.radioState"; //$NON-NLS-1$
+
+
/**
*
* @param categoryId
@@ -78,4 +84,38 @@ public class EclipseCommandUtils {
final ImageDescriptor imageDescriptor = service.getImageDescriptor(command.getId());
return imageDescriptor;
}
+
+ /**
+ *
+ * @param command
+ * an eclipse command
+ * @param newValue
+ * the new boolean value to set to the state of this command
+ */
+ //TODO : the nattable integration must use me
+ public static final void updateToggleCommandState(final org.eclipse.core.commands.Command command, final boolean newValue) {
+ if(command != null) {
+ final State state = command.getState(TOGGLE_STATE);
+ if(state != null) {
+ state.setValue(newValue);
+ }
+ }
+ }
+
+ /**
+ *
+ * @param command
+ * an eclipse command
+ * @param newValue
+ * the new value to set to the state of this command
+ */
+ //TODO : the nattable integration must use me
+ public static final void updateRadioCommandState(final org.eclipse.core.commands.Command command, final Object newValue) {
+ if(command != null) {
+ final State state = command.getState(RADIO_STATE);
+ if(state != null) {
+ state.setValue(newValue);
+ }
+ }
+ }
}
--
cgit v1.2.3