A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / dialogs / SelectionStatusDialog.java
index 2e27822..eb6514f 100644 (file)
@@ -13,66 +13,71 @@ import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.dialogs.SelectionDialog;
 
-
 /**
  * An abstract base class for dialogs with a status bar and ok/cancel buttons.
- * The status message must be passed over as StatusInfo object and can be
- * an error, warning or ok. The OK button is enabled or disabled depending
- * on the status.
- */ 
-public abstract class SelectionStatusDialog extends SelectionDialog  {
-       
+ * The status message must be passed over as StatusInfo object and can be an
+ * error, warning or ok. The OK button is enabled or disabled depending on the
+ * status.
+ */
+public abstract class SelectionStatusDialog extends SelectionDialog {
+
        private MessageLine fStatusLine;
+
        private IStatus fLastStatus;
+
        private Image fImage;
-       private boolean fStatusLineAboveButtons= false; 
+
+       private boolean fStatusLineAboveButtons = false;
 
        /**
         * Creates an instance of a <code>SelectionStatusDialog</code>.
-        */     
+        */
        public SelectionStatusDialog(Shell parent) {
                super(parent);
        }
-       
+
        /**
         * Controls whether status line appears to the left of the buttons (default)
         * or above them.
-        *
-        * @param aboveButtons if <code>true</code> status line is placed above buttons; if
-        *      <code>false</code> to the right
+        * 
+        * @param aboveButtons
+        *            if <code>true</code> status line is placed above buttons; if
+        *            <code>false</code> to the right
         */
        public void setStatusLineAboveButtons(boolean aboveButtons) {
-               fStatusLineAboveButtons= aboveButtons;
+               fStatusLineAboveButtons = aboveButtons;
        }
-       
+
        /**
         * Sets the image for this dialog.
-        * @param image the image.
+        * 
+        * @param image
+        *            the image.
         */
        public void setImage(Image image) {
-               fImage= image;
+               fImage = image;
        }
-       
+
        /**
-        * Returns the first element from the list of results. Returns <code>null</code>
-        * if no element has been selected.
-        *
-        * @return the first result element if one exists. Otherwise <code>null</code> is
-        *  returned.
-        */     
+        * Returns the first element from the list of results. Returns
+        * <code>null</code> if no element has been selected.
+        * 
+        * @return the first result element if one exists. Otherwise
+        *         <code>null</code> is returned.
+        */
        public Object getFirstResult() {
-               Object[] result= getResult();
+               Object[] result = getResult();
                if (result == null || result.length == 0)
                        return null;
-               return result[0];       
+               return result[0];
        }
-       
+
        /**
         * Sets a result element at the given position.
         */
        protected void setResult(int position, Object element) {
-               Object[] result= getResult();
-               result[position]= element;
+               Object[] result = getResult();
+               result[position] = element;
                setResult(Arrays.asList(result));
        }
 
@@ -80,35 +85,35 @@ public abstract class SelectionStatusDialog extends SelectionDialog  {
         * Compute the result and return it.
         */
        protected abstract void computeResult();
-         
+
        protected void configureShell(Shell shell) {
                super.configureShell(shell);
                if (fImage != null)
                        shell.setImage(fImage);
        }
-       
+
        /**
-        * Update the dialog's status line to reflect the given status. It is safe to call
-        * this method before the dialog has been opened.
+        * Update the dialog's status line to reflect the given status. It is safe
+        * to call this method before the dialog has been opened.
         */
        protected void updateStatus(IStatus status) {
-               fLastStatus= status;
+               fLastStatus = status;
                if (fStatusLine != null && !fStatusLine.isDisposed()) {
-                   updateButtonsEnableState(status);
-                   fStatusLine.setErrorStatus(status);
+                       updateButtonsEnableState(status);
+                       fStatusLine.setErrorStatus(status);
                }
-       }       
+       }
 
        /**
-        * Update the status of the ok button to reflect the given status. Subclasses
-        * may override this method to update additional buttons.
+        * Update the status of the ok button to reflect the given status.
+        * Subclasses may override this method to update additional buttons.
         */
        protected void updateButtonsEnableState(IStatus status) {
-               Button okButton= getOkButton();
+               Button okButton = getOkButton();
                if (okButton != null && !okButton.isDisposed())
                        okButton.setEnabled(!status.matches(IStatus.ERROR));
        }
-       
+
        protected void okPressed() {
                computeResult();
                super.okPressed();
@@ -121,28 +126,29 @@ public abstract class SelectionStatusDialog extends SelectionDialog  {
        }
 
        protected Control createButtonBar(Composite parent) {
-               Composite composite= new Composite(parent, SWT.NULL);
-               GridLayout layout= new GridLayout();
+               Composite composite = new Composite(parent, SWT.NULL);
+               GridLayout layout = new GridLayout();
                if (fStatusLineAboveButtons) {
-                       layout.marginWidth= 5;
+                       layout.marginWidth = 5;
                } else {
-                       layout.numColumns= 2;
+                       layout.numColumns = 2;
                }
-               layout.marginHeight= 0; layout.marginWidth= 0;
+               layout.marginHeight = 0;
+               layout.marginWidth = 0;
                composite.setLayout(layout);
                composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-               
-               fStatusLine= new MessageLine(composite);
+
+               fStatusLine = new MessageLine(composite);
                fStatusLine.setAlignment(SWT.LEFT);
                fStatusLine.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
                fStatusLine.setErrorStatus(null);
-               
-               GridData gd= new GridData(GridData.FILL_HORIZONTAL);
-               gd.horizontalIndent= convertWidthInCharsToPixels(1);
+
+               GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+               gd.horizontalIndent = convertWidthInCharsToPixels(1);
                fStatusLine.setLayoutData(gd);
-               
+
                super.createButtonBar(composite);
                return composite;
        }
-       
+
 }
\ No newline at end of file