]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/color/ColorDialog.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.utils.ui / src / org / simantics / utils / ui / color / ColorDialog.java
index 195a16c65e472b1b4dd3f290c1827e37cee295f9..bf9a5b72f5ef00efb25ad2c93c1ee338fd228d3f 100644 (file)
@@ -1,84 +1,84 @@
-package org.simantics.utils.ui.color;\r
-\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.jface.layout.GridDataFactory;\r
-import org.eclipse.jface.layout.GridLayoutFactory;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.SelectionAdapter;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.graphics.Point;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.swt.widgets.Group;\r
-import org.eclipse.swt.widgets.Shell;\r
-\r
-public class ColorDialog extends Dialog{\r
-       protected ColorComposite colorComposite;\r
-       protected Color value;\r
-       \r
-       public ColorDialog(Shell parentShell) {\r
-               super(parentShell);     \r
-       }\r
-       \r
-       @Override\r
-       protected void configureShell(Shell newShell) {\r
-               super.configureShell(newShell);\r
-               newShell.setText("Color");\r
-       }\r
-\r
-       \r
-       public void setInitialValue(Color initialValue) {\r
-               this.value = new Color(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 composite = new Composite(parent, SWT.NONE);\r
-               GridLayoutFactory.fillDefaults().numColumns(1).margins(6, 0).applyTo(composite);\r
-               GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(composite);\r
-               colorComposite = new ColorComposite(composite, 0);\r
-        GridData childData = new GridData(GridData.FILL_BOTH);\r
-        colorComposite.setLayoutData(childData); \r
-        if (value != null)\r
-               colorComposite.setColor(value);\r
-        Group builtinGroup = new Group(composite, SWT.NONE);\r
-        builtinGroup.setText("System colors");\r
-        GridLayoutFactory.fillDefaults().numColumns(8).spacing(2, 2).margins(4, 4).applyTo(builtinGroup);\r
-        for (int i = SWT.COLOR_WHITE; i <= SWT.COLOR_DARK_GRAY; i++) {\r
-               org.eclipse.swt.graphics.Color c = Display.getCurrent().getSystemColor(i);\r
-               Color color = new Color(c.getRGB());\r
-               createColorButton(builtinGroup, color);\r
-        }\r
-        \r
-\r
-        return composite;\r
-       }\r
-       \r
-       protected Button createColorButton(Composite parent, Color color) {\r
-               Button button = new Button(parent, SWT.PUSH);\r
-       button.setImage(ColorIconCreator.createImage(color, 32, SWT.BORDER));\r
-       button.setData(color);\r
-       button.addSelectionListener(new SelectionAdapter() {\r
-               @Override\r
-               public void widgetSelected(SelectionEvent e) {\r
-                       colorComposite.setColor(color);\r
-               }\r
-               });\r
-       return button;\r
-       }\r
-\r
-       \r
-       public Color getColor() {\r
-               return colorComposite.getColor();\r
-       }\r
-       \r
-\r
-}\r
+package org.simantics.utils.ui.color;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+
+public class ColorDialog extends Dialog{
+       protected ColorComposite colorComposite;
+       protected Color value;
+       
+       public ColorDialog(Shell parentShell) {
+               super(parentShell);     
+       }
+       
+       @Override
+       protected void configureShell(Shell newShell) {
+               super.configureShell(newShell);
+               newShell.setText("Color");
+       }
+
+       
+       public void setInitialValue(Color initialValue) {
+               this.value = new Color(initialValue);
+       }
+       
+       @Override
+    protected Point getInitialSize() {
+        return new Point(400, 400);
+    }
+       
+       @Override
+       protected Control createDialogArea(Composite parent) {
+               Composite composite = new Composite(parent, SWT.NONE);
+               GridLayoutFactory.fillDefaults().numColumns(1).margins(6, 0).applyTo(composite);
+               GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(composite);
+               colorComposite = new ColorComposite(composite, 0);
+        GridData childData = new GridData(GridData.FILL_BOTH);
+        colorComposite.setLayoutData(childData); 
+        if (value != null)
+               colorComposite.setColor(value);
+        Group builtinGroup = new Group(composite, SWT.NONE);
+        builtinGroup.setText("System colors");
+        GridLayoutFactory.fillDefaults().numColumns(8).spacing(2, 2).margins(4, 4).applyTo(builtinGroup);
+        for (int i = SWT.COLOR_WHITE; i <= SWT.COLOR_DARK_GRAY; i++) {
+               org.eclipse.swt.graphics.Color c = Display.getCurrent().getSystemColor(i);
+               Color color = new Color(c.getRGB());
+               createColorButton(builtinGroup, color);
+        }
+        
+
+        return composite;
+       }
+       
+       protected Button createColorButton(Composite parent, Color color) {
+               Button button = new Button(parent, SWT.PUSH);
+       button.setImage(ColorIconCreator.createImage(color, 32, SWT.BORDER));
+       button.setData(color);
+       button.addSelectionListener(new SelectionAdapter() {
+               @Override
+               public void widgetSelected(SelectionEvent e) {
+                       colorComposite.setColor(color);
+               }
+               });
+       return button;
+       }
+
+       
+       public Color getColor() {
+               return colorComposite.getColor();
+       }
+       
+
+}