Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Fasani2018-09-11 14:27:20 +0000
committerLaurent Fasani2018-09-13 16:14:08 +0000
commit7276ce04499b3b795f85beb3013a93122d42cd7e (patch)
treee9b8a6134dfe775ecf5a0814521f3599a8e6dd47
parent317db527f7ea3bb2d9067518848c7ad4adbc3873 (diff)
downloadorg.eclipse.sirius-7276ce04499b3b795f85beb3013a93122d42cd7e.tar.gz
org.eclipse.sirius-7276ce04499b3b795f85beb3013a93122d42cd7e.tar.xz
org.eclipse.sirius-7276ce04499b3b795f85beb3013a93122d42cd7e.zip
[537134] Add ui preference to display vsm user fixed color in palette
* Add the PREF_DISPLAY_VSM_USER_FIXED_COLOR_IN_PALETTE preference which is true by default. * Complete Preferences/Sirius/Sirius Diagram/Appearance Bug: 537134 Change-Id: I6c79dcf6014eda599ac9513f508d7ce6b5b8470c Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/plugin.properties3
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/preferences/DiagramAppearancePreferencePage.java19
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/color/ColorManager.java25
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java3
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.html17
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile6
-rw-r--r--plugins/org.eclipse.sirius.ui/plugin.properties1
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/preferences/SiriusUIPreferencesKeys.java10
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/preference/GenericPreferencesInitializer.java4
9 files changed, 70 insertions, 18 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties
index dd0a24004a..1ff026cfb2 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties
+++ b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties
@@ -866,7 +866,8 @@ DiagramAppearancePreferencePage_displayHeaderLabel = Display header
DiagramAppearancePreferencePage_hideConnectorLabelIconsLabel = Hide label icons on connectors
DiagramAppearancePreferencePage_hideShapeLabelIconsLabel = Hide label icons on shapes
DiagramAppearancePreferencePage_labelIconsGroupText = Label icons (does not affect existing elements of opened diagrams)
-DiagramConnectionsPreferencePage_enableOverrideLabel = Enable user specifc default values. These setting apply to all diagrams (does not affect existing elements).
+DiagramAppearancePreferencePage_displayUserFixedColorsInPaletteLabel = Display viewpoint colors
+DiagramConnectionsPreferencePage_enableOverrideLabel = Enable user specific default values. These setting apply to all diagrams (does not affect existing elements).
DiagramConnectionsPreferencePage_showEdgeLabelLinkOnSelect = Show link between edge and its labels on selection
DiagramDialectEditorDialogFactory_forbiddenOperation = Forbidden operation
DiagramDialectUIServices_diagramDescription = \n . {0}: diagram.DDiagram | the diagram of the current potential edge.
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/preferences/DiagramAppearancePreferencePage.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/preferences/DiagramAppearancePreferencePage.java
index 666f656036..c310a74dde 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/preferences/DiagramAppearancePreferencePage.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/preferences/DiagramAppearancePreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2017 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES and others.
* 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
@@ -19,6 +19,8 @@ import org.eclipse.sirius.diagram.tools.api.preferences.SiriusDiagramPreferences
import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin;
import org.eclipse.sirius.diagram.ui.provider.Messages;
import org.eclipse.sirius.diagram.ui.tools.api.preferences.SiriusDiagramUiPreferencesKeys;
+import org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys;
+import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -39,6 +41,8 @@ public class DiagramAppearancePreferencePage extends AppearancePreferencePage {
private BooleanFieldEditor authorizeDecorationOverlap;
+ private BooleanFieldEditor displayUserFixedColor;
+
/**
* @was-generated
*/
@@ -55,6 +59,16 @@ public class DiagramAppearancePreferencePage extends AppearancePreferencePage {
createDecorationGroup(main);
}
+ @Override
+ protected void addFontAndColorFields(Composite composite) {
+ super.addFontAndColorFields(composite);
+
+ displayUserFixedColor = new BooleanFieldEditor(SiriusUIPreferencesKeys.PREF_DISPLAY_VSM_USER_FIXED_COLOR_IN_PALETTE.name(), Messages.DiagramAppearancePreferencePage_displayUserFixedColorsInPaletteLabel,
+ composite);
+
+ addField(displayUserFixedColor);
+ }
+
/**
* Create the font and color group for the "Label Icons" group of this preference page.
*
@@ -194,6 +208,9 @@ public class DiagramAppearancePreferencePage extends AppearancePreferencePage {
IPreferenceStore diagramCorePreferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, DiagramPlugin.ID);
displayHeader.setPreferenceStore(diagramCorePreferenceStore);
displayHeader.load();
+
+ displayUserFixedColor.setPreferenceStore(SiriusEditPlugin.getPlugin().getPreferenceStore());
+ displayUserFixedColor.load();
}
/**
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/color/ColorManager.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/color/ColorManager.java
index 4010d48099..474e12e699 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/color/ColorManager.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/color/ColorManager.java
@@ -20,12 +20,15 @@ import java.util.stream.Collectors;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.FigureUtilities;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.sirius.business.api.session.Session;
+import org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys;
import org.eclipse.sirius.ui.tools.api.color.VisualBindingManager;
import org.eclipse.sirius.viewpoint.RGBValues;
import org.eclipse.sirius.viewpoint.description.SystemColors;
import org.eclipse.sirius.viewpoint.description.UserColorsPalette;
import org.eclipse.sirius.viewpoint.description.UserFixedColor;
+import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
@@ -108,17 +111,19 @@ public class ColorManager {
*/
public Map<String, RGB> collectVsmAndDefaultColors(Session session) {
// Get user fixed colors
- // @formatter:on
// Get all the UserColorsPalette from every VSM resource of selected viewpoints
- List<UserColorsPalette> palettes = session.getSelectedViewpoints(true).stream().map(EObject::eContainer).map(org.eclipse.sirius.viewpoint.description.Group.class::cast)
- .flatMap(group -> group.getUserColorsPalettes().stream()).collect(Collectors.toList());
-
- Map<String, RGB> vsmColors = palettes.stream().flatMap(palette -> palette.getEntries().stream()).filter(UserFixedColor.class::isInstance).map(UserFixedColor.class::cast)
- .collect(Collectors.toMap(c -> c.getName(), c -> new RGB(c.getRed(), c.getGreen(), c.getBlue()), (rgb1, rgb2) -> {
- // in a case of collision of key we keep the first value
- return rgb1;
- }, () -> new LinkedHashMap<String, RGB>()));
- // @formatter:on
+ Map<String, RGB> vsmColors = new LinkedHashMap<>();
+ final IPreferenceStore preferenceStore = SiriusEditPlugin.getPlugin().getPreferenceStore();
+ if (preferenceStore != null && preferenceStore.getBoolean(SiriusUIPreferencesKeys.PREF_DISPLAY_VSM_USER_FIXED_COLOR_IN_PALETTE.name())) {
+ List<UserColorsPalette> palettes = session.getSelectedViewpoints(true).stream().map(EObject::eContainer).map(org.eclipse.sirius.viewpoint.description.Group.class::cast)
+ .flatMap(group -> group.getUserColorsPalettes().stream()).collect(Collectors.toList());
+
+ vsmColors = palettes.stream().flatMap(palette -> palette.getEntries().stream()).filter(UserFixedColor.class::isInstance).map(UserFixedColor.class::cast)
+ .collect(Collectors.toMap(c -> c.getName(), c -> new RGB(c.getRed(), c.getGreen(), c.getBlue()), (rgb1, rgb2) -> {
+ // in a case of collision of key we keep the first value
+ return rgb1;
+ }, () -> new LinkedHashMap<String, RGB>()));
+ }
// get system colors
Map<String, RGB> systemColors = VisualBindingManager.getDefault().getSystemPalette();
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java
index ae86a82fde..7be66665dc 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java
@@ -321,6 +321,9 @@ public final class Messages {
public static String DiagramAppearancePreferencePage_labelIconsGroupText;
@TranslatableMessage
+ public static String DiagramAppearancePreferencePage_displayUserFixedColorsInPaletteLabel;
+
+ @TranslatableMessage
public static String DiagramConnectionsPreferencePage_enableOverrideLabel;
@TranslatableMessage
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
index 1e5c7c2e6f..db40e56d79 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
@@ -87,6 +87,9 @@
<li><span class="label label-success">Added</span> On sequence diagrams, it is now possible to add vertical blank spaces on standard edition mode by dragging the mouse anywhere in the canvas with the Ctrl+Shift keys pressed. This
<a href="user/sequences/Sequence%20Diagrams.html#insert_vertical_blank_space">feature:</a> was here since version 6.0.0 but was only accessible through the ruler.
</li>
+ <li><span class="label label-success">Added</span> The preference
+ <code>org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys.PREF_DISPLAY_VSM_USER_FIXED_COLOR_IN_PALETTE</code> has been added and can be managed in Preferences/Sirius/Sirius Diagram/Appearance/Display viewpoint colors. It allows to display, in the color palette, the user fixed color(defined in the activated viewpoints) in addition to standard colors. The color palette is available in Appearance tab of the Properties view.
+ </li>
</ul>
<h3 id="SpecifierVisibleChanges">Specifier-Visible Changes</h3>
<ul>
@@ -147,6 +150,14 @@
<code>org.eclipse.sirius.business.internal.metamodel.description.validation.operations.ValidationRuleOperations</code> class.
</li>
</ul>
+ <h4 id="Changesinorg.eclipse.sirius.ui">Changes in
+ <code>org.eclipse.sirius.ui</code>
+ </h4>
+ <ul>
+ <li><span class="label label-success">Added</span>
+ <code>org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys.PREF_DISPLAY_VSM_USER_FIXED_COLOR_IN_PALETTE</code> has been added. Its default value is true. It allows to display, in the color palette, the user fixed color(defined in the activated viewpoints) in addition to standard colors. The color palette is available in Appearance tab of the Properties view.
+ </li>
+ </ul>
<h4 id="Changesinorg.eclipse.sirius.diagram.ui">Changes in
<code>org.eclipse.sirius.diagram.ui</code>
</h4>
@@ -517,7 +528,7 @@
<code>DDiagram</code>.
</li>
</ul>
- <h4 id="Changesinorg.eclipse.sirius.ui">Changes in
+ <h4 id="Changesinorg.eclipse.sirius.ui2">Changes in
<code>org.eclipse.sirius.ui</code>
</h4>
<ul>
@@ -618,7 +629,7 @@
<pre>SiriusEditPlugin.getPlugin().getPreferenceStore().setDefault(SiriusUIPreferencesKeys.PREF_SCALE_LEVEL_DIAGRAMS_ON_EXPORT.name(),0);
</pre>
- <h4 id="Changesinorg.eclipse.sirius.ui2">Changes in
+ <h4 id="Changesinorg.eclipse.sirius.ui3">Changes in
<code>org.eclipse.sirius.ui</code>
</h4>
<ul>
@@ -899,7 +910,7 @@
<a href="./specifier/general/Writing_Queries.html#service_methods">specifier documentation</a>, it is recommended to use List or Set instead of Collection in java services signature.
</li>
</ul>
- <h4 id="Changesinorg.eclipse.sirius.ui3">Changes in
+ <h4 id="Changesinorg.eclipse.sirius.ui4">Changes in
<code>org.eclipse.sirius.ui</code>
</h4>
<ul>
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
index 5a3f014df0..3e3d63c16c 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
@@ -14,6 +14,7 @@ h3. User-Visible Changes
* <span class="label label-info">Modified</span> The tool "Link Note", introduced in Sirius 6.0.0, has been renamed into "Representation Link".
* <span class="label label-success">Added</span> A new preference has been added in the Sirius preference panel. It allows Sirius to ask the user if he wants to save session resources after an automatic migration. If the new preference is ticked, the pop-up will only appear for session opening caused by a direct action of the user (i.e. opening a diagram or unfolding the resources in the model explorer).
* <span class="label label-success">Added</span> On sequence diagrams, it is now possible to add vertical blank spaces on standard edition mode by dragging the mouse anywhere in the canvas with the Ctrl+Shift keys pressed. This "feature:":user/sequences/Sequence%20Diagrams.html#insert_vertical_blank_space was here since version 6.0.0 but was only accessible through the ruler.
+* <span class="label label-success">Added</span> The preference @org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys.PREF_DISPLAY_VSM_USER_FIXED_COLOR_IN_PALETTE@ has been added and can be managed in Preferences/Sirius/Sirius Diagram/Appearance/Display viewpoint colors. It allows to display, in the color palette, the user fixed color(defined in the activated viewpoints) in addition to standard colors. The color palette is available in Appearance tab of the Properties view.
h3. Specifier-Visible Changes
@@ -40,6 +41,11 @@ h3. Developer-Visible Changes
* <span class="label label-success">Removed</span> _EOperations_ @checkRule@ and @getMessage@ of @ValidationRule@ _EClass_ have been removed from @viewpoint@ metamodel. These operations were deprecated and useless since we used method of @org.eclipse.sirius.business.internal.metamodel.description.validation.operations.ValidationRuleOperations@ class.
+h4. Changes in @org.eclipse.sirius.ui@
+
+* <span class="label label-success">Added</span> @org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys.PREF_DISPLAY_VSM_USER_FIXED_COLOR_IN_PALETTE@ has been added. Its default value is true. It allows to display, in the color palette, the user fixed color(defined in the activated viewpoints) in addition to standard colors. The color palette is available in Appearance tab of the Properties view.
+
+
h4. Changes in @org.eclipse.sirius.diagram.ui@
* <span class="label label-info">Modified</span> The interface @org.eclipse.sirius.diagram.ui.tools.api.figure.ViewNodeContainerFigureDesc@ has been moved to @org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures@ package.
diff --git a/plugins/org.eclipse.sirius.ui/plugin.properties b/plugins/org.eclipse.sirius.ui/plugin.properties
index 55fb54a9cb..36317f9ad9 100644
--- a/plugins/org.eclipse.sirius.ui/plugin.properties
+++ b/plugins/org.eclipse.sirius.ui/plugin.properties
@@ -432,6 +432,7 @@ repairActionLabel=Repair
_Pref_RefreshOnRepresentationOpening = true
_Pref_AutoRefresh = true
_Pref_EmptyAirdFragmentOnControl = false
+_Pref_DisplayUserVsmColorInPalette = true
_Pref_ReactToPermissionIssuesByDisplayingPopup = true
_Pref_DisplayPermissionIssuesThroughDialog = false
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/preferences/SiriusUIPreferencesKeys.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/preferences/SiriusUIPreferencesKeys.java
index 95bc421680..d29945f5c7 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/preferences/SiriusUIPreferencesKeys.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/preferences/SiriusUIPreferencesKeys.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 THALES GLOBAL SERVICES.
+ * Copyright (c) 2008, 2018 THALES GLOBAL SERVICES.
* 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
@@ -55,6 +55,12 @@ public enum SiriusUIPreferencesKeys {
* false</b>. When a a permission issue should be displayed graphically, specifies wether it should be displayed
* through the Dialect (e.g. a NotificationFigure inside a DDiagram) or through a standard pop-up.
*/
- PREF_DISPLAY_PERMISSION_ISSUES_THROUGH_DIALOG;
+ PREF_DISPLAY_PERMISSION_ISSUES_THROUGH_DIALOG,
+
+ /**
+ * Indicates if the UserFixedColors, defined in the VSM, are displayed in the color palette.</br>
+ * The color palette is used in appearance tab of properties view.
+ */
+ PREF_DISPLAY_VSM_USER_FIXED_COLOR_IN_PALETTE;
}
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/preference/GenericPreferencesInitializer.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/preference/GenericPreferencesInitializer.java
index 5b1847504d..ddbda9a588 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/preference/GenericPreferencesInitializer.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/preference/GenericPreferencesInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2014 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2009, 2018 THALES GLOBAL SERVICES and others.
* 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
@@ -47,6 +47,7 @@ public class GenericPreferencesInitializer extends AbstractPreferenceInitializer
uiPreferenceStore.setDefault(SiriusUIPreferencesKeys.PREF_SAVE_WHEN_NO_EDITOR.name(), getValue("_Pref_SaveWhenNoEditor")); //$NON-NLS-1$
uiPreferenceStore.setDefault(SiriusUIPreferencesKeys.PREF_REACT_TO_PERMISSION_ISSUES_BY_GRAPHICAL_DISPLAY.name(), getValue("_Pref_ReactToPermissionIssuesByDisplayingPopup")); //$NON-NLS-1$
uiPreferenceStore.setDefault(SiriusUIPreferencesKeys.PREF_DISPLAY_PERMISSION_ISSUES_THROUGH_DIALOG.name(), getValue("_Pref_DisplayPermissionIssuesThroughDialog")); //$NON-NLS-1$
+ uiPreferenceStore.setDefault(SiriusUIPreferencesKeys.PREF_DISPLAY_VSM_USER_FIXED_COLOR_IN_PALETTE.name(), getValue("_Pref_DisplayUserVsmColorInPalette")); //$NON-NLS-1$
final boolean autoRefreshDefValue = getValue("_Pref_AutoRefresh"); //$NON-NLS-1$
defaultCorePreferences.putBoolean(SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), autoRefreshDefValue);
@@ -55,6 +56,7 @@ public class GenericPreferencesInitializer extends AbstractPreferenceInitializer
final boolean emptyAirdFragOnControl = getValue("_Pref_EmptyAirdFragmentOnControl"); //$NON-NLS-1$
defaultCorePreferences.putBoolean(SiriusPreferencesKeys.PREF_EMPTY_AIRD_FRAGMENT_ON_CONTROL.name(), emptyAirdFragOnControl);
uiPreferenceStore.setDefault(SiriusPreferencesKeys.PREF_EMPTY_AIRD_FRAGMENT_ON_CONTROL.name(), emptyAirdFragOnControl);
+
}
private boolean getValue(final String key) {

Back to the top