replaced a lot of deprecated code; if someone runs into a commit conflict afterwards...
[phpeclipse.git] / net.sourceforge.phpeclipse.webbrowser / src / net / sourceforge / phpeclipse / webbrowser / internal / ExternalBrowserDialog.java
index f6aadff..4b3b9c9 100644 (file)
@@ -30,9 +30,9 @@ import org.eclipse.swt.widgets.FileDialog;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.ui.PlatformUI;
 /**
- * 
+ *
  */
 public class ExternalBrowserDialog extends Dialog {
        protected IExternalWebBrowserWorkingCopy browser;
@@ -44,11 +44,11 @@ public class ExternalBrowserDialog extends Dialog {
        protected Text browserLocationTextfield;
        protected Text browserParametersTextfield;
        private Button okButton;
-       
+
        interface StringModifyListener {
                public void valueChanged(String s);
        }
-       
+
        /**
         * @param parentShell
         */
@@ -66,7 +66,7 @@ public class ExternalBrowserDialog extends Dialog {
 
        protected void configureShell(Shell shell) {
                super.configureShell(shell);
-               
+
                if (isEdit)
                        shell.setText(WebBrowserUIPlugin.getResource("%editExternalBrowser"));
                else
@@ -82,7 +82,7 @@ public class ExternalBrowserDialog extends Dialog {
                text.setLayoutData(data);
                if (listener != null)
                        text.addModifyListener(new ModifyListener() {
-                               public void modifyText(ModifyEvent e) { 
+                               public void modifyText(ModifyEvent e) {
                                        listener.valueChanged(text.getText());
                                }
                        });
@@ -95,12 +95,12 @@ public class ExternalBrowserDialog extends Dialog {
        protected Control createDialogArea(Composite parent) {
                Composite composite = (Composite) super.createDialogArea(parent);
                ((GridLayout)composite.getLayout()).numColumns = 3;
-               
+
                if (isEdit)
-                       WorkbenchHelp.setHelp(composite, ContextIds.PREF_BROWSER_EXTERNAL_EDIT);
+                       PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER_EXTERNAL_EDIT);
                else
-                       WorkbenchHelp.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) {
@@ -108,33 +108,33 @@ public class ExternalBrowserDialog extends Dialog {
                                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"));
                browseButton.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                                FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
                                dialog.setText(WebBrowserUIPlugin.getResource("%browseMessage"));
-                               
+
                                String fname = browserLocationTextfield.getText();
-                               
+
                                dialog.setFileName(fname);
                                fname = dialog.open();
-                               
+
                                if (fname != null)
                                        browserLocationTextfield.setText(fname);
                        }
                });
-               
+
                SWTUtil.createLabel(composite, WebBrowserUIPlugin.getResource("%parameters"));
                browserParametersTextfield = createText(composite, browser.getParameters(), new StringModifyListener() {
                        public void valueChanged(String s) {
@@ -143,12 +143,12 @@ public class ExternalBrowserDialog extends Dialog {
                });
 
                new Label(composite, SWT.NONE);
-               
+
                new Label(composite, SWT.NONE);
                Label urlLabel = new Label(composite, SWT.NONE);
                urlLabel.setText(WebBrowserUIPlugin.getResource("%parametersMessage", WebBrowserPreference.URL_PARAMETER));
-       
-               
+
+
                return composite;
        }
 
@@ -168,36 +168,36 @@ public class ExternalBrowserDialog extends Dialog {
                        WebBrowserUtil.openError(WebBrowserUIPlugin.getResource("%locationInvalid"));
                        return;
                }
-               
+
                browser.save();
                super.okPressed();
        }
-       
+
        private void setOKButtonEnabled(boolean curIsEnabled) {
                if (okButton == null)
                        okButton = getButton(IDialogConstants.OK_ID);
-               
+
                if (okButton != null)
                        okButton.setEnabled(curIsEnabled);
        }
-       
+
        protected Control createButtonBar(Composite parent) {
                Control buttonControl = super.createButtonBar(parent);
                validateFields();
                return buttonControl;
        }
-       
+
        protected void validateFields() {
                boolean valid = true;
-               
+
                String name = browserNameTextfield.getText();
                if (name == null || name.trim().length() < 1)
                        valid = false;
-               
+
                String location = browserLocationTextfield.getText();
                if (location == null || location.trim().length() < 1)
                        valid = false;
-               
+
                setOKButtonEnabled(valid);
        }
 }
\ No newline at end of file