1) Moved net.sourceforge.phpeclipse.ui\src\net\sourceforge\phpdt back to net.sourcefo...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / wizards / dialogfields / ComboDialogField.java
index 6803557..13f6572 100644 (file)
@@ -24,55 +24,60 @@ import org.eclipse.swt.widgets.Label;
  * Dialog field containing a label and a combo control.
  */
 public class ComboDialogField extends DialogField {
-               
+
        private String fText;
+
        private int fSelectionIndex;
+
        private String[] fItems;
+
        private Combo fComboControl;
+
        private ModifyListener fModifyListener;
+
        private int fFlags;
-       
+
        public ComboDialogField(int flags) {
                super();
-               fText= ""; //$NON-NLS-1$
-               fItems= new String[0];
-               fFlags= flags;
-               fSelectionIndex= -1;
+               fText = ""; //$NON-NLS-1$
+               fItems = new String[0];
+               fFlags = flags;
+               fSelectionIndex = -1;
        }
-                       
+
        // ------- layout helpers
-               
+
        /*
         * @see DialogField#doFillIntoGrid
         */
        public Control[] doFillIntoGrid(Composite parent, int nColumns) {
                assertEnoughColumns(nColumns);
-               
-               Label label= getLabelControl(parent);
+
+               Label label = getLabelControl(parent);
                label.setLayoutData(gridDataForLabel(1));
-               Combo combo= getComboControl(parent);
+               Combo combo = getComboControl(parent);
                combo.setLayoutData(gridDataForCombo(nColumns - 1));
-               
+
                return new Control[] { label, combo };
-       } 
+       }
 
        /*
         * @see DialogField#getNumberOfControls
         */
        public int getNumberOfControls() {
-               return 2;       
+               return 2;
        }
-       
-       protected static GridData gridDataForCombo(int span) {
-               GridData gd= new GridData();
-               gd.horizontalAlignment= GridData.FILL;
-               gd.grabExcessHorizontalSpace= false;
-               gd.horizontalSpan= span;
+
+       private static GridData gridDataForCombo(int span) {
+               GridData gd = new GridData();
+               gd.horizontalAlignment = GridData.FILL;
+               gd.grabExcessHorizontalSpace = false;
+               gd.horizontalSpan = span;
                return gd;
-       }       
-       
+       }
+
        // ------- focus methods
-       
+
        /*
         * @see DialogField#setFocus
         */
@@ -82,31 +87,34 @@ public class ComboDialogField extends DialogField {
                }
                return true;
        }
-               
-       // ------- ui creation                  
+
+       // ------- ui creation
 
        /**
         * Creates or returns the created combo control.
-        * @param parent The parent composite or <code>null</code> when the widget has
-        * already been created.
-        */             
+        * 
+        * @param parent
+        *            The parent composite or <code>null</code> when the widget
+        *            has already been created.
+        */
        public Combo getComboControl(Composite parent) {
                if (fComboControl == null) {
                        assertCompositeNotNull(parent);
-                       fModifyListener= new ModifyListener() {
+                       fModifyListener = new ModifyListener() {
                                public void modifyText(ModifyEvent e) {
                                        doModifyText(e);
                                }
                        };
-                       SelectionListener selectionListener= new SelectionListener() {
+                       SelectionListener selectionListener = new SelectionListener() {
                                public void widgetSelected(SelectionEvent e) {
                                        doSelectionChanged(e);
                                }
-                               
-                               public void widgetDefaultSelected(SelectionEvent e) {   };
+
+                               public void widgetDefaultSelected(SelectionEvent e) {
+                               };
                        };
-                       
-                       fComboControl= new Combo(parent, fFlags);
+
+                       fComboControl = new Combo(parent, fFlags);
                        // moved up due to 1GEUNW2
                        fComboControl.setItems(fItems);
                        if (fSelectionIndex != -1) {
@@ -120,106 +128,105 @@ public class ComboDialogField extends DialogField {
                        fComboControl.setEnabled(isEnabled());
                }
                return fComboControl;
-       }       
-       
+       }
+
        private void doModifyText(ModifyEvent e) {
                if (isOkToUse(fComboControl)) {
-                       fText= fComboControl.getText();
-                       fSelectionIndex= fComboControl.getSelectionIndex();
+                       fText = fComboControl.getText();
+                       fSelectionIndex = fComboControl.getSelectionIndex();
                }
                dialogFieldChanged();
        }
-       
+
        private void doSelectionChanged(SelectionEvent e) {
                if (isOkToUse(fComboControl)) {
-                       fItems= fComboControl.getItems();
-                       fText= fComboControl.getText();
-                       fSelectionIndex= fComboControl.getSelectionIndex();
+                       fItems = fComboControl.getItems();
+                       fText = fComboControl.getText();
+                       fSelectionIndex = fComboControl.getSelectionIndex();
                }
-               dialogFieldChanged();   
+               dialogFieldChanged();
        }
-       
+
        // ------ enable / disable management
-       
+
        /*
         * @see DialogField#updateEnableState
-        */             
+        */
        protected void updateEnableState() {
-               super.updateEnableState();              
+               super.updateEnableState();
                if (isOkToUse(fComboControl)) {
                        fComboControl.setEnabled(isEnabled());
-               }       
-       }               
-               
-       // ------ text access 
-       
+               }
+       }
+
+       // ------ text access
+
        /**
         * Gets the combo items.
-        */     
+        */
        public String[] getItems() {
                return fItems;
        }
-       
+
        /**
         * Sets the combo items. Triggers a dialog-changed event.
         */
        public void setItems(String[] items) {
-               fItems= items;
+               fItems = items;
                if (isOkToUse(fComboControl)) {
                        fComboControl.setItems(items);
                }
                dialogFieldChanged();
        }
-       
+
        /**
         * Gets the text.
-        */     
+        */
        public String getText() {
                return fText;
        }
-       
+
        /**
         * Sets the text. Triggers a dialog-changed event.
         */
        public void setText(String text) {
-               fText= text;
+               fText = text;
                if (isOkToUse(fComboControl)) {
                        fComboControl.setText(text);
                } else {
                        dialogFieldChanged();
-               }       
+               }
        }
 
        /**
         * Selects an item.
-        */     
+        */
        public void selectItem(int index) {
                if (isOkToUse(fComboControl)) {
                        fComboControl.select(index);
                } else {
                        if (index >= 0 && index < fItems.length) {
-                               fText= fItems[index];
-                               fSelectionIndex= index; 
+                               fText = fItems[index];
+                               fSelectionIndex = index;
                        }
                }
                dialogFieldChanged();
        }
-       
+
        public int getSelectionIndex() {
                return fSelectionIndex;
        }
-       
 
        /**
         * Sets the text without triggering a dialog-changed event.
         */
-       public void setTextWithoutUpdate(String text) {
-               fText= text;
-               if (isOkToUse(fComboControl)) {
-                       fComboControl.removeModifyListener(fModifyListener);
-                       fComboControl.setText(text);
-                       fComboControl.addModifyListener(fModifyListener);
-               }
-       }
-       
+//     public void setTextWithoutUpdate(String text) {
+//             fText = text;
+//             if (isOkToUse(fComboControl)) {
+//                     fComboControl.removeModifyListener(fModifyListener);
+//                     fComboControl.setText(text);
+//                     fComboControl.addModifyListener(fModifyListener);
+//             }
+//     }
+
 }