A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / preferences / ColorEditor.java
index 4cf783e..5a2cef9 100644 (file)
@@ -26,90 +26,95 @@ import org.eclipse.swt.widgets.Display;
  * A "button" of a certain color determined by the color picker.
  */
 public class ColorEditor {
-       
+
        private Point fExtent;
+
        private Image fImage;
+
        private RGB fColorValue;
+
        private Color fColor;
+
        private Button fButton;
-       
+
        public ColorEditor(Composite parent) {
-               
-               fButton= new Button(parent, SWT.PUSH);
-               fExtent= computeImageSize(parent);
-               fImage= new Image(parent.getDisplay(), fExtent.x, fExtent.y);
-               
-               GC gc= new GC(fImage);
+
+               fButton = new Button(parent, SWT.PUSH);
+               fExtent = computeImageSize(parent);
+               fImage = new Image(parent.getDisplay(), fExtent.x, fExtent.y);
+
+               GC gc = new GC(fImage);
                gc.setBackground(fButton.getBackground());
                gc.fillRectangle(0, 0, fExtent.x, fExtent.y);
                gc.dispose();
-               
+
                fButton.setImage(fImage);
                fButton.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent event) {
-                               ColorDialog colorDialog= new ColorDialog(fButton.getShell());
+                               ColorDialog colorDialog = new ColorDialog(fButton.getShell());
                                colorDialog.setRGB(fColorValue);
                                RGB newColor = colorDialog.open();
                                if (newColor != null) {
-                                       fColorValue= newColor;
+                                       fColorValue = newColor;
                                        updateColorImage();
                                }
                        }
                });
-               
+
                fButton.addDisposeListener(new DisposeListener() {
                        public void widgetDisposed(DisposeEvent event) {
-                               if (fImage != null)  {
+                               if (fImage != null) {
                                        fImage.dispose();
-                                       fImage= null;
+                                       fImage = null;
                                }
                                if (fColor != null) {
                                        fColor.dispose();
-                                       fColor= null;
+                                       fColor = null;
                                }
                        }
                });
        }
-       
+
        public RGB getColorValue() {
                return fColorValue;
        }
-       
+
        public void setColorValue(RGB rgb) {
-               fColorValue= rgb;
+               fColorValue = rgb;
                updateColorImage();
        }
-       
+
        public Button getButton() {
                return fButton;
        }
-       
+
        protected void updateColorImage() {
-               
-               Display display= fButton.getDisplay();
-               
-               GC gc= new GC(fImage);
+
+               Display display = fButton.getDisplay();
+
+               GC gc = new GC(fImage);
                gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
                gc.drawRectangle(0, 2, fExtent.x - 1, fExtent.y - 4);
-               
+
                if (fColor != null)
                        fColor.dispose();
-                       
-               fColor= new Color(display, fColorValue);
+
+               fColor = new Color(display, fColorValue);
                gc.setBackground(fColor);
                gc.fillRectangle(1, 3, fExtent.x - 2, fExtent.y - 5);
                gc.dispose();
-               
+
                fButton.setImage(fImage);
        }
-       
+
        protected Point computeImageSize(Control window) {
-               GC gc= new GC(window);
-               Font f= JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
+               GC gc = new GC(window);
+               Font f = JFaceResources.getFontRegistry().get(
+                               JFaceResources.DEFAULT_FONT);
                gc.setFont(f);
-               int height= gc.getFontMetrics().getHeight();
+               int height = gc.getFontMetrics().getHeight();
                gc.dispose();
-               Point p= new Point(height * 3 - 6, height);
+               Point p = new Point(height * 3 - 6, height);
                return p;
        }
 }
\ No newline at end of file