misc.
[phpeclipse.git] / net.sourceforge.phpeclipse.webbrowser / src / net / sourceforge / phpeclipse / webbrowser / internal / ExternalBrowserDialog.java
index 4b3b9c9..2c42ad3 100644 (file)
@@ -4,7 +4,7 @@
  * are made available under the terms of the Common Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/cpl-v10.html
- *
+ �*
  * Contributors:
  *    IBM - Initial API and implementation
  **********************************************************************/
@@ -31,18 +31,27 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.PlatformUI;
+
 /**
- *
+ * 
  */
 public class ExternalBrowserDialog extends Dialog {
        protected IExternalWebBrowserWorkingCopy browser;
+
        protected boolean isEdit;
+
        protected Button newPageCheckbox;
+
        protected Button clearHistoryCheckbox;
+
        protected Button browseButton;
+
        protected Text browserNameTextfield;
+
        protected Text browserLocationTextfield;
+
        protected Text browserParametersTextfield;
+
        private Button okButton;
 
        interface StringModifyListener {
@@ -52,7 +61,8 @@ public class ExternalBrowserDialog extends Dialog {
        /**
         * @param parentShell
         */
-       public ExternalBrowserDialog(Shell parentShell, IExternalWebBrowserWorkingCopy browser) {
+       public ExternalBrowserDialog(Shell parentShell,
+                       IExternalWebBrowserWorkingCopy browser) {
                super(parentShell);
                this.browser = browser;
                isEdit = true;
@@ -68,16 +78,19 @@ public class ExternalBrowserDialog extends Dialog {
                super.configureShell(shell);
 
                if (isEdit)
-                       shell.setText(WebBrowserUIPlugin.getResource("%editExternalBrowser"));
+                       shell.setText(WebBrowserUIPlugin
+                                       .getResource("%editExternalBrowser"));
                else
                        shell.setText(WebBrowserUIPlugin.getResource("%createBrowser"));
        }
 
-       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.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
+               GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+                               | GridData.VERTICAL_ALIGN_BEGINNING);
                data.widthHint = 250;
                text.setLayoutData(data);
                if (listener != null)
@@ -89,41 +102,51 @@ public class ExternalBrowserDialog extends Dialog {
                return text;
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
         */
        protected Control createDialogArea(Composite parent) {
                Composite composite = (Composite) super.createDialogArea(parent);
-               ((GridLayout)composite.getLayout()).numColumns = 3;
+               ((GridLayout) composite.getLayout()).numColumns = 3;
 
                if (isEdit)
-                       PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER_EXTERNAL_EDIT);
+                       PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
+                                       ContextIds.PREF_BROWSER_EXTERNAL_EDIT);
                else
-                       PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER_EXTERNAL_ADD);
+                       PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
+                                       ContextIds.PREF_BROWSER_EXTERNAL_ADD);
 
                SWTUtil.createLabel(composite, WebBrowserUIPlugin.getResource("%name"));
-               browserNameTextfield = createText(composite, browser.getName(), new StringModifyListener() {
-                       public void valueChanged(String s) {
-                               browser.setName(s);
-                               validateFields();
-                       }
-               });
+               browserNameTextfield = createText(composite, browser.getName(),
+                               new StringModifyListener() {
+                                       public void valueChanged(String s) {
+                                               browser.setName(s);
+                                               validateFields();
+                                       }
+                               });
 
                new Label(composite, SWT.NONE);
 
-               SWTUtil.createLabel(composite, WebBrowserUIPlugin.getResource("%location"));
-               browserLocationTextfield = createText(composite, browser.getLocation(), new StringModifyListener() {
-                       public void valueChanged(String s) {
-                               browser.setLocation(s);
-                               validateFields();
-                       }
-               });
-
-               browseButton = SWTUtil.createButton(composite, WebBrowserUIPlugin.getResource("%browse"));
+               SWTUtil.createLabel(composite, WebBrowserUIPlugin
+                               .getResource("%location"));
+               browserLocationTextfield = createText(composite, browser.getLocation(),
+                               new StringModifyListener() {
+                                       public void valueChanged(String s) {
+                                               browser.setLocation(s);
+                                               validateFields();
+                                       }
+                               });
+
+               browseButton = SWTUtil.createButton(composite, WebBrowserUIPlugin
+                               .getResource("%browse"));
                browseButton.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                                FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
-                               dialog.setText(WebBrowserUIPlugin.getResource("%browseMessage"));
+                               dialog
+                                               .setText(WebBrowserUIPlugin
+                                                               .getResource("%browseMessage"));
 
                                String fname = browserLocationTextfield.getText();
 
@@ -135,8 +158,10 @@ public class ExternalBrowserDialog extends Dialog {
                        }
                });
 
-               SWTUtil.createLabel(composite, WebBrowserUIPlugin.getResource("%parameters"));
-               browserParametersTextfield = createText(composite, browser.getParameters(), new StringModifyListener() {
+               SWTUtil.createLabel(composite, WebBrowserUIPlugin
+                               .getResource("%parameters"));
+               browserParametersTextfield = createText(composite, browser
+                               .getParameters(), new StringModifyListener() {
                        public void valueChanged(String s) {
                                browser.setParameters(s);
                        }
@@ -146,26 +171,30 @@ public class ExternalBrowserDialog extends Dialog {
 
                new Label(composite, SWT.NONE);
                Label urlLabel = new Label(composite, SWT.NONE);
-               urlLabel.setText(WebBrowserUIPlugin.getResource("%parametersMessage", WebBrowserPreference.URL_PARAMETER));
-
+               urlLabel.setText(WebBrowserUIPlugin.getResource("%parametersMessage",
+                               WebBrowserPreference.URL_PARAMETER));
 
                return composite;
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.eclipse.jface.dialogs.Dialog#okPressed()
         */
        protected void okPressed() {
-               // do simple field validation to at least ensure target directory entered is valid pathname
+               // do simple field validation to at least ensure target directory
+               // entered is valid pathname
                try {
-               File file = new File(browser.getLocation());
-                       if(!file.isFile()){
-                               WebBrowserUtil.openError(WebBrowserUIPlugin.getResource("%locationInvalid"));
+                       File file = new File(browser.getLocation());
+                       if (!file.isFile()) {
+                               WebBrowserUtil.openError(WebBrowserUIPlugin
+                                               .getResource("%locationInvalid"));
                                return;
                        }
-               }
-               catch(Exception e){
-                       WebBrowserUtil.openError(WebBrowserUIPlugin.getResource("%locationInvalid"));
+               } catch (Exception e) {
+                       WebBrowserUtil.openError(WebBrowserUIPlugin
+                                       .getResource("%locationInvalid"));
                        return;
                }