1596135 - debugger: open browser when debugging starts
[phpeclipse.git] / net.sourceforge.phpeclipse.debug.ui / src / net / sourceforge / phpdt / internal / debug / ui / launcher / PHPEnvironmentTab.java
index d7a6527..50d3212 100644 (file)
@@ -63,6 +63,8 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
 
        protected Button fOpenDBGSessionInBrowserCheckBox;
 
+       protected Button fOpenDBGSessionInExternalBrowserCheckBox;
+
        protected Button fPathMapRemoveButton;
 
        protected Button fPathMapAddButton;
@@ -111,11 +113,12 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                                setRemoteTabEnableState();
                        } else if (source == fRemoteDebugTranslate) {
                                setRemoteTabEnableState();
+                       } else if (source == fOpenDBGSessionInBrowserCheckBox) {
+                               setRemoteTabEnableState();
                        } else {
                                updateLaunchConfigurationDialog();
                        }
                        makeupTargetFile();
-
                }
 
        }
@@ -130,6 +133,8 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
 
        private static final boolean DEFAULT_OPEN_DBGSESSION_IN_BROWSER = true;
 
+       private static final boolean DEFAULT_OPEN_DBGSESSION_IN_EXTERNAL_BROWSER = false;
+
        static String[] columnTitles = {
                        PHPDebugUiMessages
                                        .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.local"),
@@ -189,6 +194,18 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                                GridData.HORIZONTAL_ALIGN_BEGINNING));
                fOpenDBGSessionInBrowserCheckBox.addSelectionListener(fListener);
 
+               // addendum
+               fOpenDBGSessionInExternalBrowserCheckBox = new Button(comp, SWT.CHECK);
+               fOpenDBGSessionInExternalBrowserCheckBox
+                               .setText(PHPDebugUiMessages
+                                               .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.OpenDBGSessionInExternalBrowserCheckBox.label"));
+               fOpenDBGSessionInExternalBrowserCheckBox.setLayoutData(new GridData(
+                               SWT.BEGINNING));
+               ((GridData) fOpenDBGSessionInExternalBrowserCheckBox.getLayoutData()).horizontalIndent = 16;
+               fOpenDBGSessionInExternalBrowserCheckBox
+                               .addSelectionListener(fListener);
+               // addendum
+
                label = new Label(comp, SWT.NONE);
                label
                                .setText(PHPDebugUiMessages
@@ -356,6 +373,7 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                        fPathMapRemoveButton.setEnabled(false);
                        fPathMapAddButton.setEnabled(false);
                        fOpenDBGSessionInBrowserCheckBox.setEnabled(false);
+                       fOpenDBGSessionInExternalBrowserCheckBox.setEnabled(false);
                } else {
                        setPathMapButtonsEnableState();
                }
@@ -372,6 +390,8 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                //
                if (fRemoteDebugCheckBox.getSelection()) {
                        fOpenDBGSessionInBrowserCheckBox.setEnabled(true);
+                       fOpenDBGSessionInExternalBrowserCheckBox
+                                       .setEnabled(fOpenDBGSessionInBrowserCheckBox.getSelection());
                        fRemoteDebugTranslate.setEnabled(true);
                        int selectCount = this.fRemoteDebugPathMapTable
                                        .getSelectionIndices().length;
@@ -586,6 +606,9 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                } catch (CoreException ce) {
                        fRemoteDebugCheckBox.setSelection(DEFAULT_REMOTE_DEBUG);
                }
+               if (fRemoteDebugCheckBox.getSelection()) {
+                       tabFolder.setSelection(0);
+               }
                try {
                        fRemoteDebugTranslate.setSelection(configuration.getAttribute(
                                        PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE,
@@ -603,7 +626,19 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                        fOpenDBGSessionInBrowserCheckBox
                                        .setSelection(DEFAULT_OPEN_DBGSESSION_IN_BROWSER);
                }
+               try {
+                       fOpenDBGSessionInExternalBrowserCheckBox
+                                       .setSelection(configuration
+                                                       .getAttribute(
+                                                                       PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_EXTERNAL_BROWSER,
+                                                                       DEFAULT_OPEN_DBGSESSION_IN_EXTERNAL_BROWSER));
+               } catch (CoreException ce) {
+                       fOpenDBGSessionInExternalBrowserCheckBox
+                                       .setSelection(DEFAULT_OPEN_DBGSESSION_IN_EXTERNAL_BROWSER);
+               }
+
                setRemoteTabEnableState();
+
                try {
                        fRemoteSourcePath.setText(configuration.getAttribute(
                                        PHPLaunchConfigurationAttribute.REMOTE_PATH, ""));
@@ -755,6 +790,10 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                configuration.setAttribute(
                                PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER,
                                fOpenDBGSessionInBrowserCheckBox.getSelection());
+               configuration
+                               .setAttribute(
+                                               PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_EXTERNAL_BROWSER,
+                                               fOpenDBGSessionInExternalBrowserCheckBox.getSelection());
        }
 
        protected Composite createPageRoot(Composite parent) {