Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Fasani2018-04-12 13:26:18 +0000
committerLaurent Fasani2018-04-16 14:50:57 +0000
commit81e9eb074b0419424d6bbdb209a23be724aac44c (patch)
tree42b9e7bef6a00c5b0ba06e460dd1ca325efd9ac3
parent7c1e1e04ef43fbf4aa0d3d03b8ed011a8a98f3a4 (diff)
downloadorg.eclipse.sirius-81e9eb074b0419424d6bbdb209a23be724aac44c.tar.gz
org.eclipse.sirius-81e9eb074b0419424d6bbdb209a23be724aac44c.tar.xz
org.eclipse.sirius-81e9eb074b0419424d6bbdb209a23be724aac44c.zip
[461893] Fix font, line and fill color initialization in Appearance
Bug: 461893 Change-Id: Ic7e0008c7bf08b4b59c5a6e1aaaed325cf7ce2be Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/dialogs/ColorPalettePopup.java44
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramColorAndFontPropertySection.java6
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramConnectionAppearancePropertySection.java13
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramShapeColorAndFontPropertySection.java13
4 files changed, 34 insertions, 42 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/dialogs/ColorPalettePopup.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/dialogs/ColorPalettePopup.java
index 214be8ed95..811144dfec 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/dialogs/ColorPalettePopup.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/dialogs/ColorPalettePopup.java
@@ -87,20 +87,16 @@ public class ColorPalettePopup {
}
/**
- * Creates and returns a new SWT image for this image descriptor. The
- * returned image must be explicitly disposed using the image's dispose
- * call. The image will not be automatically garbage collected. In the
- * even of an error, a default image is returned if
- * <code>returnMissingImageOnError</code> is true, otherwise
+ * Creates and returns a new SWT image for this image descriptor. The returned image must be explicitly disposed
+ * using the image's dispose call. The image will not be automatically garbage collected. In the even of an
+ * error, a default image is returned if <code>returnMissingImageOnError</code> is true, otherwise
* <code>null</code> is returned.
* <p>
- * Note: Even if <code>returnMissingImageOnError</code> is true, it is
- * still possible for this method to return <code>null</code> in extreme
- * cases, for example if SWT runs out of image handles.
+ * Note: Even if <code>returnMissingImageOnError</code> is true, it is still possible for this method to return
+ * <code>null</code> in extreme cases, for example if SWT runs out of image handles.
* </p>
*
- * @return a new image or <code>null</code> if the image could not be
- * created
+ * @return a new image or <code>null</code> if the image could not be created
*
*/
// CHECKSTYLE:OFF
@@ -114,9 +110,8 @@ public class ColorPalettePopup {
}
/*
- * Try to create the supplied image. If there is an SWT Exception
- * try and create the default image if that was requested. Return
- * null if this fails.
+ * Try to create the supplied image. If there is an SWT Exception try and create the default image if that
+ * was requested. Return null if this fails.
*/
try {
@@ -202,8 +197,7 @@ public class ColorPalettePopup {
* Creates a PopupList above the specified shell.
*
* @param parent
- * a widget which will be the parent of the new instance (cannot
- * be null)
+ * a widget which will be the parent of the new instance (cannot be null)
* @param rowHeight
* the row height
*/
@@ -268,8 +262,10 @@ public class ColorPalettePopup {
ColorDialog dialog = new ColorDialog(Display.getCurrent().getActiveShell());
dialog.setRGB(FigureUtilities.integerToRGB(getPreviousColor()));
WindowUtil.centerDialog(dialog.getParent(), Display.getCurrent().getActiveShell());
- dialog.open();
- selectedColor = dialog.getRGB();
+ RGB returnedSelectedColor = dialog.open();
+ if (returnedSelectedColor != null) { // case of cancel
+ selectedColor = dialog.getRGB();
+ }
shell.dispose();
}
@@ -277,6 +273,7 @@ public class ColorPalettePopup {
// close dialog if user selects outside of the shell
shell.addListener(SWT.Deactivate, new Listener() {
+ @Override
public void handleEvent(Event e) {
shell.setVisible(false);
}
@@ -295,13 +292,11 @@ public class ColorPalettePopup {
}
/**
- * Launches the Popup List, waits for an item to be selected and then closes
- * PopupList.
+ * Launches the Popup List, waits for an item to be selected and then closes PopupList.
*
* @param location
- * the initial size and location of the PopupList; the dialog
- * will be positioned so that it does not run off the screen and
- * the largest number of items are visible
+ * the initial size and location of the PopupList; the dialog will be positioned so that it does not run
+ * off the screen and the largest number of items are visible
*
* @return the text of the selected item or null if no item is selected
*/
@@ -328,9 +323,8 @@ public class ColorPalettePopup {
}
/**
- * Gets the color the user selected. Could be null as the user may have
- * cancelled the gesture or they may have selected the default color button.
- * See {@link #useDefaultColor()}.
+ * Gets the color the user selected. Could be null as the user may have cancelled the gesture or they may have
+ * selected the default color button. See {@link #useDefaultColor()}.
*
* @return the selected color or null
*/
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramColorAndFontPropertySection.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramColorAndFontPropertySection.java
index ef49cdeb9d..ee4b0ff133 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramColorAndFontPropertySection.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramColorAndFontPropertySection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2011, 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
@@ -80,8 +80,7 @@ public class DiagramColorAndFontPropertySection extends DiagramColorsAndFontsPro
protected Button resetStylePropertiesToDefaultValuesButton;
/**
- * button to allow user to select an image in the workspace and set the
- * selected image as view background image.
+ * button to allow user to select an image in the workspace and set the selected image as view background image.
*/
protected Button setStyleToWorkspaceImageButton;
@@ -117,6 +116,7 @@ public class DiagramColorAndFontPropertySection extends DiagramColorsAndFontsPro
final ColorPalettePopup popup = new ColorPalettePopup(button.getParent().getShell(), IDialogConstants.BUTTON_BAR_HEIGHT);
final Rectangle r = button.getBounds();
final Point location = button.getParent().toDisplay(r.x, r.y);
+ popup.setPreviousColor(previousColor);
popup.open(new Point(location.x, location.y + r.height));
if (popup.getSelectedColor() == null && !popup.useDefaultColor()) {
return null;
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramConnectionAppearancePropertySection.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramConnectionAppearancePropertySection.java
index 7a2f6419c9..e27b999c70 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramConnectionAppearancePropertySection.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramConnectionAppearancePropertySection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2008, 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
@@ -75,8 +75,7 @@ public class DiagramConnectionAppearancePropertySection extends ConnectionAppear
protected Button resetStylePropertiesToDefaultValuesButton;
/**
- * button to allow user to select an image in the workspace and set the
- * selected image as view background image.
+ * button to allow user to select an image in the workspace and set the selected image as view background image.
*/
protected Button setStyleToWorkspaceImageButton;
@@ -110,6 +109,7 @@ public class DiagramConnectionAppearancePropertySection extends ConnectionAppear
// popup.setPreviousColor(previousColor);
final Rectangle r = button.getBounds();
final Point location = button.getParent().toDisplay(r.x, r.y);
+ popup.setPreviousColor(previousColor);
popup.open(new Point(location.x, location.y + r.height));
if (popup.getSelectedColor() == null && !popup.useDefaultColor()) {
return null;
@@ -300,8 +300,7 @@ public class DiagramConnectionAppearancePropertySection extends ConnectionAppear
}
/**
- * Overridden to display property of selection only if semantic element of
- * selection exists.
+ * Overridden to display property of selection only if semantic element of selection exists.
*
* {@inheritDoc}
*/
@@ -325,8 +324,8 @@ public class DiagramConnectionAppearancePropertySection extends ConnectionAppear
}
/**
- * Transform selection to have {@link DSemanticDecorator} instead of
- * {@link EditPart} or null if the semantic element (target) not exists.
+ * Transform selection to have {@link DSemanticDecorator} instead of {@link EditPart} or null if the semantic
+ * element (target) not exists.
*
* @param selection
* the currently selected object
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramShapeColorAndFontPropertySection.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramShapeColorAndFontPropertySection.java
index 3da1bd1dc7..8d74470c3e 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramShapeColorAndFontPropertySection.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/properties/DiagramShapeColorAndFontPropertySection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 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
@@ -95,8 +95,7 @@ public class DiagramShapeColorAndFontPropertySection extends ShapeColorsAndFonts
protected Button resetStylePropertiesToDefaultValuesButton;
/**
- * button to allow user to select an image in the workspace and set the
- * selected image as view background image.
+ * button to allow user to select an image in the workspace and set the selected image as view background image.
*/
protected Button setStyleToWorkspaceImageButton;
@@ -132,6 +131,7 @@ public class DiagramShapeColorAndFontPropertySection extends ShapeColorsAndFonts
final ColorPalettePopup popup = new ColorPalettePopup(button.getParent().getShell(), IDialogConstants.BUTTON_BAR_HEIGHT);
final Rectangle r = button.getBounds();
final Point location = button.getParent().toDisplay(r.x, r.y);
+ popup.setPreviousColor(previousColor);
popup.open(new Point(location.x, location.y + r.height));
if (popup.getSelectedColor() == null && !popup.useDefaultColor()) {
return null;
@@ -323,8 +323,7 @@ public class DiagramShapeColorAndFontPropertySection extends ShapeColorsAndFonts
}
/**
- * Overridden to display property of selection only if semantic element of
- * selection exists.
+ * Overridden to display property of selection only if semantic element of selection exists.
*
* {@inheritDoc}
*/
@@ -348,8 +347,8 @@ public class DiagramShapeColorAndFontPropertySection extends ShapeColorsAndFonts
}
/**
- * Transform selection to have {@link DSemanticDecorator} instead of
- * {@link EditPart} or null if the semantic element (target) not exists.
+ * Transform selection to have {@link DSemanticDecorator} instead of {@link EditPart} or null if the semantic
+ * element (target) not exists.
*
* @param selection
* the currently selected object

Back to the top