Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/gmfdiag')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/SynchronizableGmfDiagramEditor.java98
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/Messages.java21
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/messages/messages.properties3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/preferences/PreferencesConstantsHelper.java498
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/LineStyleLabelProvider.java120
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/UnitsLabelProvider.java106
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/CommandIds.java32
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramEditPartsUtil.java60
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/UnitsConstants.java48
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/UnitsConverterUtils.java108
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/build.properties3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.pdoc4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/META-INF/MANIFEST.MF4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/plugin.xml17
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceInitializer.java3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceStore.java22
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/Messages.java22
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/messages.properties6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusElementPreferencePage.java6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/DiagramPreferencePage.java6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/PapyrusAllDiagramsPreferencePage.java43
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusRulersAndGridPreferencePage.java72
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/AbstractGroup.java6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/BackgroundColor.java6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/ConnectionGroup.java16
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DecorationGroup.java6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DimensionGroup.java6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/FontGroup.java5
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LabelGroup.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LinkColorGroup.java6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeColorGroup.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeCompartmentGroup.java6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedCompartmentGroup.java6
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedLabelGroup.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/RulersAndGridGroup.java494
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramBackgroundColor.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramConnectionGroup.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDecorationGroup.java1
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDimensionGroup.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramFontGroup.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramLinkColorGroup.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramNodeColorGroup.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramRulersAndGridGroup.java51
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/dialog/AbstractPreferenceKeyDialog.java22
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorBackgroundColor.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorConnectionGroup.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDecorationGroup.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDimensionGroup.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorFontGroup.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorLinkColorGroup.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorNodeColorGroup.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorRulersAndGridGroup.java49
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/PreferenceConstantHelper.java211
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi51
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/notation.ctx27
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/ui/SingleLocation.xwt5
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/model/notation/ui/SingleRulersAndGrid.xwt2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsSingleDiagramEditorConstraint.java42
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/AbstractDiagramPreferencesObservableValue.java103
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/BooleanDiagramViewObservableValue.java79
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/DoubleDiagramViewObservaleValue.java83
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/IntegerDiagramViewObservableValue.java79
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/RulersUnitObservableValue.java65
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/Messages.java2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/messages.properties1
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/RulerAndGridModelElement.java191
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/RulersAndGridModelElementFactory.java61
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/NotationUtil.java13
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/RulersAndGridPropertyConstants.java47
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/widget/DiagramPreferencesDefaultButton.java159
71 files changed, 2888 insertions, 382 deletions
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;
+
+
+
+/**
+ * <p>
+ * A class that defines the available preference type available through Papyrus.
+ * </p>
+ * <p>
+ * It defines the following type:
+ * </p>
+ * <ul>
+ * <li>COLOR_FILL</li>
+ * <li>FONT</li>
+ * <li>COLOR_FONT</li>
+ * <li>COLOR_LINE</li>
+ * <li>COLOR_GRADIENT</li>
+ * <li>GRADIENT_POLICY</li>
+ * <li>JUMPLINK_STATUS</li>
+ * <li>JUMPLINK_REVERSE</li>
+ * <li>JUMPLINK_TYPE</li>
+ * <li>ROUTING_POLICY_DISTANCE</li>
+ * <li>ROUTING_POLICY_OBSTRUCTION</li>
+ * <li>ROUTING_STYLE</li>
+ * <li>SMOOTHNESS</li>
+ * </ul>
+ * <p>
+ * It also helps to retrieve the string used to store the preference type for a given element.
+ * </p>
+ *
+ */
+@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 <code>DiagramEditPart</code> if
+ * the current part implements <code>IDiagramWorkbenchPart</code>
+ *
+ * @return The current diagram if the parts implements <code>IDiagramWorkbenchPart</code>; <code>null</code> 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 <code>IDiagramWorkbenchPart</code> interface
+ *
+ * @return The current part if it implements or adapts to <code>IDiagramWorkbenchPart</code>; <code>null</code> 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 <code>null</code> 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<doc:Documentation xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:doc="http://www.eclipse.org/papyrus/documentation/plugin/documentation" description="This plugin provides handlers for actions done on GMF Diagram (without dependencies on UML)">
+ <referent firstName="vincent" lastName="lorenzo" eMail="vincent.lorenzo@cea.fr" currentCompany="CEA-LIST"/>
+</doc:Documentation>
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
@@ -16,12 +16,6 @@
</page>
<page
category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory"
- class="org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal.PapyrusRulersAndGridPreferencePage"
- id="org.eclipse.papyrus.infra.gmfdiag.preferences.rulersandgrid"
- name="Rulers And Grid">
- </page>
- <page
- category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory"
class="org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal.PapyrusPrintingPreferencePage"
id="org.eclipse.papyrus.infra.gmfdiag.preferences.printing"
name="Printing">
@@ -58,17 +52,6 @@
</page>
<page
category="org.eclipse.papyrus.infra.gmfdiag.preferences.properties.generalcategory"
- class="org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal.PapyrusRulersAndGridPreferencePage"
- id="org.eclipse.papyrus.infra.gmfdiag.preferences.properties.rulersandgrid"
- name="Rulers And Grid">
- <enabledWhen>
- <adapt
- type="org.eclipse.core.resources.IProject">
- </adapt>
- </enabledWhen>
- </page>
- <page
- category="org.eclipse.papyrus.infra.gmfdiag.preferences.properties.generalcategory"
class="org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal.PapyrusPrintingPreferencePage"
id="org.eclipse.papyrus.infra.gmfdiag.preferences.properties.printing"
name="Printing">
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceInitializer.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceInitializer.java
index b55ecc29363..7ed0f90ecd5 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceInitializer.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceInitializer.java
@@ -17,7 +17,6 @@ import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.PapyrusAllDiagramsPreferencePage;
import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal.PapyrusPrintingPreferencePage;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal.PapyrusRulersAndGridPreferencePage;
import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal.PapyrusUML2PreferencePage;
/**
@@ -39,7 +38,7 @@ public class PapyrusPreferenceInitializer extends AbstractPreferenceInitializer
@Override
public void initializeDefaultPreferences() {
PapyrusAllDiagramsPreferencePage.initDefaults(store);
- PapyrusRulersAndGridPreferencePage.initDefaults(store);
+ // PapyrusRulersAndGridPreferencePage.initDefaults(store);
PapyrusPrintingPreferencePage.initDefaults(store);
PapyrusUML2PreferencePage.initDefaults(store);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceStore.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceStore.java
index eb8a48bf6a8..9aa7376e7c5 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceStore.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceStore.java
@@ -18,8 +18,8 @@ import java.util.Iterator;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.dialog.ApplyValueOnPreferenceKeyDialog;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
/**
* this class is a specific store that is used to look for value of element
@@ -44,14 +44,14 @@ public class PapyrusPreferenceStore extends PapyrusScopedPreferenceStore {
try {
for(int i = 0; i < getStorePreferences().keys().length; i++) {
//level diagram collect only element
- if(level.startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)) {
- if(getStorePreferences().keys()[i].startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)) {
+ if(level.startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) {
+ if(getStorePreferences().keys()[i].startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) {
elementKey.add(getStorePreferences().keys()[i]);
}
}
//editor level, collect all element+diagram
- else if(level.startsWith(PreferenceConstantHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX)) {
- if((getStorePreferences().keys()[i].startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)) || (getStorePreferences().keys()[i].startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX))) {
+ else if(level.startsWith(PreferencesConstantsHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX)) {
+ if((getStorePreferences().keys()[i].startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) || (getStorePreferences().keys()[i].startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX))) {
elementKey.add(getStorePreferences().keys()[i]);
}
}
@@ -194,19 +194,19 @@ public class PapyrusPreferenceStore extends PapyrusScopedPreferenceStore {
protected String getUpperKey(String initialKey) {
String out = initialKey.toString();
- if(initialKey.startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT)) {
- out = initialKey.toString().replaceAll(PreferenceConstantHelper.DIAGRAM_ELEMENT, PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX);
+ if(initialKey.startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) {
+ out = initialKey.toString().replaceAll(PreferencesConstantsHelper.DIAGRAM_ELEMENT, PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX);
out = out.substring(0, out.lastIndexOf("_")) + out.substring(out.indexOf("."), out.length());
}
- if(initialKey.startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)) {
- // out=initialKey.toString().replaceAll(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX, PreferenceConstantHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX);
- out = PreferenceConstantHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX + out.substring(out.indexOf("."), out.length());
+ if(initialKey.startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) {
+ // out=initialKey.toString().replaceAll(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX, PreferencesConstantsHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX);
+ out = PreferencesConstantsHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX + out.substring(out.indexOf("."), out.length());
}
return out;
}
protected boolean hasPrefix(String key) {
- if(key.startsWith(PreferenceConstantHelper.DIAGRAM_ELEMENT) || key.startsWith(PreferenceConstantHelper.DIAGRAM_PREFERENCE_PREFIX)) {
+ if(key.startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT) || key.startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) {
return true;
}
return false;
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/Messages.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/Messages.java
index a405f7779b5..1db6cf676fb 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/Messages.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/Messages.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.preferences.messages;
import org.eclipse.osgi.util.NLS;
@@ -7,6 +20,15 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.gmfdiag.preferences.messages.messages"; //$NON-NLS-1$
public static String LabelGroup_Labels_To_Display;
+
+ public static String RulersAndGridGroup_GridColor;
+
+ public static String RulersAndGridGroup_GridInFront;
+
+ public static String RulersAndGridGroup_GridStyle;
+
+
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/messages.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/messages.properties
index bb2c968ed60..32eec8f4ccd 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/messages.properties
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/messages.properties
@@ -1 +1,7 @@
LabelGroup_Labels_To_Display=Labels to display
+RulersAndGridGroup_GridColor=Grid Color
+RulersAndGridGroup_GridInFront=Grid In Front
+RulersAndGridGroup_GridStyle=Grid Style
+RulersAndGridGroup_GridColor=Grid Color
+RulersAndGridGroup_GridInFront=Grid In Front
+RulersAndGridGroup_GridStyle=Grid Style
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusElementPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusElementPreferencePage.java
index 377c04373b5..0a4f2b5d5b5 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusElementPreferencePage.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusElementPreferencePage.java
@@ -12,8 +12,8 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.preferences.pages;
+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.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -68,11 +68,11 @@ public abstract class AbstractPapyrusElementPreferencePage extends AbstractPapyr
* Get the specified preference type associated with this preference page.
*
* @param preferenceType
- * an int representing the preference type to retrieve. It must be a value defined in {@link PreferenceConstantHelper}
+ * an int representing the preference type to retrieve. It must be a value defined in {@link PreferencesConstantsHelper}
* @return the preference constant used to store the given prefence type.
*/
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getElementConstant(getTitle(), preferenceType);
+ return PreferencesConstantsHelper.getElementConstant(getTitle(), preferenceType);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/DiagramPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/DiagramPreferencePage.java
index 1be6ca17808..152fb97653e 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/DiagramPreferencePage.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/DiagramPreferencePage.java
@@ -25,11 +25,13 @@ import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.ConnectionGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DecorationGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.FontGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeColorGroup;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.RulersAndGridGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram.DiagramBackgroundColor;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram.DiagramConnectionGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram.DiagramDecorationGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram.DiagramFontGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram.DiagramNodeColorGroup;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram.DiagramRulersAndGridGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -73,6 +75,9 @@ public class DiagramPreferencePage extends DiagramsPreferencePage {
DecorationGroup decorationGroupComposite = new DiagramDecorationGroup(contentGroup, getPreferenceKey(), this);
addAbstractGroup(decorationGroupComposite);
+
+ RulersAndGridGroup viewGroupComposite = new DiagramRulersAndGridGroup(parent, getPreferenceKey(), this);
+ addAbstractGroup(viewGroupComposite);
return super.createContents(parent);
}
@@ -168,7 +173,6 @@ public class DiagramPreferencePage extends DiagramsPreferencePage {
@Override
public void setVisible(boolean visible) {
- // TODO Auto-generated method stub
if(visible == true) {
VisiblePageSingleton.getInstance().setVisiblePage(this);
initGroup();
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/PapyrusAllDiagramsPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/PapyrusAllDiagramsPreferencePage.java
index dc27266b937..201ec4f46f5 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/PapyrusAllDiagramsPreferencePage.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/PapyrusAllDiagramsPreferencePage.java
@@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.notation.Routing;
import org.eclipse.gmf.runtime.notation.Smoothness;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
import org.eclipse.papyrus.infra.gmfdiag.preferences.PapyrusPreferenceStore;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.BackgroundColor;
@@ -26,14 +27,15 @@ import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DecorationGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DimensionGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.FontGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeColorGroup;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.RulersAndGridGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.EditorBackgroundColor;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.EditorConnectionGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.EditorDecorationGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.EditorDimensionGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.EditorFontGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.EditorNodeColorGroup;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.EditorRulersAndGridGroup;
import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
@@ -70,6 +72,9 @@ public class PapyrusAllDiagramsPreferencePage extends AbstractPapyrusPreferenceP
DimensionGroup dimensionGroup = new EditorDimensionGroup(contentGroup, getTitle(), this);
addAbstractGroup(dimensionGroup);
+
+ RulersAndGridGroup viewGroupComposite = new EditorRulersAndGridGroup(parent, getTitle(), this);
+ addAbstractGroup(viewGroupComposite);
}
@@ -87,32 +92,34 @@ public class PapyrusAllDiagramsPreferencePage extends AbstractPapyrusPreferenceP
public static void initDefaults(IPreferenceStore store) {
//Nodes
- PreferenceConverter.setDefault(store, PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
- PreferenceConverter.setDefault(store, PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.COLOR_LINE), new org.eclipse.swt.graphics.RGB(0, 0, 0));
+ PreferenceConverter.setDefault(store, PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
+ PreferenceConverter.setDefault(store, PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.COLOR_LINE), new org.eclipse.swt.graphics.RGB(0, 0, 0));
// Set the default for the gradient
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.GRADIENT_POLICY), false);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.GRADIENT_POLICY), false);
GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(new org.eclipse.swt.graphics.RGB(255, 255, 255), new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());
// Links
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.SMOOTHNESS), Smoothness.NONE);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.JUMPLINK_STATUS), JumpLinkStatus.NONE);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.JUMPLINK_TYPE), JumpLinkStatus.NONE);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.JUMPLINK_REVERSE), false);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.SMOOTHNESS), Smoothness.NONE);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.JUMPLINK_STATUS), JumpLinkStatus.NONE);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.JUMPLINK_TYPE), JumpLinkStatus.NONE);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.JUMPLINK_REVERSE), false);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.ROUTING_STYLE), Routing.MANUAL);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.ROUTING_POLICY_OBSTRUCTION), false);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.ROUTING_POLICY_DISTANCE), false);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.ROUTING_STYLE), Routing.MANUAL);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.ROUTING_POLICY_OBSTRUCTION), false);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.ROUTING_POLICY_DISTANCE), false);
//decoration
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.SHADOW), false);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.ELEMENTICON), false);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.QUALIFIEDNAME), false);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.SHADOW), false);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.ELEMENTICON), false);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.QUALIFIEDNAME), false);
//dimension
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.WIDTH), 100);
- store.setDefault(PreferenceConstantHelper.getPapyrusEditorConstant(PreferenceConstantHelper.HEIGHT), 100);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.WIDTH), 100);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.HEIGHT), 100);
+ //Rulers and grid group
+ RulersAndGridGroup.initDefaults(store);
}
/**
@@ -120,7 +127,7 @@ public class PapyrusAllDiagramsPreferencePage extends AbstractPapyrusPreferenceP
*/
public void storeAllPreferences() {
super.storeAllPreferences();
- ((PapyrusPreferenceStore)getPreferenceStore()).deleteAllSubPreference(PreferenceConstantHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX);
+ ((PapyrusPreferenceStore)getPreferenceStore()).deleteAllSubPreference(PreferencesConstantsHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusRulersAndGridPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusRulersAndGridPreferencePage.java
deleted file mode 100644
index 9b60f04eb2f..00000000000
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusRulersAndGridPreferencePage.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
- * Copyright (c) 2008 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
-import org.eclipse.ui.IWorkbenchPropertyPage;
-import org.eclipse.ui.preferences.ScopedPreferenceStore;
-
-/**
- * The preference page for the rulers and grid
- *
- * @author tlandre
- */
-public class PapyrusRulersAndGridPreferencePage extends RulerGridPreferencePage implements IWorkbenchPropertyPage {
-
- private IProject project;
-
- public PapyrusRulersAndGridPreferencePage() {
- setPreferenceStore(null);
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
- */
- public IAdaptable getElement() {
- return project;
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
- */
- public void setElement(IAdaptable element) {
- project = (IProject)element.getAdapter(IResource.class);
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
- */
- protected IPreferenceStore doGetPreferenceStore() {
- IPreferenceStore store;
- if(project != null) {
- store = new ScopedPreferenceStore(new ProjectScope(project), getBundleId());
- } else {
- store = new ScopedPreferenceStore(new InstanceScope(), getBundleId());
- }
- return store;
- }
-
- /**
- * @return this bundle ID.
- */
- private String getBundleId() {
- return Activator.PLUGIN_ID;
- }
-}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/AbstractGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/AbstractGroup.java
index 0a6ac336c04..dfbfe516602 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/AbstractGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/AbstractGroup.java
@@ -19,7 +19,7 @@ import java.util.Set;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -92,12 +92,12 @@ public abstract class AbstractGroup extends Composite {
* Get the specified preference type associated with this preference page.
*
* @param preferenceType
- * an int representing the preference type to retrieve. It must be a value defined in {@link PreferenceConstantHelper}
+ * an int representing the preference type to retrieve. It must be a value defined in {@link PreferencesConstantsHelper}
*
* @return the preference constant used to store the given preference type.
*/
protected String getPreferenceConstant(int preferenceType) {
- return PreferenceConstantHelper.getElementConstant(key, preferenceType);
+ return PreferencesConstantsHelper.getElementConstant(key, preferenceType);
}
/**
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/BackgroundColor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/BackgroundColor.java
index 5310a9612f1..7a622bbc66c 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/BackgroundColor.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/BackgroundColor.java
@@ -18,9 +18,9 @@ import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages;
import org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.GradientFieldEditor;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -75,13 +75,13 @@ public class BackgroundColor extends AbstractGroup {
Label useGradientLabel = new Label(useGradientCompo, SWT.NULL);
useGradientLabel.setText(Messages.AbstractPapyrusNodePreferencePage_Activate);
Composite useGradientFillEditorCompo = getEncapsulatedCompo(useGradientCompo);
- useGradientFillEditor = new BooleanFieldEditor(getPreferenceConstant(PreferenceConstantHelper.GRADIENT_POLICY), "", useGradientFillEditorCompo); //$NON-NLS-1$
+ useGradientFillEditor = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.GRADIENT_POLICY), "", useGradientFillEditorCompo); //$NON-NLS-1$
useGradientFillEditor.setPage(dialogPage);
addFieldEditor(useGradientFillEditor);
Composite gradientFillEditorCompo = getEncapsulatedCompo(fillColorGroup);
- gradientFillEditor = new GradientFieldEditor(getPreferenceConstant(PreferenceConstantHelper.COLOR_GRADIENT), gradientFillEditorCompo);
+ gradientFillEditor = new GradientFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.COLOR_GRADIENT), gradientFillEditorCompo);
gradientFillEditor.setPage(dialogPage);
gradientFillEditor.setEnabled(useGradientFillEditor.getBooleanValue());
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/ConnectionGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/ConnectionGroup.java
index 24743f10387..adad25c62b2 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/ConnectionGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/ConnectionGroup.java
@@ -20,8 +20,8 @@ import org.eclipse.gmf.runtime.notation.Smoothness;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.ComboFieldEditor;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
@@ -111,7 +111,7 @@ public class ConnectionGroup extends AbstractGroup {
connectionGroup.setLayout(new GridLayout());
connectionGroup.setText(Messages.AbstractPapyrusLinkPreferencePage_Connection);
- ComboFieldEditor smoothnessComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferenceConstantHelper.SMOOTHNESS), Messages.AbstractPapyrusLinkPreferencePage_Smoothness, SMOOTHNESS_COMBOFIELDEDITOR_NAMES_AND_VALUES, connectionGroup);
+ ComboFieldEditor smoothnessComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.SMOOTHNESS), Messages.AbstractPapyrusLinkPreferencePage_Smoothness, SMOOTHNESS_COMBOFIELDEDITOR_NAMES_AND_VALUES, connectionGroup);
addFieldEditor(smoothnessComboFieldEditor);
@@ -131,17 +131,17 @@ public class ConnectionGroup extends AbstractGroup {
jumpLinkGroup.setLayout(new GridLayout());
jumpLinkGroup.setText(Messages.AbstractPapyrusLinkPreferencePage_JUMPLINKS);
- jumpLinkStatusComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferenceConstantHelper.JUMPLINK_STATUS), JUMPLINK_STATUS_COMBOFIELDEDITOR_LABEL, JUMPLINK_STATUS_COMBOFIELDEDITOR_NAMES_AND_VALUES, jumpLinkGroup);
+ jumpLinkStatusComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.JUMPLINK_STATUS), JUMPLINK_STATUS_COMBOFIELDEDITOR_LABEL, JUMPLINK_STATUS_COMBOFIELDEDITOR_NAMES_AND_VALUES, jumpLinkGroup);
jumpLinkStatusComboFieldEditor.setPage(dialogPage);
addFieldEditor(jumpLinkStatusComboFieldEditor);
- jumpLinkTypeComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferenceConstantHelper.JUMPLINK_TYPE), JUMPLINK_TYPE_COMBOFIELDEDITOR_LABEL, JUMPLINK_TYPE_COMBOFIELDEDITOR_NAMES_AND_VALUES, jumpLinkGroup);
+ jumpLinkTypeComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.JUMPLINK_TYPE), JUMPLINK_TYPE_COMBOFIELDEDITOR_LABEL, JUMPLINK_TYPE_COMBOFIELDEDITOR_NAMES_AND_VALUES, jumpLinkGroup);
jumpLinkTypeComboFieldEditor.setPage(dialogPage);
addFieldEditor(jumpLinkTypeComboFieldEditor);
- jumpLinkReverseBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferenceConstantHelper.JUMPLINK_REVERSE), JUMPLINK_REVERSE_BOOLEANFIELDEDITOR_LABEL, jumpLinkGroup);
+ jumpLinkReverseBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.JUMPLINK_REVERSE), JUMPLINK_REVERSE_BOOLEANFIELDEDITOR_LABEL, jumpLinkGroup);
jumpLinkReverseBooleanFieldEditor.setPage(dialogPage);
addFieldEditor(jumpLinkReverseBooleanFieldEditor);
@@ -158,17 +158,17 @@ public class ConnectionGroup extends AbstractGroup {
routingGroup.setLayout(new GridLayout());
routingGroup.setText(Messages.AbstractPapyrusLinkPreferencePage_Routing);
- routingStylesComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferenceConstantHelper.ROUTING_STYLE), ROUTING_STYLES_COMBOFIELDEDITOR_LABEL, ROUTING_STYLES_COMBOFIELDEDITOR_NAMES_AND_VALUES, routingGroup);
+ routingStylesComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.ROUTING_STYLE), ROUTING_STYLES_COMBOFIELDEDITOR_LABEL, ROUTING_STYLES_COMBOFIELDEDITOR_NAMES_AND_VALUES, routingGroup);
routingStylesComboFieldEditor.setPage(dialogPage);
addFieldEditor(routingStylesComboFieldEditor);
- routingObstructionPolicyBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferenceConstantHelper.ROUTING_POLICY_OBSTRUCTION), ROUTING_OBSTRUCTION_POLICY_BOOLEANFIELDEDITOR_LABEL, routingGroup);
+ routingObstructionPolicyBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.ROUTING_POLICY_OBSTRUCTION), ROUTING_OBSTRUCTION_POLICY_BOOLEANFIELDEDITOR_LABEL, routingGroup);
routingObstructionPolicyBooleanFieldEditor.setPage(dialogPage);
addFieldEditor(routingObstructionPolicyBooleanFieldEditor);
- routingDistancePolicyBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferenceConstantHelper.ROUTING_POLICY_DISTANCE), ROUTING_DISTANCE_POLICY_BOOLEANFIELDEDITOR_LABEL, routingGroup);
+ routingDistancePolicyBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.ROUTING_POLICY_DISTANCE), ROUTING_DISTANCE_POLICY_BOOLEANFIELDEDITOR_LABEL, routingGroup);
routingDistancePolicyBooleanFieldEditor.setPage(dialogPage);
addFieldEditor(routingDistancePolicyBooleanFieldEditor);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DecorationGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DecorationGroup.java
index d593ff9e865..31af4f18536 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DecorationGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DecorationGroup.java
@@ -84,4 +84,10 @@ public class DecorationGroup extends AbstractGroup {
addFieldEditor(qualifiedname);
}
+
+ @Override
+ protected String getPreferenceConstant(int preferenceType) {
+ System.out.println(super.getPreferenceConstant(preferenceType));
+ return super.getPreferenceConstant(preferenceType);
+ }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DimensionGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DimensionGroup.java
index 022a0080167..594e44a6334 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DimensionGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DimensionGroup.java
@@ -15,8 +15,8 @@ package org.eclipse.papyrus.infra.gmfdiag.preferences.ui;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
@@ -65,12 +65,12 @@ public class DimensionGroup extends AbstractGroup {
decorationGroup.setLayout(new GridLayout());
decorationGroup.setText(Messages.DimensionGroupName);
- widthFiedEditor = new IntegerFieldEditor(getPreferenceConstant(PreferenceConstantHelper.WIDTH), WIDTH_INTFIELDEDITOR_LABEL, decorationGroup);
+ widthFiedEditor = new IntegerFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.WIDTH), WIDTH_INTFIELDEDITOR_LABEL, decorationGroup);
widthFiedEditor.setPage(dialogPage);
addFieldEditor(widthFiedEditor);
- heightFiedEditor = new IntegerFieldEditor(getPreferenceConstant(PreferenceConstantHelper.HEIGHT), HEIGHT_INTFIELDEDITOR_LABEL, decorationGroup);
+ heightFiedEditor = new IntegerFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.HEIGHT), HEIGHT_INTFIELDEDITOR_LABEL, decorationGroup);
heightFiedEditor.setPage(dialogPage);
addFieldEditor(heightFiedEditor);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/FontGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/FontGroup.java
index 96d018ae320..6bf54fb1f9d 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/FontGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/FontGroup.java
@@ -14,9 +14,9 @@
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages;
import org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.FontFieldEditor;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -45,6 +45,7 @@ public class FontGroup extends AbstractGroup {
**/
public FontGroup(Composite parent, String key, DialogPage dialogPage) {
super(parent, key, dialogPage);
+ System.out.println("FONT key = " + key);
createContent(parent);
}
@@ -58,7 +59,7 @@ public class FontGroup extends AbstractGroup {
Group fontGroup = new Group(parent, SWT.SHADOW_NONE);
fontGroup.setLayout(new GridLayout(1, true));
fontGroup.setText(FONT_GROUPBOX_LABEL);
- fontFieldEditor = new FontFieldEditor(getPreferenceConstant(PreferenceConstantHelper.FONT), fontGroup);
+ fontFieldEditor = new FontFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.FONT), fontGroup);
addFieldEditor(fontFieldEditor);
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LabelGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LabelGroup.java
index 815e3a76b9d..7a39d492129 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LabelGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LabelGroup.java
@@ -19,10 +19,10 @@ import java.util.TreeMap;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
import org.eclipse.papyrus.infra.gmfdiag.preferences.messages.Messages;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.CLabelBooleanFieldEditor;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridLayout;
@@ -72,7 +72,7 @@ public class LabelGroup extends AbstractGroup {
group.setLayout(new GridLayout());
group.setText(Messages.LabelGroup_Labels_To_Display);
for(String role : myRoles.keySet()) {
- String key = PreferenceConstantHelper.getLabelElementConstant(getKey(), role, PreferenceConstantHelper.LABEL_VISIBILITY);
+ String key = PreferencesConstantsHelper.getLabelElementConstant(getKey(), role, PreferencesConstantsHelper.LABEL_VISIBILITY);
Image im = null;
String iconPath = myRoles.get(role);
if(iconPath != null && iconPath != "") { //$NON-NLS-1$
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LinkColorGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LinkColorGroup.java
index e862781d57e..142b71f8bdb 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LinkColorGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LinkColorGroup.java
@@ -15,9 +15,9 @@ package org.eclipse.papyrus.infra.gmfdiag.preferences.ui;
import org.eclipse.gmf.runtime.diagram.ui.properties.internal.l10n.DiagramUIPropertiesImages;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages;
import org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.ColorFieldEditor;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -74,13 +74,13 @@ public class LinkColorGroup extends AbstractGroup {
toolbar.setLayout(new GridLayout(3, false));
Composite fontColorEditorCompo = getEncapsulatedCompo(toolbar);
- fontColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferenceConstantHelper.COLOR_FONT), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_FONT_COLOR), fontColorEditorCompo);
+ fontColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.COLOR_FONT), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_FONT_COLOR), fontColorEditorCompo);
fontColorEditor.setPage(dialogPage);
addFieldEditor(fontColorEditor);
Composite lineColorEditorCompo = getEncapsulatedCompo(toolbar);
- lineColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferenceConstantHelper.COLOR_LINE), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_LINE_COLOR), lineColorEditorCompo);
+ lineColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.COLOR_LINE), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_LINE_COLOR), lineColorEditorCompo);
lineColorEditor.setPage(dialogPage);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeColorGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeColorGroup.java
index 757a57126f5..8773bed4a82 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeColorGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeColorGroup.java
@@ -15,8 +15,8 @@ package org.eclipse.papyrus.infra.gmfdiag.preferences.ui;
import org.eclipse.gmf.runtime.diagram.ui.properties.internal.l10n.DiagramUIPropertiesImages;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.ColorFieldEditor;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.widgets.Composite;
/**
@@ -59,7 +59,7 @@ public class NodeColorGroup extends LinkColorGroup {
super.createContent(parent);
Composite fillColorEditorCompo = getEncapsulatedCompo(getToolbar());
- fillColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferenceConstantHelper.COLOR_FILL), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_FILL_COLOR), fillColorEditorCompo);
+ fillColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.COLOR_FILL), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_FILL_COLOR), fillColorEditorCompo);
fillColorEditor.setPage(dialogPage);
addFieldEditor(fillColorEditor);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeCompartmentGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeCompartmentGroup.java
index b8c70f9fe09..bac2da99fae 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeCompartmentGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeCompartmentGroup.java
@@ -21,7 +21,7 @@ import java.util.Set;
import org.eclipse.gmf.runtime.common.ui.preferences.CheckBoxFieldEditor;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -84,12 +84,12 @@ public class NodeCompartmentGroup extends AbstractGroup {
gridData.horizontalSpan = 2;
group.setLayoutData(gridData);
- String compartmentVisibilityPreference = PreferenceConstantHelper.getCompartmentElementConstant(getKey(), compartment, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
+ String compartmentVisibilityPreference = PreferencesConstantsHelper.getCompartmentElementConstant(getKey(), compartment, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY);
String compartmentVisibilityLabel = "Show compartment";
Button showCompartmentButton = addCheckboxField(group, compartmentVisibilityPreference, compartmentVisibilityLabel);
if(this.compartmentsWithTitle.contains(compartment)) {
- String compartmentNameVisibilityPreference = PreferenceConstantHelper.getCompartmentElementConstant(getKey(), compartment, PreferenceConstantHelper.COMPARTMENT_NAME_VISIBILITY);
+ String compartmentNameVisibilityPreference = PreferencesConstantsHelper.getCompartmentElementConstant(getKey(), compartment, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY);
String compartmentNameVisibilityLabel = "Show title";
Button showNameButton = addCheckboxField(group, compartmentNameVisibilityPreference, compartmentNameVisibilityLabel);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedCompartmentGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedCompartmentGroup.java
index c8027053a2d..d7899d772f4 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedCompartmentGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedCompartmentGroup.java
@@ -20,7 +20,7 @@ import java.util.List;
import org.eclipse.gmf.runtime.common.ui.preferences.CheckBoxFieldEditor;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -83,12 +83,12 @@ public class OrderedCompartmentGroup extends AbstractGroup {
gridData.horizontalSpan = 2;
group.setLayoutData(gridData);
- String compartmentVisibilityPreference = PreferenceConstantHelper.getCompartmentElementConstant(getKey(), compartmentName, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
+ String compartmentVisibilityPreference = PreferencesConstantsHelper.getCompartmentElementConstant(getKey(), compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY);
String compartmentVisibilityLabel = "Show compartment";
Button showCompartmentButton = addCheckboxField(group, compartmentVisibilityPreference, compartmentVisibilityLabel);
if(this.compartmentsWithTitle.contains(compartmentName)) {
- String compartmentNameVisibilityPreference = PreferenceConstantHelper.getCompartmentElementConstant(getKey(), compartmentName, PreferenceConstantHelper.COMPARTMENT_NAME_VISIBILITY);
+ String compartmentNameVisibilityPreference = PreferencesConstantsHelper.getCompartmentElementConstant(getKey(), compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY);
String compartmentNameVisibilityLabel = "Show title";
Button showNameButton = addCheckboxField(group, compartmentNameVisibilityPreference, compartmentNameVisibilityLabel);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedLabelGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedLabelGroup.java
index f5aefe03a64..7f48655ef36 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedLabelGroup.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedLabelGroup.java
@@ -21,10 +21,10 @@ import java.util.Map;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
import org.eclipse.papyrus.infra.gmfdiag.preferences.messages.Messages;
import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.CLabelBooleanFieldEditor;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridLayout;
@@ -92,7 +92,7 @@ public class OrderedLabelGroup extends AbstractGroup {
group.setLayout(new GridLayout());
group.setText(Messages.LabelGroup_Labels_To_Display);
for(String role : myRoles.keySet()) {
- String key = PreferenceConstantHelper.getLabelElementConstant(getKey(), role, PreferenceConstantHelper.LABEL_VISIBILITY);
+ String key = PreferencesConstantsHelper.getLabelElementConstant(getKey(), role, PreferencesConstantsHelper.LABEL_VISIBILITY);
Image im = null;
String iconPath = myRoles.get(role);
if(iconPath != null && iconPath != "") { //$NON-NLS-1$
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/RulersAndGridGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/RulersAndGridGroup.java
new file mode 100644
index 00000000000..1c7033d76ae
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/RulersAndGridGroup.java
@@ -0,0 +1,494 @@
+/*****************************************************************************
+ * 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;
+
+import java.text.ParseException;
+import java.text.ParsePosition;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.gef.rulers.RulerProvider;
+import org.eclipse.gmf.runtime.common.ui.preferences.ComboFieldEditor;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.diagram.ui.properties.internal.l10n.DiagramUIPropertiesImages;
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.providers.LineStyleLabelProvider;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.UnitsConstants;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.UnitsConverterUtils;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.ColorFieldEditor;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.messages.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import com.ibm.icu.text.NumberFormat;
+
+/**
+ *
+ * This group provides the elements to manage the grid of a diagram
+ * Adapter code from the Preference Page Rulers And Grid
+ */
+@SuppressWarnings("restriction")
+public class RulersAndGridGroup extends AbstractGroup {
+
+ private int oldUnits = -1;
+
+ private String RULER_GROUP_LABEL = DiagramUIMessages.GridRulerPreferencePage_rulerGroup_label;
+
+ private String SHOW_RULERS_LABEL = DiagramUIMessages.GridRulerPreferencePage_showRulers_label;
+
+ private String RULER_UNITS_LABEL = DiagramUIMessages.GridRulerPreferencePage_rulerUnits_label;
+
+ private String RULER_UNITS_IN_LABEL = DiagramUIMessages.GridRulerPreferencePage_rulerUnits_inch_label;
+
+ private String RULER_UNITS_CM_LABEL = DiagramUIMessages.GridRulerPreferencePage_rulerUnits_cm_label;
+
+ private String RULER_UNITS_PIXEL_LABEL = DiagramUIMessages.GridRulerPreferencePage_rulerUnits_pixel_label;
+
+ private String GRID_GROUP_LABEL = DiagramUIMessages.GridRulerPreferencePage_gridGroup_label;
+
+ private String SHOW_GRID_LABEL = DiagramUIMessages.GridRulerPreferencePage_showGrid_label;
+
+ private String SNAP_TO_GRID_LABEL = DiagramUIMessages.GridRulerPreferencePage_snapToGrid_label;
+
+ private String SNAP_TO_GEOMETRY_LABEL = DiagramUIMessages.GridRulerPreferencePage_snapToGeometry_label;
+
+ private String GRID_SPACING_LABEL_INCHES = DiagramUIMessages.GridRulerPreferencePage_gridSpacing_label_inches;
+
+ private String GRID_SPACING_LABEL_CM = DiagramUIMessages.GridRulerPreferencePage_gridSpacing_label_cm;
+
+ private String GRID_SPACING_LABEL_PIXELS = DiagramUIMessages.GridRulerPreferencePage_gridSpacing_label_pixels;
+
+ protected String getPreferenceConstant(int preferenceType) {
+ return PreferencesConstantsHelper.getElementConstant(getKey(), preferenceType);
+ }
+
+ // Ruler Field Editors
+ private BooleanFieldEditor showRulers = null;
+
+ private ComboFieldEditor rulerUnits;
+
+ // Grid Field Editors
+ private BooleanFieldEditor showGrid = null;
+
+ private BooleanFieldEditor snapToGrid = null;
+
+ private BooleanFieldEditor snapToGeometry = null;
+
+ private DoubleFieldEditor gridSpacing = null;
+
+ private BooleanFieldEditor gridInFront = null;
+
+ private ComboFieldEditor gridStyle = null;
+
+ private Composite dblGroup = null;
+
+ private ColorFieldEditor gridColorEditor = null;
+
+ /**
+ *
+ * @param store
+ * the preference store to initialize
+ */
+ public static void initDefaults(IPreferenceStore store) {
+ //rulers and grid
+ // String defaultCountry = Locale.getDefault().getCountry();
+ // if(defaultCountry == null || defaultCountry.equals(Locale.US.getCountry()) || defaultCountry.equals(Locale.CANADA.getCountry())) {
+ // store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.RULER_UNITS), RulerProvider.UNIT_INCHES);
+ // } else {
+ // store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.RULER_UNITS), RulerProvider.UNIT_CENTIMETERS);
+ // }
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.RULER_UNITS), RulerProvider.UNIT_PIXELS);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.VIEW_RULER), false);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.VIEW_GRID), false);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.SNAP_TO_GRID), false);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.SNAP_TO_GEOMETRY), false);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.GRID_LINE_STYLE), Graphics.LINE_CUSTOM);
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.GRID_ORDER), false);
+ final int rgbValue = 50;
+ PreferenceConverter.setDefault(store, PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.GRID_LINE_COLOR), new org.eclipse.swt.graphics.RGB(rgbValue, rgbValue, rgbValue));
+ store.setDefault(PreferencesConstantsHelper.getPapyrusEditorConstant(PreferencesConstantsHelper.GRID_SPACING), 20);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * @param key
+ * @param dialogPage
+ */
+ public RulersAndGridGroup(final Composite parent, final String key, final DialogPage dialogPage) {
+ super(parent, key, dialogPage);
+ createContents(parent);
+ }
+
+ /**
+ *
+ * @param parent
+ */
+ public void createContents(final Composite parent) {
+ addRulerFields(parent);
+ addGridFields(parent);
+ }
+
+
+ private void addRulerFields(Composite parent) {
+
+ // Create a Group to hold the ruler fields
+ Group group = new Group(parent, SWT.NONE);
+ group.setText(RULER_GROUP_LABEL);
+
+ GridLayout gridLayout = new GridLayout(1, false);
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalSpan = 1;
+
+ // Add the fields to the group
+ showRulers = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.VIEW_RULER), SHOW_RULERS_LABEL, group);
+ addFieldEditor(showRulers);
+
+ rulerUnits = new ComboFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.RULER_UNITS), RULER_UNITS_LABEL, group, ComboFieldEditor.INT_TYPE_INDEXED, false, 0, 0, true);
+ addFieldEditor(rulerUnits);
+ rulerUnits.addIndexedItemToCombo(RULER_UNITS_IN_LABEL, RulerProvider.UNIT_INCHES);
+ rulerUnits.addIndexedItemToCombo(RULER_UNITS_CM_LABEL, RulerProvider.UNIT_CENTIMETERS);
+ rulerUnits.addIndexedItemToCombo(RULER_UNITS_PIXEL_LABEL, RulerProvider.UNIT_PIXELS);
+ final Combo rulerUnitsCombo = rulerUnits.getComboControl();
+ rulerUnitsCombo.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ //do nothing
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ updateUnits();
+ }
+ });
+ group.setLayout(gridLayout);
+ group.setLayoutData(gridData);
+
+ }
+
+ private void addGridFields(Composite parent) {
+
+ // Create a Group to hold the grid fields
+ Group group = new Group(parent, SWT.NONE);
+ group.setText(GRID_GROUP_LABEL);
+
+ GridLayout gridLayout = new GridLayout(2, true);
+
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalSpan = 1;
+
+ showGrid = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.VIEW_GRID), SHOW_GRID_LABEL, group);
+ addFieldEditor(showGrid);
+
+ snapToGrid = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.SNAP_TO_GRID), SNAP_TO_GRID_LABEL, group);
+ addFieldEditor(snapToGrid);
+
+ snapToGeometry = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.SNAP_TO_GEOMETRY), SNAP_TO_GEOMETRY_LABEL, group);
+ addFieldEditor(snapToGeometry);
+
+ gridInFront = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.GRID_ORDER), Messages.RulersAndGridGroup_GridInFront, group);
+ addFieldEditor(gridInFront);
+
+ addGridStyle(group);
+
+ addGridColor(group);
+
+ addGridSpacing(group);
+
+ group.setLayoutData(gridData);
+ group.setLayout(gridLayout);
+ }
+
+ private void addGridStyle(final Composite parent) {
+ final Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(2, true));
+ this.gridStyle = new ComboFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.GRID_LINE_STYLE), Messages.RulersAndGridGroup_GridStyle, composite, ComboFieldEditor.INT_TYPE_INDEXED, false, 0, 0, true);
+ this.gridStyle.addIndexedItemToCombo(LineStyleLabelProvider.LINE_STYLE_SOLID_STRING, Graphics.LINE_SOLID);
+ this.gridStyle.addIndexedItemToCombo(LineStyleLabelProvider.LINE_STYLE_DASH_STRING, Graphics.LINE_DASH);
+ this.gridStyle.addIndexedItemToCombo(LineStyleLabelProvider.LINE_STYLE_DOT_STRING, Graphics.LINE_DOT);
+ this.gridStyle.addIndexedItemToCombo(LineStyleLabelProvider.LINE_STYLE_DASH_DOT_STRING, Graphics.LINE_DASHDOT);
+ this.gridStyle.addIndexedItemToCombo(LineStyleLabelProvider.LINE_STYLE_DASH_DOT_DOT_STRING, Graphics.LINE_DASHDOTDOT);
+ this.gridStyle.addIndexedItemToCombo(LineStyleLabelProvider.LINE_STYLE_CUSTOM, Graphics.LINE_CUSTOM);
+ addFieldEditor(gridStyle);
+ }
+
+ private void addGridColor(final Composite parent) {
+ final Composite composite = new Composite(parent, SWT.NONE);
+ Label label = new Label(composite, SWT.NONE);
+
+ label.setText(Messages.RulersAndGridGroup_GridColor);
+ gridColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.GRID_LINE_COLOR), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_LINE_COLOR), composite);
+ addFieldEditor(gridColorEditor);
+ composite.setLayout(new GridLayout(2, true));
+ }
+
+
+
+ private void addGridSpacing(Composite parent) {
+
+ dblGroup = new Composite(parent, SWT.NONE);
+
+ GridLayout gridLayout = new GridLayout(2, false);
+
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalSpan = 2;
+
+ gridSpacing = new DoubleFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.GRID_SPACING), GRID_SPACING_LABEL_INCHES, dblGroup);
+ gridSpacing.setTextLimit(10);
+ addFieldEditor(gridSpacing);
+
+ updateUnits();
+
+ dblGroup.setLayoutData(gridData);
+ dblGroup.setLayout(gridLayout);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.gmf.runtime.common.ui.preferences.AbstractPreferencePage#initHelp()
+ */
+ protected void initHelp() {
+ // TODO: Implement to support context help
+ }
+
+ /**
+ * The NumberFormatter.parse() could return a Long or Double
+ * We are storing all values related to the page setup as doubles
+ * so we call this function when ever we are getting values from
+ * the dialog.
+ *
+ * @param number
+ * @return
+ */
+ private Double forceDouble(Number number) {
+ if(!(number instanceof Double))
+ return new Double(number.doubleValue());
+ return (Double)number;
+ }
+
+ private void updateUnits() {
+
+ int units = getUnits();
+
+ switch(units) {
+ case RulerProvider.UNIT_INCHES:
+ gridSpacing.setLabelText(GRID_SPACING_LABEL_INCHES);
+ break;
+
+ case RulerProvider.UNIT_CENTIMETERS:
+ gridSpacing.setLabelText(GRID_SPACING_LABEL_CM);
+ break;
+
+ case RulerProvider.UNIT_PIXELS:
+ gridSpacing.setLabelText(GRID_SPACING_LABEL_PIXELS);
+ break;
+ }
+
+ gridSpacing.setStringValue(UnitsConverterUtils.convertUnits(oldUnits, units, gridSpacing.getStringValue()));
+ oldUnits = units;
+
+ dblGroup.layout();
+
+ }
+
+ private int getUnits() {
+ int units = rulerUnits.getComboControl().getSelectionIndex();
+
+ // IF no selection has been made
+ if(units == -1) {
+ // Read the preference store
+ units = 1;//FIXME;
+ oldUnits = units;
+ }
+ return units;
+ }
+
+ // private String convertUnits(int fromUnits, int toUnits) {
+ // 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 = getDisplay();
+ //
+ // switch(fromUnits) {
+ // case RulerProvider.UNIT_INCHES:
+ // pixelValue = value.doubleValue() * display.getDPI().x;
+ // break;
+ // case RulerProvider.UNIT_CENTIMETERS:
+ // pixelValue = value.doubleValue() * display.getDPI().x / UnitsUtils.INCH2CM;
+ // break;
+ // case RulerProvider.UNIT_PIXELS:
+ // pixelValue = value.intValue();
+ // }
+ //
+ // double returnValue = 0;
+ //
+ // switch(toUnits) {
+ // case RulerProvider.UNIT_INCHES:
+ // returnValue = pixelValue / display.getDPI().x;
+ // break;
+ // case RulerProvider.UNIT_CENTIMETERS:
+ // returnValue = pixelValue * UnitsUtils.INCH2CM / display.getDPI().x;
+ // break;
+ // case RulerProvider.UNIT_PIXELS:
+ // returnValue = pixelValue;
+ // }
+ //
+ // return numberFormatter.format(returnValue);
+ // }
+
+
+ /**
+ *
+ * converts the current units used to a base unit value to be used (e.g. in validation)
+ *
+ * @param number
+ * Units to be converted to the base unit
+ * @return
+ */
+ private double convertToBase(double number) {
+
+ double returnValue = 0;
+ switch(getUnits()) {
+ case RulerProvider.UNIT_INCHES:
+ returnValue = number;
+ break;
+ case RulerProvider.UNIT_CENTIMETERS:
+ returnValue = number / UnitsConstants.INCH2CM;
+ break;
+ case RulerProvider.UNIT_PIXELS:
+ returnValue = number / getDisplay().getDPI().x;
+ }
+ return returnValue;
+ }
+
+ private class DoubleFieldEditor extends StringFieldEditor {
+
+ private double minValidValue = 00.009;
+
+ private double maxValidValue = 99.999;
+
+ public DoubleFieldEditor(String pref, String label, Composite parent) {
+ super(pref, label, parent);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.StringFieldEditor#doCheckState()
+ */
+ protected boolean doCheckState() {
+ Text text = getTextControl();
+
+ if(text == null)
+ return false;
+
+ try {
+ NumberFormat numberFormatter = NumberFormat.getInstance();
+ ParsePosition parsePosition = new ParsePosition(0);
+ Number parsedNumber = numberFormatter.parse(text.getText(), parsePosition);
+
+ if(parsedNumber == null) {
+ showErrorMessage();
+ return false;
+ }
+
+ Double pageHeight = forceDouble(parsedNumber);
+ double number = pageHeight.doubleValue();
+ number = convertToBase(number);
+ if(number >= 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<String> result = new ArrayList<String>();
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;
+
/**
* <p>
* A class that defines the available preference type available through Papyrus.
@@ -39,196 +41,147 @@ package org.eclipse.papyrus.infra.gmfdiag.preferences.utils;
* It also helps to retrieve the string used to store the preference type for a given element.
* </p>
*
+ * @deprecated use org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper
*/
+@SuppressWarnings("restriction")
+@Deprecated
public class PreferenceConstantHelper {
/**
* Prefix for preference for Papyrus Level editor
*/
- public static String PAPYRUS_EDITOR_PREFERENCE_PREFIX = "PAPYRUS_EDITOR"; //$NON-NLS-1$
+ public static String PAPYRUS_EDITOR_PREFERENCE_PREFIX = PreferencesConstantsHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX;
/**
* Prefix for preference for Diagram Level
*/
- public static String DIAGRAM_PREFERENCE_PREFIX = "DIAGRAM_"; //$NON-NLS-1$
+ public static String DIAGRAM_PREFERENCE_PREFIX = PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX;
/**
* Prefix for preference for element Level
*/
- public static String DIAGRAM_ELEMENT = "ELEMENT_"; //$NON-NLS-1$
-
- private final static String COLOR = "color."; //$NON-NLS-1$
-
- private final static String GRADIENT = "gradient"; //$NON-NLS-1$
-
- private final static String POLICY = ".policy"; //$NON-NLS-1$
-
- private final static String JUMPLINK = "jumplink."; //$NON-NLS-1$
-
- private final static String ROUTING = "routing"; //$NON-NLS-1$
-
- private final static String ROUTING_POLICY = ROUTING + POLICY;
-
- private final static String COLOR_FILL_CONSTANT = COLOR + "fill"; //$NON-NLS-1$
-
- private final static String FONT_CONSTANT = "font"; //$NON-NLS-1$
-
- private final static String COLOR_FONT_CONSTANT = COLOR + FONT_CONSTANT;
-
- private final static String COLOR_LINE_CONSTANT = COLOR + "line"; //$NON-NLS-1$
-
- private final static String COLOR_GRADIENT_CONSTANT = COLOR + GRADIENT;
-
- private final static String GRADIENT_POLICY_CONSTANT = GRADIENT + POLICY;
-
- private final static String JUMPLINK_STATUS_CONSTANT = JUMPLINK + "status"; //$NON-NLS-1$
-
- private final static String JUMPLINK_REVERSE_CONSTANT = JUMPLINK + "reverse"; //$NON-NLS-1$
-
- private final static String JUMPLINK_TYPE_CONSTANT = JUMPLINK + "type"; //$NON-NLS-1$
+ public static String DIAGRAM_ELEMENT = PreferencesConstantsHelper.DIAGRAM_ELEMENT;
- private final static String ROUTING_POLICY_DISTANCE_CONSTANT = ROUTING_POLICY + ".distance"; //$NON-NLS-1$
-
- private final static String ROUTING_POLICY_OBSTRUCTION_CONSTANT = ROUTING_POLICY + ".obstruction"; //$NON-NLS-1$
-
- private final static String ROUTING_STYLE_CONSTANT = ROUTING + ".style"; //$NON-NLS-1$
-
- private final static String SMOOTHNESS_CONSTANT = "smoothness"; //$NON-NLS-1$
-
- private final static String SHADOW_CONSTANT = "shadow"; //$NON-NLS-1$
-
- private final static String ELEMENTICON_CONSTANT = "elementicon"; //$NON-NLS-1$
-
- private final static String QUALIFIEDNAME_CONSTANT = "qualifiedname"; //$NON-NLS-1$
-
- private final static String HEIGHT_CONSTANT = "height";//$NON-NLS-1$
-
- private final static String WIDTH_CONSTANT = "width"; //$NON-NLS-1$
-
- private final static String COMPARTMENT_VISIBILITY_CONSTANT = "compartment.visibility"; //$NON-NLS-1$
-
- private final static String COMPARTMENT_NAME_VISIBILITY_CONSTANT = "compartment_name.visibility"; //$NON-NLS-1$
-
- private final static String LABEL_VISIBILITY_CONSTANT = "label.visibility"; //$NON-NLS-1$
-
- private final static String LOCATION_X_CONSTANT = "location_x";//$NON-NLS-1$
-
- private final static String LOCATION_Y_CONSTANT = "location_y"; //$NON-NLS-1$
/**
* A preference of type COLOR FILL
*/
- public final static int COLOR_FILL = 0;
+ public final static int COLOR_FILL = PreferencesConstantsHelper.COLOR_FILL;
/**
* A preference of type FONT
*/
- public final static int FONT = COLOR_FILL + 1;
+ public final static int FONT = PreferencesConstantsHelper.FONT;
/**
* A preference of type COLOR FONT
*/
- public final static int COLOR_FONT = FONT + 1;
+ public final static int COLOR_FONT = PreferencesConstantsHelper.COLOR_FONT;
/**
* A preference of type COLOR LINE
*/
- public final static int COLOR_LINE = COLOR_FONT + 1;
+ public final static int COLOR_LINE = PreferencesConstantsHelper.COLOR_LINE;
/**
* A preference of type COLOR GRADIENT
*/
- public final static int COLOR_GRADIENT = COLOR_LINE + 1;
+ public final static int COLOR_GRADIENT = PreferencesConstantsHelper.COLOR_GRADIENT;
/**
* A preference of type GRADIENT POLICY
*/
- public final static int GRADIENT_POLICY = COLOR_GRADIENT + 1;
+ public final static int GRADIENT_POLICY = PreferencesConstantsHelper.GRADIENT_POLICY;
/**
* A preference of type JUMPLINK STATUS
*/
- public final static int JUMPLINK_STATUS = GRADIENT_POLICY + 1;
+ public final static int JUMPLINK_STATUS = PreferencesConstantsHelper.JUMPLINK_STATUS;
/**
* A preference of type JUMPLINK REVERSE
*/
- public final static int JUMPLINK_REVERSE = JUMPLINK_STATUS + 1;
+ public final static int JUMPLINK_REVERSE = PreferencesConstantsHelper.JUMPLINK_REVERSE;
/**
* A preference of type JUMPLINK TYPE
*/
- public final static int JUMPLINK_TYPE = JUMPLINK_REVERSE + 1;
+ public final static int JUMPLINK_TYPE = PreferencesConstantsHelper.JUMPLINK_TYPE;
/**
* A preference of type ROUTING POLICY DISTANCE
*/
- public final static int ROUTING_POLICY_DISTANCE = JUMPLINK_TYPE + 1;
+ public final static int ROUTING_POLICY_DISTANCE = PreferencesConstantsHelper.ROUTING_POLICY_DISTANCE;
/**
* A preference of type ROUTING POLICY OBSTRUCTION
*/
- public final static int ROUTING_POLICY_OBSTRUCTION = ROUTING_POLICY_DISTANCE + 1;
+ public final static int ROUTING_POLICY_OBSTRUCTION = PreferencesConstantsHelper.ROUTING_POLICY_OBSTRUCTION;
/**
* A preference of type ROUTING STYLE
*/
- public final static int ROUTING_STYLE = ROUTING_POLICY_OBSTRUCTION + 1;
+ public final static int ROUTING_STYLE = PreferencesConstantsHelper.ROUTING_STYLE;
/**
* A preference of type SMOOTHNESS
*/
- public final static int SMOOTHNESS = ROUTING_STYLE + 1;
+ public final static int SMOOTHNESS = PreferencesConstantsHelper.SMOOTHNESS;
/**
* A preference of type Shadow
*/
- public final static int SHADOW = SMOOTHNESS + 1;
+ public final static int SHADOW = PreferencesConstantsHelper.SHADOW;
/**
* A preference of type elementIcon
*/
- public final static int ELEMENTICON = SHADOW + 1;
+ public final static int ELEMENTICON = PreferencesConstantsHelper.ELEMENTICON;
/**
* A preference of type QualifiedName
*/
- public final static int QUALIFIEDNAME = ELEMENTICON + 1;
+ public final static int QUALIFIEDNAME = PreferencesConstantsHelper.QUALIFIEDNAME;
/**
* A preference of type height
*/
- public static final int HEIGHT = QUALIFIEDNAME + 1;
+ public static final int HEIGHT = PreferencesConstantsHelper.HEIGHT;
/**
* A preference of type width
*/
- public static final int WIDTH = HEIGHT + 1;
+ public static final int WIDTH = PreferencesConstantsHelper.WIDTH;
/**
* A preference of type compartment visibility
*/
- public static final int COMPARTMENT_VISIBILITY = WIDTH + 1;
+ public static final int COMPARTMENT_VISIBILITY = PreferencesConstantsHelper.COMPARTMENT_VISIBILITY;
/**
* A preference of type compartment visibility
*/
- public static final int COMPARTMENT_NAME_VISIBILITY = COMPARTMENT_VISIBILITY + 1;
+ public static final int COMPARTMENT_NAME_VISIBILITY = PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY;
/**
* A preference of type label visibility
*/
- public static final int LABEL_VISIBILITY = COMPARTMENT_NAME_VISIBILITY + 1;
+ public static final int LABEL_VISIBILITY = PreferencesConstantsHelper.LABEL_VISIBILITY;
/**
* A preference for label default location
*/
- public static final int LOCATION_X = LABEL_VISIBILITY + 1;
+ public static final int LOCATION_X = PreferencesConstantsHelper.LOCATION_X;
/**
* A preference for label default location
*/
- public static final int LOCATION_Y = LOCATION_X + 1;
+ public static final int LOCATION_Y = PreferencesConstantsHelper.LOCATION_Y;
+
+ /**
+ * A preference to diplay or not the rulers
+ */
+ public static final int SHOW_RULER = PreferencesConstantsHelper.VIEW_RULER;
/**
@@ -241,85 +194,7 @@ public class PreferenceConstantHelper {
* @return the constant used.
*/
public static String getConstant(String elementName, int preferenceType) {
- StringBuffer sb = new StringBuffer();
- sb.append(elementName);
- sb.append("."); //$NON-NLS-1$
-
- switch(preferenceType) {
- case COLOR_FILL:
- sb.append(COLOR_FILL_CONSTANT);
- break;
- case FONT:
- sb.append(FONT_CONSTANT);
- break;
- case COLOR_FONT:
- sb.append(COLOR_FONT_CONSTANT);
- break;
- case COLOR_LINE:
- sb.append(COLOR_LINE_CONSTANT);
- break;
- case COLOR_GRADIENT:
- sb.append(COLOR_GRADIENT_CONSTANT);
- break;
- case GRADIENT_POLICY:
- sb.append(GRADIENT_POLICY_CONSTANT);
- break;
- case JUMPLINK_STATUS:
- sb.append(JUMPLINK_STATUS_CONSTANT);
- break;
- case JUMPLINK_REVERSE:
- sb.append(JUMPLINK_REVERSE_CONSTANT);
- break;
- case JUMPLINK_TYPE:
- sb.append(JUMPLINK_TYPE_CONSTANT);
- break;
- case ROUTING_POLICY_DISTANCE:
- sb.append(ROUTING_POLICY_DISTANCE_CONSTANT);
- break;
- case ROUTING_POLICY_OBSTRUCTION:
- sb.append(ROUTING_POLICY_OBSTRUCTION_CONSTANT);
- break;
- case ROUTING_STYLE:
- sb.append(ROUTING_STYLE_CONSTANT);
- break;
- case SMOOTHNESS:
- sb.append(SMOOTHNESS_CONSTANT);
- break;
- case SHADOW:
- sb.append(SHADOW_CONSTANT);
- break;
- case ELEMENTICON:
- sb.append(ELEMENTICON_CONSTANT);
- break;
- case QUALIFIEDNAME:
- sb.append(QUALIFIEDNAME_CONSTANT);
- break;
- case HEIGHT:
- sb.append(HEIGHT_CONSTANT);
- break;
- case WIDTH:
- sb.append(WIDTH_CONSTANT);
- break;
- case COMPARTMENT_VISIBILITY:
- sb.append(COMPARTMENT_VISIBILITY_CONSTANT);
- break;
- case COMPARTMENT_NAME_VISIBILITY:
- sb.append(COMPARTMENT_NAME_VISIBILITY_CONSTANT);
- break;
- case LABEL_VISIBILITY:
- sb.append(LABEL_VISIBILITY_CONSTANT);
- break;
- case LOCATION_X:
- sb.append(LOCATION_X_CONSTANT);
- break;
- case LOCATION_Y:
- sb.append(LOCATION_Y_CONSTANT);
- break;
- default:
- break;
- }
-
- return sb.toString();
+ return PreferencesConstantsHelper.getConstant(elementName, preferenceType);
}
/**
@@ -331,7 +206,7 @@ public class PreferenceConstantHelper {
* @return the key for the element of a diagram
*/
public static String getElementConstant(String elementName, int preferenceType) {
- return DIAGRAM_ELEMENT + getConstant(elementName, preferenceType);
+ return PreferencesConstantsHelper.getElementConstant(elementName, preferenceType);
}
/**
@@ -345,8 +220,7 @@ public class PreferenceConstantHelper {
* @return the key for the element of a diagram
*/
public static String getCompartmentElementConstant(String elementName, String compartmentName, int preferenceType) {
- String tmp = getElementConstant(elementName, preferenceType);
- return tmp.replaceFirst("\\.", "_" + compartmentName + "."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return PreferencesConstantsHelper.getCompartmentElementConstant(elementName, compartmentName, preferenceType);
}
/**
@@ -361,8 +235,7 @@ public class PreferenceConstantHelper {
* @return the key for the element of a diagram
*/
public static String getLabelElementConstant(String elementName, String labelRole, int preferenceType) {
- String tmp = getElementConstant(elementName, preferenceType);
- return tmp.replaceFirst("\\.", "_" + labelRole + "."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return PreferencesConstantsHelper.getLabelElementConstant(elementName, labelRole, preferenceType);
}
/**
@@ -372,7 +245,7 @@ public class PreferenceConstantHelper {
* @return get the preference key at the papyrus editor level
*/
public static String getPapyrusEditorConstant(int preferenceType) {
- return getConstant(PAPYRUS_EDITOR_PREFERENCE_PREFIX, preferenceType);
+ return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
}
/**
@@ -384,7 +257,7 @@ public class PreferenceConstantHelper {
* @return the preference key at the diagram level
*/
public static String getDiagramConstant(String diagramKind, int preferenceType) {
- return DIAGRAM_PREFERENCE_PREFIX + getConstant(diagramKind, preferenceType);
+ return PreferencesConstantsHelper.getDiagramConstant(diagramKind, preferenceType);
}
}
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 @@
<?xml version="1.0" encoding="ASCII"?>
-<environment:Environment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:environment="http://www.eclipse.org/papyrus/properties/environment/0.9">
- <constraintTypes label="GMF Appearance Constraint" constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.AppearanceConstraint"/>
- <constraintTypes label="HasEditPolicy" constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.HasEditPolicy"/>
- <constraintTypes label="isGMFEditPart" constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.IsEditPartConstraint"/>
- <constraintTypes label="GMF Notation Constraint" constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.GMFNotationConstraint"/>
- <constraintTypes label="isDecorableElementConstraint" constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.IsDecorableElementConstraint"/>
- <modelElementFactories name="GMF Appearance Factory" factoryClass="org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.AppearanceModelElementFactory"/>
- <modelElementFactories name="GMF Custom Style" factoryClass="org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.CustomStyleModelElementFactory"/>
- <modelElementFactories name="GMF Notation Factory" factoryClass="org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.NotationModelElementFactory"/>
- <modelElementFactories name="Decorated Element Factory" factoryClass="org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.DecoratedModelElementFactory"/>
+<environment:Environment
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:environment="http://www.eclipse.org/papyrus/properties/environment/0.9">
+ <constraintTypes
+ label="GMF Appearance Constraint"
+ constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.AppearanceConstraint"/>
+ <constraintTypes
+ label="HasEditPolicy"
+ constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.HasEditPolicy"/>
+ <constraintTypes
+ label="isGMFEditPart"
+ constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.IsEditPartConstraint"/>
+ <constraintTypes
+ label="GMF Notation Constraint"
+ constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.GMFNotationConstraint"/>
+ <constraintTypes
+ label="isDecorableElementConstraint"
+ constraintClass="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.IsDecorableElementConstraint"/>
+ <modelElementFactories
+ name="GMF Appearance Factory"
+ factoryClass="org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.AppearanceModelElementFactory"/>
+ <modelElementFactories
+ name="GMF Custom Style"
+ factoryClass="org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.CustomStyleModelElementFactory"/>
+ <modelElementFactories
+ name="GMF Notation Factory"
+ factoryClass="org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.NotationModelElementFactory"/>
+ <modelElementFactories
+ name="Decorated Element Factory"
+ factoryClass="org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.DecoratedModelElementFactory"/>
+ <modelElementFactories
+ name="Rulers And Grid Element Factory"
+ factoryClass="org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.RulersAndGridModelElementFactory"/>
+ <widgetTypes
+ label="DiagramPreferencesDefaultButton"
+ widgetClass="DiagramPreferencesDefaultButton"
+ namespace="//@namespaces.0"/>
+ <namespaces
+ name="ppeg"
+ value="org.eclipse.papyrus.infra.gmfdiag.properties.widget"/>
</environment:Environment>
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 @@
<widget href="ui/SingleDecorableElement.xwt#/"/>
</sections>
</tabs>
+ <tabs label="Rulers And Grid" id="rulersAndGrid" category="org.eclipse.papyrus" afterTab="//@tabs.0" priority="75">
+ <sections name="Single RulersAndGrid" sectionFile="ui/SingleRulersAndGrid.xwt">
+ <widget href="ui/SingleRulersAndGrid.xwt#/"/>
+ </sections>
+ </tabs>
<views name="Single Diagram" sections="//@tabs.0/@sections.12" automaticContext="true" datacontexts="//@dataContexts.0/@elements.12">
<constraints xsi:type="constraints:SimpleConstraint" name="isSingleDiagram">
<constraintType href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi#//@constraintTypes.3"/>
@@ -387,6 +392,12 @@
<properties xsi:type="constraints:ValueProperty" name="nsUri" value="http://www.eclipse.org/gmf/runtime/1.0.2/notation"/>
</constraints>
</views>
+ <views name="Single RulersAndGrid" sections="//@tabs.1/@sections.0" datacontexts="//@dataContexts.2">
+ <constraints xsi:type="constraints:SimpleConstraint" name="isSingleDiagramEditorConstraint" overrideable="false">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.views.properties/model/Environment.xmi#//@constraintTypes.4"/>
+ <properties xsi:type="constraints:ValueProperty" name="className" value="org.eclipse.papyrus.infra.gmfdiag.properties.constraint.IsSingleDiagramEditorConstraint"/>
+ </constraints>
+ </views>
<views elementMultiplicity="-1" name="Multiple Edge" sections="//@tabs.0/@sections.29" automaticContext="true" datacontexts="//@dataContexts.0/@elements.0">
<constraints xsi:type="constraints:SimpleConstraint" name="isMultipleEdge">
<constraintType href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi#//@constraintTypes.3"/>
@@ -679,4 +690,20 @@
</elements>
<modelElementFactory href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi#//@modelElementFactories.3"/>
</dataContexts>
+ <dataContexts name="rulersAndGrid" label="rulersAndGrid">
+ <elements name="grid">
+ <properties name="grid.isDisplayingGrid" label="Show Grid" type="Boolean" description=""/>
+ <properties name="grid.isInFront" label="Grid In Front" type="Boolean" description=""/>
+ <properties name="grid.color" label="Color"/>
+ <properties name="grid.style" label="Style" type="Enumeration"/>
+ <properties name="grid.spacing" label="Grid Spacing"/>
+ <properties name="grid.isSnapToGrid" label="Snap To Grid"/>
+ <properties name="grid.isSnapToShapes" label="Snap To Shapes"/>
+ </elements>
+ <elements name="rulers">
+ <properties name="rulers.isDisplayingRulers" label="Show Ruler" type="Boolean"/>
+ <properties name="rulers.units" label="Ruler Units"/>
+ </elements>
+ <modelElementFactory href="ppe:/environment/org.eclipse.papyrus.infra.gmfdiag.properties/model/Environment.xmi#//@modelElementFactories.4"/>
+ </dataContexts>
</contexts:Context>
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 @@
<?xml version="1.0" encoding="UTF-8"?>
-<Composite
+<Composite xmlns="http://www.eclipse.org/xwt/presentation"
xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns:j="clr-namespace:java.lang" xmlns:x="http://www.eclipse.org/xwt"
- xmlns="http://www.eclipse.org/xwt/presentation">
+ xmlns:j="clr-namespace:java.lang" xmlns:x="http://www.eclipse.org/xwt">
<Composite.layout>
<ppel:PropertiesLayout></ppel:PropertiesLayout>
</Composite.layout>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns:ppeg="clr-namespace:org.eclipse.papyrus.infra.gmfdiag.properties.widget" xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets" xmlns:x="http://www.eclipse.org/xwt" xmlns:j="clr-namespace:java.lang" xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout" xmlns:gmf="clr-namespace:org.eclipse.papyrus.infra.gmfdiag.widgets.editors" xmlns="http://www.eclipse.org/xwt/presentation"><Composite.layout><GridLayout numColumns="1" makeColumnsEqualWidth="true"></GridLayout></Composite.layout><Composite><Composite.layout><FillLayout></FillLayout></Composite.layout><Group text="Display"><Group.layout><GridLayout makeColumnsEqualWidth="false" numColumns="2"></GridLayout></Group.layout><ppe:BooleanCheckbox input="{Binding}" property="rulersAndGrid:grid:grid.isDisplayingGrid"></ppe:BooleanCheckbox><ppe:BooleanCheckbox input="{Binding}" property="rulersAndGrid:rulers:rulers.isDisplayingRulers"></ppe:BooleanCheckbox><ppe:BooleanCheckbox input="{Binding}" property="rulersAndGrid:grid:grid.isInFront"></ppe:BooleanCheckbox></Group><Group text="Snap"><Group.layout><GridLayout numColumns="1"></GridLayout></Group.layout><ppe:BooleanCheckbox input="{Binding}" property="rulersAndGrid:grid:grid.isSnapToGrid"></ppe:BooleanCheckbox><ppe:BooleanCheckbox input="{Binding}" property="rulersAndGrid:grid:grid.isSnapToShapes"></ppe:BooleanCheckbox></Group><Group text="Measurement"><Group.layout><ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout></Group.layout><ppe:EnumCombo input="{Binding}" property="rulersAndGrid:rulers:rulers.units"></ppe:EnumCombo><ppe:FloatEditor input="{Binding}" property="rulersAndGrid:grid:grid.spacing"></ppe:FloatEditor></Group></Composite><Group text="Grid Line"><Group.layout><GridLayout makeColumnsEqualWidth="true" numColumns="1"></GridLayout></Group.layout><gmf:XWTAwareColorPicker input="{Binding}" property="rulersAndGrid:grid:grid.color"></gmf:XWTAwareColorPicker><ppe:EnumCombo input="{Binding}" property="rulersAndGrid:grid:grid.style"></ppe:EnumCombo></Group><ppeg:DiagramPreferencesDefaultButton input="{Binding}"></ppeg:DiagramPreferencesDefaultButton></Composite> \ 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;
+ }
+
+}

Back to the top