diff options
author | Christian W. Damus | 2014-03-26 16:51:25 +0000 |
---|---|---|
committer | Christian W. Damus | 2014-03-26 16:54:11 +0000 |
commit | 00d1c880696cd9b9b88655d064c1aba3cf5b0502 (patch) | |
tree | 5a97c4df64c982c9d3c453d3a458b6de6859f8a3 | |
parent | daf1ce4231cd258c03c6922978d2db80707cfae2 (diff) | |
download | org.eclipse.papyrus-00d1c880696cd9b9b88655d064c1aba3cf5b0502.tar.gz org.eclipse.papyrus-00d1c880696cd9b9b88655d064c1aba3cf5b0502.tar.xz org.eclipse.papyrus-00d1c880696cd9b9b88655d064c1aba3cf5b0502.zip |
392301: Colors are leaked
https://bugs.eclipse.org/bugs/show_bug.cgi?id=392301
Fix leaked SWT colours by caching frequently-used colours (especially for gradients) in GMF's ColorRegistry, which in GMF also is used for gradient painting.
17 files changed, 157 insertions, 89 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/src/org/eclipse/papyrus/infra/gmfdiag/css/configuration/handler/AbstractStyleDialog.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/src/org/eclipse/papyrus/infra/gmfdiag/css/configuration/handler/AbstractStyleDialog.java index d377eadece7..1129c431c78 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/src/org/eclipse/papyrus/infra/gmfdiag/css/configuration/handler/AbstractStyleDialog.java +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.configuration/src/org/eclipse/papyrus/infra/gmfdiag/css/configuration/handler/AbstractStyleDialog.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@ *
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 392301
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.configuration.handler;
@@ -17,7 +19,7 @@ import java.util.Map; import java.util.Map.Entry;
import org.eclipse.e4.ui.css.core.css2.CSS2ColorHelper;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TrayDialog;
@@ -396,7 +398,7 @@ public abstract class AbstractStyleDialog extends TrayDialog { protected Color getColor(HexColor color) {
RGBColor rgbColor = CSS2ColorHelper.getRGBColor("#" + color.getValue());
int intColor = ColorToGMFConverter.getIntColor(rgbColor);
- return FigureUtilities.integerToColor(intColor);
+ return ColorRegistry.getInstance().getColor(intColor);
}
public String getCSSClass() {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.debug/src/org/eclipse/papyrus/infra/gmfdiag/css/debug/views/CSSDebugView.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.debug/src/org/eclipse/papyrus/infra/gmfdiag/css/debug/views/CSSDebugView.java index aa01aa82e08..54a9b96a181 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.debug/src/org/eclipse/papyrus/infra/gmfdiag/css/debug/views/CSSDebugView.java +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.debug/src/org/eclipse/papyrus/infra/gmfdiag/css/debug/views/CSSDebugView.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@ *
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 392301
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.debug.views;
@@ -24,6 +26,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
@@ -463,7 +466,7 @@ public class CSSDebugView extends ViewPart implements ISelectionListener, ISelec String text = getValueAsText(feature, value);
cell.setText(text);
if(feature.getName().endsWith("Color") && value instanceof Integer) {
- Color color = FigureUtilities.integerToColor((Integer)value);
+ Color color = ColorRegistry.getInstance().getColor((Integer)value);
cell.setBackground(color);
int lightness = getLightness(color);
//Use a white font when the color is dark
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/ColorToGMFConverter.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/ColorToGMFConverter.java index e6ee0c28f29..eaa9e63784d 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/ColorToGMFConverter.java +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/ColorToGMFConverter.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@ *
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 392301
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.converters;
@@ -68,11 +70,11 @@ public class ColorToGMFConverter extends AbstractCSSValueConverter { * A GMF-compatible integer color
*/
public static int getIntColor(RGBColor color) {
- int red = getInt(color.getRed());
- int green = getInt(color.getGreen());
- int blue = getInt(color.getBlue());
+ int red = getInt(color.getRed()) & 0xFF;
+ int green = getInt(color.getGreen()) & 0xFF;
+ int blue = getInt(color.getBlue()) & 0xFF;
- return blue * 256 * 256 + green * 256 + red;
+ return (blue << 16) | (green << 8) | red;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/figures/InterruptibleActivityRegionFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/figures/InterruptibleActivityRegionFigure.java index 428b890d3f1..5ecbe4b445e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/figures/InterruptibleActivityRegionFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/figures/InterruptibleActivityRegionFigure.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
+ * Copyright (c) 2010, 2014 Atos Origin, CEA, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@ *
* Contributors:
* Atos Origin - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 392301
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.activity.figures;
@@ -17,7 +18,7 @@ import org.eclipse.draw2d.Graphics; import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry;
import org.eclipse.gmf.runtime.notation.GradientStyle;
import org.eclipse.papyrus.uml.diagram.common.draw2d.RoundedRectangleDashedBorder;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
@@ -73,8 +74,8 @@ public class InterruptibleActivityRegionFigure extends PapyrusNodeFigure impleme if(isUsingGradient()) {
applyTransparency(graphics);
boolean isVertical = (getGradientStyle() == GradientStyle.VERTICAL) ? true : false;
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1()));
- graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2()));
+ graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1()));
+ graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2()));
graphics.fillGradient(rectangle, isVertical);
} else {
graphics.setBackgroundColor(getBackgroundColor());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/DiamondNode.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/DiamondNode.java index e88101e9b08..43a51c29828 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/DiamondNode.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/DiamondNode.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010 CEA LIST. + * Copyright (c) 2010, 2014 CEA LIST and others. * * * All rights reserved. This program and the accompanying materials @@ -9,6 +9,8 @@ * * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 392301 + * */ package org.eclipse.papyrus.uml.diagram.common.figure.node; @@ -19,7 +21,7 @@ import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Insets; import org.eclipse.draw2d.geometry.PointList; import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; +import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; @@ -59,8 +61,8 @@ public class DiamondNode extends PapyrusNodeFigure implements IPapyrusNodeUMLEle ptList.addPoint(r.x, r.y + (r.height / 2)); if (isUsingGradient()) { - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2())); - // graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); + // graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); } else { graphics.setBackgroundColor(getBackgroundColor()); // graphics.setForegroundColor(getBackgroundColor); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/FlowFinalNode.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/FlowFinalNode.java index 717e17e3e47..38caf89fc27 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/FlowFinalNode.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/FlowFinalNode.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010 CEA LIST. + * Copyright (c) 2010, 2014 CEA LIST and others. * * * All rights reserved. This program and the accompanying materials @@ -9,6 +9,8 @@ * * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 392301 + * */ package org.eclipse.papyrus.uml.diagram.common.figure.node; @@ -18,7 +20,7 @@ import org.eclipse.draw2d.Label; import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Insets; import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; +import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; @@ -48,8 +50,8 @@ public class FlowFinalNode extends PapyrusNodeFigure implements IPapyrusNodeUMLE graphics.setForegroundColor(getForegroundColor()); Rectangle r = getBounds().getCopy().crop(new Insets(0, 0, 1, 1)); if(isUsingGradient()) { - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2())); - // graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); + // graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); } else { graphics.setBackgroundColor(getBackgroundColor()); // graphics.setForegroundColor(getForegroundColor()); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/ForkNode.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/ForkNode.java index 06bdec50f9f..aacba2720fe 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/ForkNode.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/ForkNode.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010 CEA LIST. + * Copyright (c) 2010, 2014 CEA LIST and others. * * * All rights reserved. This program and the accompanying materials @@ -9,6 +9,7 @@ * * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 392301 */ package org.eclipse.papyrus.uml.diagram.common.figure.node; @@ -18,7 +19,7 @@ import org.eclipse.draw2d.Label; import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Insets; import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; +import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; @@ -47,8 +48,8 @@ public class ForkNode extends PapyrusNodeFigure implements IPapyrusNodeUMLElemen public void paintFigure(Graphics graphics) { Rectangle r = getBounds().getCopy().crop(new Insets(0,0,1,1)); if(isUsingGradient()) { - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2())); - // graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); + // graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); } else { graphics.setBackgroundColor(getBackgroundColor()); // graphics.setForegroundColor(getForegroundColor()); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PackageFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PackageFigure.java index 2c91da0a3cd..af86025bcf9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PackageFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PackageFigure.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 CEA List. + * Copyright (c) 2006, 2014 CEA List 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 @@ -7,6 +7,8 @@ * * Contributors: * CEA List - initial API and implementation + * Christian W. Damus (CEA) - bug 392301 + * *******************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.figure.node; @@ -20,7 +22,7 @@ import org.eclipse.draw2d.RectangleFigure; import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.gmf.runtime.diagram.ui.figures.ShapeCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; +import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry; import org.eclipse.gmf.runtime.notation.GradientStyle; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; @@ -224,11 +226,11 @@ public class PackageFigure extends NodeNamedElementFigure { protected void paintBackground(Graphics graphics, Rectangle rectangle) { if(isUsingGradient()) { applyTransparency(graphics); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); graphics.fillRectangle(getHeader()); boolean isVertical = (getGradientStyle() == GradientStyle.VERTICAL) ? true : false; - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); - graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); + graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); graphics.fillGradient(getPackageableElementFigure().getBounds(), isVertical); } else { graphics.setBackgroundColor(getBackgroundColor()); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusNodeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusNodeFigure.java index 69727c0233b..572b6c2861c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusNodeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusNodeFigure.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2009 CEA LIST. + * Copyright (c) 2009, 2014 CEA LIST, Atos Origin, and others. * * * All rights reserved. This program and the accompanying materials @@ -10,6 +10,7 @@ * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation * Atos Origin - Enable extending with a composite figure, by adding overrideable methods. + * Christian W. Damus (CEA) - bug 392301 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.figure.node; @@ -20,7 +21,7 @@ import org.eclipse.draw2d.Graphics; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.LineBorder; import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; +import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry; import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; import org.eclipse.gmf.runtime.notation.GradientStyle; import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; @@ -202,8 +203,8 @@ public class PapyrusNodeFigure extends NodeFigure implements IPapyrusNodeFigure if(isUsingGradient()) { applyTransparency(graphics); boolean isVertical = (getGradientStyle() == GradientStyle.VERTICAL) ? true : false; - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); - graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); + graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); graphics.fillGradient(rectangle, isVertical); } else { graphics.setBackgroundColor(getBackgroundColor()); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusReceiveNodeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusReceiveNodeFigure.java index 74e0420fa5c..5595db9e862 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusReceiveNodeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusReceiveNodeFigure.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010 CEA LIST. + * Copyright (c) 2010, 2014 CEA LIST and others. * * * All rights reserved. This program and the accompanying materials @@ -9,6 +9,7 @@ * * Contributors: * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 392301 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.figure.node; @@ -18,8 +19,8 @@ import org.eclipse.draw2d.Border; import org.eclipse.draw2d.Graphics; import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; import org.eclipse.gmf.runtime.draw2d.ui.figures.RoundedRectangleBorder; +import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry; import org.eclipse.gmf.runtime.notation.GradientStyle; import org.eclipse.swt.graphics.Color; /** @@ -76,32 +77,32 @@ public class PapyrusReceiveNodeFigure extends NodeNamedElementFigure { if(isVertical && rectangle.height>((3*corner)/2)){ Rectangle rect1= new Rectangle(rectangle.getLocation(),new Dimension(rectangle.width,corner)); Rectangle rect2= new Rectangle(rectangle.x,rectangle.y+rectangle.height-corner,rectangle.width,corner);; - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); graphics.fillRoundRectangle(rect1,corner,corner); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); graphics.fillRoundRectangle(rect2,corner,corner); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); - graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); + graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); Rectangle rect= new Rectangle(rectangle.x,rectangle.y+corner/2,rectangle.width,rectangle.height-corner); graphics.fillGradient(rect, true); } else if(!isVertical && rectangle.width>((3*corner)/2)){ Rectangle rect1= new Rectangle(rectangle.getLocation(),new Dimension(corner,rectangle.height)); Rectangle rect2= new Rectangle(rectangle.x+rectangle.width-corner,rectangle.y,corner,rectangle.height); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); graphics.fillRoundRectangle(rect1,corner,corner); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); graphics.fillRoundRectangle(rect2,corner,corner); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); - graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); + graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); Rectangle rect= new Rectangle(rectangle.x+corner/2, rectangle.y,rectangle.width-corner,rectangle.height); graphics.fillGradient(rect, false); } else{ - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); - graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); + graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); graphics.fillRoundRectangle(rectangle,corner,corner); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusRoundedNodeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusRoundedNodeFigure.java index b356bd0edae..c7aef566667 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusRoundedNodeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusRoundedNodeFigure.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010 CEA LIST. + * Copyright (c) 2010, 2014 CEA LIST and others. * * * All rights reserved. This program and the accompanying materials @@ -9,6 +9,7 @@ * * Contributors: * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 392301 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.figure.node; @@ -18,8 +19,8 @@ import org.eclipse.draw2d.Border; import org.eclipse.draw2d.Graphics; import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; import org.eclipse.gmf.runtime.draw2d.ui.figures.RoundedRectangleBorder; +import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry; import org.eclipse.gmf.runtime.notation.GradientStyle; import org.eclipse.swt.graphics.Color; /** @@ -76,32 +77,32 @@ public class PapyrusRoundedNodeFigure extends NodeNamedElementFigure { if(isVertical && rectangle.height>((3*corner)/2)){ Rectangle rect1= new Rectangle(rectangle.getLocation(),new Dimension(rectangle.width,corner)); Rectangle rect2= new Rectangle(rectangle.x,rectangle.y+rectangle.height-corner,rectangle.width,corner);; - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); graphics.fillRoundRectangle(rect1,corner,corner); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); graphics.fillRoundRectangle(rect2,corner,corner); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); - graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); + graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); Rectangle rect= new Rectangle(rectangle.x,rectangle.y+corner/2,rectangle.width,rectangle.height-corner); graphics.fillGradient(rect, true); } else if(!isVertical && rectangle.width>((3*corner)/2)){ Rectangle rect1= new Rectangle(rectangle.getLocation(),new Dimension(corner,rectangle.height)); Rectangle rect2= new Rectangle(rectangle.x+rectangle.width-corner,rectangle.y,corner,rectangle.height); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); graphics.fillRoundRectangle(rect1,corner,corner); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); graphics.fillRoundRectangle(rect2,corner,corner); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); - graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); + graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); Rectangle rect= new Rectangle(rectangle.x+corner/2, rectangle.y,rectangle.width-corner,rectangle.height); graphics.fillGradient(rect, false); } else{ - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); - graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); + graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); graphics.fillRoundRectangle(rectangle,corner,corner); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusSendNodeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusSendNodeFigure.java index 95b299644a8..1483535b114 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusSendNodeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/PapyrusSendNodeFigure.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010 CEA LIST. + * Copyright (c) 2010, 2014 CEA LIST and others. * * * All rights reserved. This program and the accompanying materials @@ -9,6 +9,7 @@ * * Contributors: * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 392301 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.figure.node; @@ -19,7 +20,7 @@ import org.eclipse.draw2d.Graphics; import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.PointList; import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; +import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry; import org.eclipse.swt.graphics.Color; /** * this class is used to display a sendNodeFigure, the gradient can be only @@ -77,13 +78,13 @@ public class PapyrusSendNodeFigure extends NodeNamedElementFigure { ptList.addPoint(getBounds().getBottomLeft()); if(isUsingGradient()) { applyTransparency(graphics); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); graphics.setForegroundColor(getForegroundColor()); graphics.fillPolygon(ptList); Rectangle rect1= new Rectangle(rectangle.getLocation(),new Dimension(getBounds().width-widthArrow,rectangle.height)); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); - graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); + graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); graphics.fillGradient(rect1, false); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/PseudostateChoiceFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/PseudostateChoiceFigure.java index b663cb24648..ca54c7bd905 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/PseudostateChoiceFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/PseudostateChoiceFigure.java @@ -1,3 +1,17 @@ +/*****************************************************************************
+ * Copyright (c) 2011, 2014 CEA LIST 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 392301
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.uml.diagram.statemachine.custom.figures;
import org.eclipse.draw2d.Border;
@@ -7,7 +21,7 @@ import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
import org.eclipse.swt.graphics.Color;
@@ -60,8 +74,8 @@ public class PseudostateChoiceFigure extends PapyrusNodeFigure implements IPapyr pl.addPoint(r.getLeft());
if(isUsingGradient()) {
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- //graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2()));
+ graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor2()));
+ //graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2()));
} else {
graphics.setBackgroundColor(getBackgroundColor());
//graphics.setForegroundColor(getBackgroundColor);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/PseudostateJoinForkFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/PseudostateJoinForkFigure.java index 74d876e6d91..dd5a3d4d7da 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/PseudostateJoinForkFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/PseudostateJoinForkFigure.java @@ -1,3 +1,17 @@ +/*****************************************************************************
+ * Copyright (c) 2011, 2014 CEA LIST 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 392301
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.uml.diagram.statemachine.custom.figures;
import org.eclipse.draw2d.Border;
@@ -6,7 +20,7 @@ import org.eclipse.draw2d.Label; import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
import org.eclipse.swt.graphics.Color;
@@ -42,8 +56,8 @@ public class PseudostateJoinForkFigure extends PapyrusNodeFigure implements IPap public void paintFigure(Graphics graphics) {
Rectangle r = getBounds().getCopy().crop(new Insets(0, 0, 1, 1));
if(isUsingGradient()) {
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- //graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2()));
+ graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor2()));
+ //graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2()));
} else {
graphics.setBackgroundColor(getBackgroundColor());
//graphics.setForegroundColor(getForegroundColor());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/PseudostateTerminateFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/PseudostateTerminateFigure.java index 709fc915050..5ab8ec9e377 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/PseudostateTerminateFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/PseudostateTerminateFigure.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 CEA List. + * Copyright (c) 2006, 2014 CEA List 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 @@ -7,6 +7,8 @@ * * Contributors: * CEA List - initial API and implementation + * Christian W. Damus (CEA) - bug 392301 + * *******************************************************************************/ package org.eclipse.papyrus.uml.diagram.statemachine.custom.figures; @@ -16,7 +18,7 @@ import org.eclipse.draw2d.Label; import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Insets; import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; +import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry; import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure; import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure; import org.eclipse.swt.graphics.Color; @@ -58,8 +60,8 @@ public class PseudostateTerminateFigure extends PapyrusNodeFigure implements IPa graphics.setForegroundColor(getForegroundColor()); Rectangle r = getBounds().getCopy().crop(new Insets(0, 0, 1, 1)); if(isUsingGradient()) { - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2())); - //graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); + //graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); } else { graphics.setBackgroundColor(getBackgroundColor()); //graphics.setForegroundColor(getForegroundColor()); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/StateMachineFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/StateMachineFigure.java index 2ac3d17e8fd..69c9b7fadb1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/StateMachineFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/StateMachineFigure.java @@ -1,3 +1,17 @@ +/***************************************************************************** + * Copyright (c) 2011, 2014 CEA LIST 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * CEA LIST - Initial API and implementation + * Christian W. Damus (CEA) - bug 392301 + * + *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.statemachine.custom.figures; import java.util.ArrayList; @@ -7,7 +21,7 @@ import org.eclipse.draw2d.Graphics; import org.eclipse.draw2d.RectangleFigure; import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; +import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry; import org.eclipse.gmf.runtime.notation.GradientStyle; import org.eclipse.papyrus.uml.diagram.common.figure.node.AutomaticCompartmentLayoutManager; import org.eclipse.papyrus.uml.diagram.common.figure.node.CompartmentFigure; @@ -68,32 +82,32 @@ public class StateMachineFigure extends CompartmentFigure { if(isVertical && rectangle.height > ((3 * arcwidth) / 2)) { Rectangle rect1 = new Rectangle(rectangle.getLocation(), new Dimension(rectangle.width, arcwidth)); Rectangle rect2 = new Rectangle(rectangle.x, rectangle.y + rectangle.height - arcwidth, rectangle.width, arcwidth);; - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); graphics.fillRoundRectangle(rect1, arcwidth, arcwidth); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); graphics.fillRoundRectangle(rect2, arcwidth, arcwidth); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); - graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); + graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); Rectangle rect = new Rectangle(rectangle.x, rectangle.y + arcwidth / 2, rectangle.width, rectangle.height - arcwidth); graphics.fillGradient(rect, true); } else if(!isVertical && rectangle.width > ((3 * arcwidth) / 2)) { Rectangle rect1 = new Rectangle(rectangle.getLocation(), new Dimension(arcwidth, rectangle.height)); Rectangle rect2 = new Rectangle(rectangle.x + rectangle.width - arcwidth, rectangle.y, arcwidth, rectangle.height); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); graphics.fillRoundRectangle(rect1, arcwidth, arcwidth); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); graphics.fillRoundRectangle(rect2, arcwidth, arcwidth); - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); - graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); + graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); Rectangle rect = new Rectangle(rectangle.x + arcwidth / 2, rectangle.y, rectangle.width - arcwidth, rectangle.height); graphics.fillGradient(rect, false); } else { - graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1())); - graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2())); + graphics.setBackgroundColor(ColorRegistry.getInstance().getColor(getGradientColor1())); + graphics.setForegroundColor(ColorRegistry.getInstance().getColor(getGradientColor2())); graphics.fillRoundRectangle(rectangle, arcwidth, arcwidth); } } else { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java index d0e6c45e69d..6505194f22a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/figures/CompactStateFigure.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -7,14 +7,19 @@ * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * Contributors:
+ *
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 392301
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.timing.custom.figures;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.draw2d.ui.graphics.ColorRegistry;
import org.eclipse.gmf.runtime.notation.GradientStyle;
import org.eclipse.gmf.tooling.runtime.draw2d.CenterLayout;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure;
@@ -86,9 +91,9 @@ public class CompactStateFigure extends PapyrusNodeFigure implements IPapyrusUML final int widthScaled = (int)(this.bounds.width * scale);
final int heightScaled = (int)(height * scale);
if(getGradientStyle() == GradientStyle.VERTICAL) {
- pattern = new Pattern(Display.getCurrent(), xScaled, yScaled, xScaled, yScaled + heightScaled, FigureUtilities.integerToColor(Integer.valueOf(getGradientColor2())), FigureUtilities.integerToColor(Integer.valueOf(getGradientColor1())));
+ pattern = new Pattern(Display.getCurrent(), xScaled, yScaled, xScaled, yScaled + heightScaled, ColorRegistry.getInstance().getColor(getGradientColor2()), ColorRegistry.getInstance().getColor(getGradientColor1()));
} else {
- pattern = new Pattern(Display.getCurrent(), xScaled, yScaled, xScaled + widthScaled, this.bounds.y, FigureUtilities.integerToColor(Integer.valueOf(getGradientColor2())), FigureUtilities.integerToColor(Integer.valueOf(getGradientColor1())));
+ pattern = new Pattern(Display.getCurrent(), xScaled, yScaled, xScaled + widthScaled, this.bounds.y, ColorRegistry.getInstance().getColor(getGradientColor2()), ColorRegistry.getInstance().getColor(getGradientColor1()));
}
g.setBackgroundPattern(pattern);
g.fillPolygon(polygon);
|