refactory whole plugin
[phpeclipse.git] / net.sourceforge.phpeclipse.phphelp / src / net / sourceforge / phpdt / httpquery / preferences / ConfigurationDialog.java
index 634befb..70effbe 100644 (file)
@@ -34,7 +34,7 @@ import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 
 /**
- *
+ * 
  */
 public class ConfigurationDialog extends Dialog {
        protected IConfigurationWorkingCopy fConfiguration;
@@ -47,7 +47,7 @@ public class ConfigurationDialog extends Dialog {
 
        private Text fUrl;
 
-//     private Text fPassword;
+       // private Text fPassword;
 
        interface StringModifyListener {
                public void valueChanged(String s);
@@ -64,7 +64,8 @@ public class ConfigurationDialog extends Dialog {
        /**
         * @param parentShell
         */
-       public ConfigurationDialog(Shell parentShell, IConfigurationWorkingCopy configuration) {
+       public ConfigurationDialog(Shell parentShell,
+                       IConfigurationWorkingCopy configuration) {
                super(parentShell);
                this.fConfiguration = configuration;
                isEdit = true;
@@ -87,15 +88,18 @@ public class ConfigurationDialog extends Dialog {
        protected Label createLabel(Composite comp, String txt) {
                Label label = new Label(comp, SWT.NONE);
                label.setText(txt);
-               label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
+               label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
+                               | GridData.VERTICAL_ALIGN_BEGINNING));
                return label;
        }
 
-       protected Text createPassword(Composite comp, String txt, final StringModifyListener listener) {
+       protected Text createPassword(Composite comp, String txt,
+                       final StringModifyListener listener) {
                final Text text = new Text(comp, SWT.BORDER | SWT.PASSWORD);
                if (txt != null)
                        text.setText(txt);
-               GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+               GridData data = new GridData(GridData.FILL_HORIZONTAL
+                               | GridData.VERTICAL_ALIGN_BEGINNING);
                data.widthHint = 150;
                text.setLayoutData(data);
                if (listener != null)
@@ -107,11 +111,13 @@ public class ConfigurationDialog extends Dialog {
                return text;
        }
 
-       protected Text createText(Composite comp, String txt, final StringModifyListener listener) {
+       protected Text createText(Composite comp, String txt,
+                       final StringModifyListener listener) {
                final Text text = new Text(comp, SWT.BORDER);
                if (txt != null)
                        text.setText(txt);
-               GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+               GridData data = new GridData(GridData.FILL_HORIZONTAL
+                               | GridData.VERTICAL_ALIGN_BEGINNING);
                data.widthHint = 150;
                text.setLayoutData(data);
                if (listener != null)
@@ -123,7 +129,8 @@ public class ConfigurationDialog extends Dialog {
                return text;
        }
 
-       protected Combo createTypeCombo(Composite comp, final ArrayList types, String sel, final TypeModifyListener listener) {
+       protected Combo createTypeCombo(Composite comp, final ArrayList types,
+                       String sel, final TypeModifyListener listener) {
                final Combo combo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY);
                int size = types.size();
                String[] items = new String[size];
@@ -136,13 +143,15 @@ public class ConfigurationDialog extends Dialog {
                combo.setItems(items);
                if (index >= 0)
                        combo.select(index);
-               GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
+               GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+                               | GridData.VERTICAL_ALIGN_BEGINNING);
                data.widthHint = 150;
                combo.setLayoutData(data);
                if (listener != null)
                        combo.addSelectionListener(new SelectionListener() {
                                public void widgetSelected(SelectionEvent e) {
-                                       listener.valueChanged((String) types.get(combo.getSelectionIndex()));
+                                       listener.valueChanged((String) types.get(combo
+                                                       .getSelectionIndex()));
                                }
 
                                public void widgetDefaultSelected(SelectionEvent e) {
@@ -159,12 +168,13 @@ public class ConfigurationDialog extends Dialog {
                // WorkbenchHelp.setHelp(composite, ContextIds.PREF_DIALOG);
 
                createLabel(composite, PHPHelpPlugin.getResource("%name"));
-               fName = createText(composite, fConfiguration.getName() + "", new StringModifyListener() {
-                       public void valueChanged(String name) {
-                               fConfiguration.setName(name);
-                               validateFields();
-                       }
-               });
+               fName = createText(composite, fConfiguration.getName() + "",
+                               new StringModifyListener() {
+                                       public void valueChanged(String name) {
+                                               fConfiguration.setName(name);
+                                               validateFields();
+                                       }
+                               });
 
                Group group = new Group(composite, SWT.NONE);
                GridLayout layout = new GridLayout(2, false);
@@ -175,26 +185,28 @@ public class ConfigurationDialog extends Dialog {
                group.setLayoutData(data);
                group.setText(PHPHelpPlugin.getResource("%configGroup"));
 
-//             createLabel(group, PHPHelpPlugin.getResource("%user"));
-//             fUserName = createText(group, fConfiguration.getUser() + "", new StringModifyListener() {
-//                     public void valueChanged(String s) {
-//                             fConfiguration.setUser(s);
-//                             validateFields();
-//                     }
-//             });
-
-//             Composite warningComposite = new Composite(group, SWT.NONE);
-//             layout = new GridLayout();
-//             layout.numColumns = 2;
-//             layout.marginHeight = 0;
-//             layout.marginHeight = 0;
-//             warningComposite.setLayout(layout);
-//             data = new GridData(GridData.FILL_HORIZONTAL);
-//             data.horizontalSpan = 3;
-//             warningComposite.setLayoutData(data);
+               // createLabel(group, PHPHelpPlugin.getResource("%user"));
+               // fUserName = createText(group, fConfiguration.getUser() + "", new
+               // StringModifyListener() {
+               // public void valueChanged(String s) {
+               // fConfiguration.setUser(s);
+               // validateFields();
+               // }
+               // });
+
+               // Composite warningComposite = new Composite(group, SWT.NONE);
+               // layout = new GridLayout();
+               // layout.numColumns = 2;
+               // layout.marginHeight = 0;
+               // layout.marginHeight = 0;
+               // warningComposite.setLayout(layout);
+               // data = new GridData(GridData.FILL_HORIZONTAL);
+               // data.horizontalSpan = 3;
+               // warningComposite.setLayoutData(data);
                // Label warningLabel = new Label(warningComposite, SWT.NONE);
                // warningLabel.setImage(getImage(DLG_IMG_MESSAGE_WARNING));
-               // warningLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING
+               // warningLabel.setLayoutData(new
+               // GridData(GridData.VERTICAL_ALIGN_BEGINNING
                // | GridData.HORIZONTAL_ALIGN_BEGINNING));
                // Label warningText = new Label(warningComposite, SWT.WRAP);
                // warningText.setText(PHPHelpPlugin.getResource("%scrambledPassword"));
@@ -203,24 +215,27 @@ public class ConfigurationDialog extends Dialog {
                // data.widthHint = 300;
                // warningText.setLayoutData(data);
 
-//             createLabel(group, PHPHelpPlugin.getResource("%password"));
-//             fPassword = createPassword(group, fConfiguration.getPassword() + "", new StringModifyListener() {
-//                     public void valueChanged(String s) {
-//                             fConfiguration.setPassword(s);
-//                             validateFields();
-//                     }
-//             });
+               // createLabel(group, PHPHelpPlugin.getResource("%password"));
+               // fPassword = createPassword(group, fConfiguration.getPassword() + "",
+               // new StringModifyListener() {
+               // public void valueChanged(String s) {
+               // fConfiguration.setPassword(s);
+               // validateFields();
+               // }
+               // });
 
                createLabel(group, PHPHelpPlugin.getResource("%url"));
-               fUrl = createText(group, fConfiguration.getURL(), new StringModifyListener() {
-                       public void valueChanged(String s) {
-                               fConfiguration.setURL(s);
-                               validateFields();
-                       }
-               });
+               fUrl = createText(group, fConfiguration.getURL(),
+                               new StringModifyListener() {
+                                       public void valueChanged(String s) {
+                                               fConfiguration.setURL(s);
+                                               validateFields();
+                                       }
+                               });
 
                createLabel(group, PHPHelpPlugin.getResource("%parseType"));
-               createTypeCombo(group, PHPHelpPlugin.getTypes(), fConfiguration.getType(), new TypeModifyListener() {
+               createTypeCombo(group, PHPHelpPlugin.getTypes(), fConfiguration
+                               .getType(), new TypeModifyListener() {
                        public void valueChanged(String fType) {
                                fConfiguration.setType(fType);
                        }