Refactory: remove unused classes, imports, fields and methods.
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.ui / src / net / sourceforge / phpeclipse / xdebug / ui / MultipleInputDialog.java
index 0f23c3e..3af109a 100644 (file)
@@ -28,34 +28,28 @@ import org.eclipse.swt.widgets.Text;
 
 public class MultipleInputDialog extends Dialog {
        protected static final String FIELD_NAME = "FIELD_NAME"; //$NON-NLS-1$
-
        protected static final int TEXT = 100;
-
        protected static final int BROWSE = 101;
-
        protected static final int VARIABLE = 102;
-
+       
        protected Composite panel;
-
+       
        protected List fieldList = new ArrayList();
-
        protected List controlList = new ArrayList();
-
        protected List validators = new ArrayList();
-
        protected Map valueMap = new HashMap();
 
        private String title;
-
+       
+       
+       
        public MultipleInputDialog(Shell shell, String title) {
                super(shell);
                this.title = title;
                setShellStyle(getShellStyle() | SWT.RESIZE);
        }
-
-       /*
-        * (non-Javadoc)
-        * 
+       
+       /* (non-Javadoc)
         * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
         */
        protected void configureShell(Shell shell) {
@@ -63,12 +57,10 @@ public class MultipleInputDialog extends Dialog {
                if (title != null) {
                        shell.setText(title);
                }
-
+               
        }
-
-       /*
-        * (non-Javadoc)
-        * 
+       
+       /* (non-Javadoc)
         * @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite)
         */
        protected Control createButtonBar(Composite parent) {
@@ -76,80 +68,66 @@ public class MultipleInputDialog extends Dialog {
                validateFields();
                return bar;
        }
-
-       /*
-        * (non-Javadoc)
-        * 
+       
+       /* (non-Javadoc)
         * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
         */
        protected Control createDialogArea(Composite parent) {
-               Composite container = (Composite) super.createDialogArea(parent);
+               Composite container = (Composite)super.createDialogArea(parent);
                container.setLayout(new GridLayout(2, false));
                container.setLayoutData(new GridData(GridData.FILL_BOTH));
-
+               
                panel = new Composite(container, SWT.NONE);
                GridLayout layout = new GridLayout(2, false);
                panel.setLayout(layout);
                panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+               
                for (Iterator i = fieldList.iterator(); i.hasNext();) {
-                       FieldSummary field = (FieldSummary) i.next();
-                       switch (field.type) {
-                       case TEXT:
-                               createTextField(field.name, field.initialValue,
-                                               field.allowsEmpty);
-                               break;
-                       case BROWSE:
-                               createBrowseField(field.name, field.initialValue,
-                                               field.allowsEmpty);
-                               break;
-                       case VARIABLE:
-                               createVariablesField(field.name, field.initialValue,
-                                               field.allowsEmpty);
-                               break;
+                       FieldSummary field = (FieldSummary)i.next();
+                       switch(field.type) {
+                               case TEXT:
+                                       createTextField(field.name, field.initialValue, field.allowsEmpty);
+                                       break;
+                               case BROWSE:
+                                       createBrowseField(field.name, field.initialValue, field.allowsEmpty);
+                                       break;
+                               case VARIABLE:
+                                       createVariablesField(field.name, field.initialValue, field.allowsEmpty);
+                                       break;
                        }
                }
-
+               
                fieldList = null; // allow it to be gc'd
                Dialog.applyDialogFont(container);
                return container;
        }
-
-       public void addBrowseField(String labelText, String initialValue,
-                       boolean allowsEmpty) {
-               fieldList.add(new FieldSummary(BROWSE, labelText, initialValue,
-                               allowsEmpty));
+       
+       public void addBrowseField(String labelText, String initialValue, boolean allowsEmpty) {
+               fieldList.add(new FieldSummary(BROWSE, labelText, initialValue, allowsEmpty));
        }
-
-       public void addTextField(String labelText, String initialValue,
-                       boolean allowsEmpty) {
-               fieldList.add(new FieldSummary(TEXT, labelText, initialValue,
-                               allowsEmpty));
+       public void addTextField(String labelText, String initialValue, boolean allowsEmpty) {
+               fieldList.add(new FieldSummary(TEXT, labelText, initialValue, allowsEmpty));
        }
-
-       public void addVariablesField(String labelText, String initialValue,
-                       boolean allowsEmpty) {
-               fieldList.add(new FieldSummary(VARIABLE, labelText, initialValue,
-                               allowsEmpty));
+       public void addVariablesField(String labelText, String initialValue, boolean allowsEmpty) {
+               fieldList.add(new FieldSummary(VARIABLE, labelText, initialValue, allowsEmpty));
        }
 
-       protected void createTextField(String labelText, String initialValue,
-                       boolean allowEmpty) {
+       protected void createTextField(String labelText, String initialValue, boolean allowEmpty) { 
                Label label = new Label(panel, SWT.NONE);
                label.setText(labelText);
                label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
+               
                final Text text = new Text(panel, SWT.SINGLE | SWT.BORDER);
                text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
                text.setData(FIELD_NAME, labelText);
-
+               
                // make sure rows are the same height on both panels.
-               label.setSize(label.getSize().x, text.getSize().y);
-
+               label.setSize(label.getSize().x, text.getSize().y); 
+               
                if (initialValue != null) {
                        text.setText(initialValue);
                }
-
+               
                if (!allowEmpty) {
                        validators.add(new Validator() {
                                public boolean validate() {
@@ -162,23 +140,22 @@ public class MultipleInputDialog extends Dialog {
                                }
                        });
                }
-
+               
                controlList.add(text);
        }
-
-       protected void createBrowseField(String labelText, String initialValue,
-                       boolean allowEmpty) {
+       
+       protected void createBrowseField(String labelText, String initialValue, boolean allowEmpty) {
                Label label = new Label(panel, SWT.NONE);
                label.setText(labelText);
                label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
+               
                Composite comp = new Composite(panel, SWT.NONE);
                GridLayout layout = new GridLayout();
-               layout.marginHeight = 0;
-               layout.marginWidth = 0;
+               layout.marginHeight=0;
+               layout.marginWidth=0;
                comp.setLayout(layout);
                comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+               
                final Text text = new Text(comp, SWT.SINGLE | SWT.BORDER);
                GridData data = new GridData(GridData.FILL_HORIZONTAL);
                data.widthHint = 200;
@@ -186,8 +163,8 @@ public class MultipleInputDialog extends Dialog {
                text.setData(FIELD_NAME, labelText);
 
                // make sure rows are the same height on both panels.
-               label.setSize(label.getSize().x, text.getSize().y);
-
+               label.setSize(label.getSize().x, text.getSize().y); 
+               
                if (initialValue != null) {
                        text.setText(initialValue);
                }
@@ -205,45 +182,44 @@ public class MultipleInputDialog extends Dialog {
                                }
                        });
                }
-
-               Button button = createButton(comp, IDialogConstants.IGNORE_ID,
-                               "&Browse...", false);
+               
+               Button button = createButton(comp, IDialogConstants.IGNORE_ID, "&Browse...", false); 
                button.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                                DirectoryDialog dialog = new DirectoryDialog(getShell());
-                               dialog.setMessage("Select a file:");
+                               dialog.setMessage("Select a file:");  
                                String currentWorkingDir = text.getText();
                                if (!currentWorkingDir.trim().equals("")) { //$NON-NLS-1$
                                        File path = new File(currentWorkingDir);
                                        if (path.exists()) {
                                                dialog.setFilterPath(currentWorkingDir);
-                                       }
+                                       }                       
                                }
-
+                               
                                String selectedDirectory = dialog.open();
                                if (selectedDirectory != null) {
                                        text.setText(selectedDirectory);
-                               }
+                               }               
                        }
                });
 
                controlList.add(text);
-
+               
        }
-
-       public void createVariablesField(String labelText, String initialValue,
-                       boolean allowEmpty) {
+       
+       
+       public void createVariablesField(String labelText, String initialValue, boolean allowEmpty) {
                Label label = new Label(panel, SWT.NONE);
                label.setText(labelText);
                label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
+               
                Composite comp = new Composite(panel, SWT.NONE);
                GridLayout layout = new GridLayout();
-               layout.marginHeight = 0;
-               layout.marginWidth = 0;
+               layout.marginHeight=0;
+               layout.marginWidth=0;
                comp.setLayout(layout);
                comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+               
                final Text text = new Text(comp, SWT.SINGLE | SWT.BORDER);
                GridData data = new GridData(GridData.FILL_HORIZONTAL);
                data.widthHint = 200;
@@ -251,8 +227,8 @@ public class MultipleInputDialog extends Dialog {
                text.setData(FIELD_NAME, labelText);
 
                // make sure rows are the same height on both panels.
-               label.setSize(label.getSize().x, text.getSize().y);
-
+               label.setSize(label.getSize().x, text.getSize().y); 
+               
                if (initialValue != null) {
                        text.setText(initialValue);
                }
@@ -270,13 +246,11 @@ public class MultipleInputDialog extends Dialog {
                                }
                        });
                }
-
-               Button button = createButton(comp, IDialogConstants.IGNORE_ID,
-                               "Varia&bles...", false);
+               
+               Button button = createButton(comp, IDialogConstants.IGNORE_ID, "Varia&bles...", false); 
                button.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
-                               StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(
-                                               getShell());
+                               StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
                                int code = dialog.open();
                                if (code == IDialogConstants.OK_ID) {
                                        String variable = dialog.getVariableExpression();
@@ -288,46 +262,42 @@ public class MultipleInputDialog extends Dialog {
                });
 
                controlList.add(text);
-
+                               
        }
-
-       /*
-        * (non-Javadoc)
-        * 
+       
+       /* (non-Javadoc)
         * @see org.eclipse.jface.dialogs.Dialog#okPressed()
         */
        protected void okPressed() {
-               for (Iterator i = controlList.iterator(); i.hasNext();) {
-                       Control control = (Control) i.next();
+               for (Iterator i = controlList.iterator(); i.hasNext(); ) {
+                       Control control = (Control)i.next();
                        if (control instanceof Text) {
-                               valueMap.put(control.getData(FIELD_NAME), ((Text) control)
-                                               .getText());
+                               valueMap.put(control.getData(FIELD_NAME), ((Text)control).getText());
                        }
                }
                controlList = null;
                super.okPressed();
        }
 
-       /*
-        * (non-Javadoc)
-        * 
+       
+       /* (non-Javadoc)
         * @see org.eclipse.jface.window.Window#open()
         */
        public int open() {
                applyDialogFont(panel);
                return super.open();
        }
-
+       
        public Object getValue(String key) {
                return valueMap.get(key);
        }
-
+       
        public String getStringValue(String key) {
-               return (String) getValue(key);
+               return  (String) getValue(key);
        }
-
+       
        public void validateFields() {
-               for (Iterator i = validators.iterator(); i.hasNext();) {
+               for(Iterator i = validators.iterator(); i.hasNext(); ) {
                        Validator validator = (Validator) i.next();
                        if (!validator.validate()) {
                                getButton(IDialogConstants.OK_ID).setEnabled(false);
@@ -337,60 +307,52 @@ public class MultipleInputDialog extends Dialog {
                getButton(IDialogConstants.OK_ID).setEnabled(true);
        }
 
-       // /* (non-Javadoc)
-       // * @see
-       // org.eclipse.jface.window.Window#getInitialLocation(org.eclipse.swt.graphics.Point)
-       // */
-       // protected Point getInitialLocation(Point initialSize) {
-       // Point initialLocation=
-       // DialogSettingsHelper.getInitialLocation(getDialogSettingsSectionName());
-       // if (initialLocation != null) {
-       // return initialLocation;
-       // }
-       // return super.getInitialLocation(initialSize);
-       // }
-
+//     /* (non-Javadoc)
+//      * @see org.eclipse.jface.window.Window#getInitialLocation(org.eclipse.swt.graphics.Point)
+//      */
+//     protected Point getInitialLocation(Point initialSize) {
+//             Point initialLocation= DialogSettingsHelper.getInitialLocation(getDialogSettingsSectionName());
+//             if (initialLocation != null) {
+//                     return initialLocation;
+//             }
+//             return super.getInitialLocation(initialSize);
+//     }
+
+       
        protected String getDialogSettingsSectionName() {
                return IDebugUIConstants.PLUGIN_ID + ".MULTIPLE_INPUT_DIALOG_2"; //$NON-NLS-1$
        }
-
-       // /* (non-Javadoc)
-       // * @see org.eclipse.jface.window.Window#getInitialSize()
-       // */
-       // protected Point getInitialSize() {
-       // Point size = super.getInitialSize();
-       // return
-       // DialogSettingsHelper.getInitialSize(getDialogSettingsSectionName(),
-       // size);
-       // }
-
-       // /* (non-Javadoc)
-       // * @see org.eclipse.jface.window.Window#close()
-       // */
-       // public boolean close() {
-       // DialogSettingsHelper.persistShellGeometry(getShell(),
-       // getDialogSettingsSectionName());
-       // return super.close();
-       // }
+       
+//     /* (non-Javadoc)
+//      * @see org.eclipse.jface.window.Window#getInitialSize()
+//      */
+//     protected Point getInitialSize() {
+//             Point size = super.getInitialSize();
+//             return DialogSettingsHelper.getInitialSize(getDialogSettingsSectionName(), size);
+//     }
+       
+//     /* (non-Javadoc)
+//      * @see org.eclipse.jface.window.Window#close()
+//      */
+//     public boolean close() {
+//             DialogSettingsHelper.persistShellGeometry(getShell(), getDialogSettingsSectionName());
+//             return super.close();
+//     }
 
        protected class FieldSummary {
                int type;
-
                String name;
-
                String initialValue;
-
                boolean allowsEmpty;
-
-               public FieldSummary(int type, String name, String initialValue,
-                               boolean allowsEmpty) {
+               
+               public FieldSummary(int type, String name, String initialValue, boolean allowsEmpty) {
                        this.type = type;
                        this.name = name;
                        this.initialValue = initialValue;
                        this.allowsEmpty = allowsEmpty;
                }
        }
-
+       
        protected class Validator {
                boolean validate() {
                        return true;