-/*******************************************************************************\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.dialogs.Dialog;\r
-import org.eclipse.jface.dialogs.IDialogConstants;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.graphics.Point;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Shell;\r
-\r
-public class ColorGradientDialog extends Dialog {\r
-\r
- ColorGradientComposite composite;\r
- ColorGradient value;\r
- \r
- protected ColorGradientDialog(Shell parentShell, ColorGradient initialValue) {\r
- super(parentShell);\r
- setShellStyle( getShellStyle() | SWT.RESIZE ); \r
- value = new ColorGradient(initialValue);\r
- }\r
- \r
- @Override\r
- protected Point getInitialSize() {\r
- return new Point(400, 400);\r
- }\r
- \r
- @Override\r
- protected Control createDialogArea(Composite parent) {\r
- composite = new ColorGradientComposite(parent, 0);\r
- GridData childData = new GridData(GridData.FILL_BOTH);\r
- composite.setLayoutData(childData); \r
- composite.setGradient(value);\r
- return composite;\r
- }\r
- \r
- @Override\r
- protected void createButtonsForButtonBar(Composite parent) {\r
- // create OK and Cancel buttons by default\r
- createButton(parent, IDialogConstants.OK_ID,\r
- IDialogConstants.OK_LABEL, true);\r
- createButton(parent, IDialogConstants.CANCEL_ID,\r
- IDialogConstants.CANCEL_LABEL, false);\r
- }\r
- \r
- @Override\r
- protected void okPressed() {\r
- value = composite.getGradient();\r
- super.okPressed();\r
- }\r
- \r
- public ColorGradient getGradient() {\r
- return value;\r
- }\r
-\r
- public void setGradient(ColorGradient gradient) {\r
- this.value = gradient;\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.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+public class ColorGradientDialog extends Dialog {
+
+ ColorGradientComposite composite;
+ ColorGradient value;
+
+ protected ColorGradientDialog(Shell parentShell, ColorGradient initialValue) {
+ super(parentShell);
+ setShellStyle( getShellStyle() | SWT.RESIZE );
+ value = new ColorGradient(initialValue);
+ }
+
+ @Override
+ protected Point getInitialSize() {
+ return new Point(400, 400);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ composite = new ColorGradientComposite(parent, 0);
+ GridData childData = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(childData);
+ composite.setGradient(value);
+ return composite;
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ // create OK and Cancel buttons by default
+ createButton(parent, IDialogConstants.OK_ID,
+ IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID,
+ IDialogConstants.CANCEL_LABEL, false);
+ }
+
+ @Override
+ protected void okPressed() {
+ value = composite.getGradient();
+ super.okPressed();
+ }
+
+ public ColorGradient getGradient() {
+ return value;
+ }
+
+ public void setGradient(ColorGradient gradient) {
+ this.value = gradient;
+ }
+
+}