-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-/*\r
- *\r
- * @author Toni Kalajainen\r
- */\r
-package org.simantics.utils.ui.color;\r
-\r
-import org.eclipse.jface.viewers.DialogCellEditor;\r
-import org.eclipse.jface.window.Window;\r
-import org.eclipse.swt.graphics.Color;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-\r
-public class ColorGradientCellEditor extends DialogCellEditor {\r
-\r
- public ColorGradientCellEditor(Composite parent) {\r
- super(parent);\r
- }\r
-\r
- /**\r
- * The composite showing the gradient\r
- */\r
- private ColorGradientCanvas canvas;\r
-\r
- /* (non-Javadoc)\r
- * Method declared on DialogCellEditor.\r
- */\r
- protected Control createContents(Composite cell) {\r
- Color bg = cell.getBackground();\r
- canvas = new ColorGradientCanvas(cell, getStyle());\r
- canvas.setBackground(bg);\r
- return canvas;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * Method declared on DialogCellEditor.\r
- */\r
- protected Object openDialogBox(Control cellEditorWindow) {\r
- ColorGradient value = (ColorGradient)getValue();\r
- ColorGradientDialog dialog = new ColorGradientDialog(cellEditorWindow.getShell(), value);\r
- if (dialog.open() == Window.OK)\r
- return dialog.getGradient();\r
- return value;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * Method declared on DialogCellEditor.\r
- */\r
- protected void updateContents(Object value) {\r
- ColorGradient cg = (ColorGradient) value;\r
- canvas.setGradient(cg);\r
- } \r
- \r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * 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:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+/*
+ *
+ * @author Toni Kalajainen
+ */
+package org.simantics.utils.ui.color;
+
+import org.eclipse.jface.viewers.DialogCellEditor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public class ColorGradientCellEditor extends DialogCellEditor {
+
+ public ColorGradientCellEditor(Composite parent) {
+ super(parent);
+ }
+
+ /**
+ * The composite showing the gradient
+ */
+ private ColorGradientCanvas canvas;
+
+ /* (non-Javadoc)
+ * Method declared on DialogCellEditor.
+ */
+ protected Control createContents(Composite cell) {
+ Color bg = cell.getBackground();
+ canvas = new ColorGradientCanvas(cell, getStyle());
+ canvas.setBackground(bg);
+ return canvas;
+ }
+
+ /* (non-Javadoc)
+ * Method declared on DialogCellEditor.
+ */
+ protected Object openDialogBox(Control cellEditorWindow) {
+ ColorGradient value = (ColorGradient)getValue();
+ ColorGradientDialog dialog = new ColorGradientDialog(cellEditorWindow.getShell(), value);
+ if (dialog.open() == Window.OK)
+ return dialog.getGradient();
+ return value;
+ }
+
+ /* (non-Javadoc)
+ * Method declared on DialogCellEditor.
+ */
+ protected void updateContents(Object value) {
+ ColorGradient cg = (ColorGradient) value;
+ canvas.setGradient(cg);
+ }
+
+
+}