1) Although dbg will be dropped from being supported or bundled with PHPeclipse,...
[phpeclipse.git] / net.sourceforge.phpeclipse.debug.ui / src / net / sourceforge / phpdt / internal / debug / ui / launcher / PHPEnvironmentTab.java
index 87e8a33..bc9d08f 100644 (file)
@@ -54,27 +54,19 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
 
        protected java.util.List installedInterpretersWorkingCopy;
 
-       protected Combo interpreterCombo;
+       protected Combo     interpreterCombo;
 
        // protected Button loadPathDefaultButton;
-       protected Button fRemoteDebugCheckBox;
-
-       protected Button fRemoteDebugTranslate;
-
-       protected Button fOpenDBGSessionInBrowserCheckBox;
-
-       protected Button fOpenDBGSessionInExternalBrowserCheckBox;
-
-       protected Button fPathMapRemoveButton;
-
-       protected Button fPathMapAddButton;
-
-       protected Button fPathMapEditButton;
-
-       protected Text fRemoteSourcePath;
-
-       protected Table fRemoteDebugPathMapTable;
-
+       protected Button    fRemoteDebugCheckBox;
+       protected Button    fRelaunchOnScriptTerminationCheckBox;
+       protected Button    fRemoteDebugTranslate;
+       protected Button    fOpenDBGSessionInBrowserCheckBox;
+       protected Button    fOpenDBGSessionInExternalBrowserCheckBox;
+       protected Button    fPathMapRemoveButton;
+       protected Button    fPathMapAddButton;
+       protected Button    fPathMapEditButton;
+       protected Text      fRemoteSourcePath;
+       protected Table     fRemoteDebugPathMapTable;
        protected TabFolder tabFolder;
 
        private Text targetFile;
@@ -86,7 +78,7 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
 
                /*
                 * (non-Javadoc)
-                * 
+                *
                 * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
                 */
                public void modifyText(ModifyEvent e) {
@@ -96,7 +88,7 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
 
                /*
                 * (non-Javadoc)
-                * 
+                *
                 * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
                 */
                public void widgetSelected(SelectionEvent e) {
@@ -111,6 +103,8 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                                handlePathMapRemoveButtonSelected();
                        } else if (source == fRemoteDebugCheckBox) {
                                setRemoteTabEnableState();
+                       } else if (source == fRelaunchOnScriptTerminationCheckBox) {
+                               setRemoteTabEnableState();
                        } else if (source == fRemoteDebugTranslate) {
                                setRemoteTabEnableState();
                        } else if (source == fOpenDBGSessionInBrowserCheckBox) {
@@ -123,17 +117,13 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
 
        }
 
-       private static final String EMPTY_STRING = ""; //$NON-NLS-1$
-
-       private RemoteDebugTabListener fListener = new RemoteDebugTabListener();
-
-       private static final boolean DEFAULT_REMOTE_DEBUG = false;
-
-       private static final boolean DEFAULT_REMOTE_DEBUG_TRANSLATE = false;
-
-       private static final boolean DEFAULT_OPEN_DBGSESSION_IN_BROWSER = true;
-
-       private static final boolean DEFAULT_OPEN_DBGSESSION_IN_EXTERNAL_BROWSER = false;
+       private static final String                 EMPTY_STRING                                = ""; //$NON-NLS-1$
+       private              RemoteDebugTabListener fListener                                   = new RemoteDebugTabListener();
+       private static final boolean                DEFAULT_REMOTE_DEBUG                        = false;
+       private static final boolean                DEFAULT_REMOTE_DEBUG_TRANSLATE              = false;
+       private static final boolean                DEFAULT_OPEN_DBGSESSION_IN_BROWSER          = true;
+       private static final boolean                DEFAULT_OPEN_DBGSESSION_IN_EXTERNAL_BROWSER = false;
+       private static final boolean                DEFAULT_RELAUNCH_ON_SCRIPT_TERMINATION      = true;
 
        static String[] columnTitles = {
                        PHPDebugUiMessages
@@ -206,6 +196,13 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                                .addSelectionListener(fListener);
                // addendum
 
+               fRelaunchOnScriptTerminationCheckBox = new Button (comp, SWT.CHECK);
+               fRelaunchOnScriptTerminationCheckBox
+                               .setText (PHPDebugUiMessages
+                                               .getString ("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RelaunchOnScriptTermination.label"));
+               fRelaunchOnScriptTerminationCheckBox.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_BEGINNING));
+               fRelaunchOnScriptTerminationCheckBox.addSelectionListener (fListener);
+
                label = new Label(comp, SWT.NONE);
                label
                                .setText(PHPDebugUiMessages
@@ -364,21 +361,22 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
         */
        private void setRemoteTabEnableState() {
                boolean state = fRemoteDebugCheckBox.getSelection();
-               fRemoteSourcePath.setEnabled(state);
-               fRemoteDebugTranslate.setEnabled(state);
 
-               fRemoteDebugPathMapTable.setEnabled(state);
+               fRemoteSourcePath.setEnabled (state);
+               fRemoteDebugTranslate.setEnabled (state);
+               fRemoteDebugPathMapTable.setEnabled (state);
+
                if (!state) {
-                       fPathMapEditButton.setEnabled(false);
-                       fPathMapRemoveButton.setEnabled(false);
-                       fPathMapAddButton.setEnabled(false);
-                       fOpenDBGSessionInBrowserCheckBox.setEnabled(false);
-                       fOpenDBGSessionInExternalBrowserCheckBox.setEnabled(false);
+                       fPathMapEditButton.setEnabled (false);
+                       fPathMapRemoveButton.setEnabled (false);
+                       fPathMapAddButton.setEnabled (false);
+                       fOpenDBGSessionInBrowserCheckBox.setEnabled (false);
+                       fOpenDBGSessionInExternalBrowserCheckBox.setEnabled (false);
                } else {
-                       setPathMapButtonsEnableState();
+                       setPathMapButtonsEnableState ();
                }
 
-               updateLaunchConfigurationDialog();
+               updateLaunchConfigurationDialog ();
        }
 
        /**
@@ -388,32 +386,36 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
        private void setPathMapButtonsEnableState() {
                // just do nothing for now
                //
-               if (fRemoteDebugCheckBox.getSelection()) {
-                       fOpenDBGSessionInBrowserCheckBox.setEnabled(true);
+               if (fRemoteDebugCheckBox.getSelection ()) {
+                       fOpenDBGSessionInBrowserCheckBox.setEnabled (true);
                        fOpenDBGSessionInExternalBrowserCheckBox
-                                       .setEnabled(fOpenDBGSessionInBrowserCheckBox.getSelection());
-                       fRemoteDebugTranslate.setEnabled(true);
+                                       .setEnabled (fOpenDBGSessionInBrowserCheckBox.getSelection ());
+                       fRemoteDebugTranslate.setEnabled (true);
+
                        int selectCount = this.fRemoteDebugPathMapTable
-                                       .getSelectionIndices().length;
+                                       .getSelectionIndices ().length;
+
                        if (selectCount < 1) {
-                               fPathMapEditButton.setEnabled(false);
-                               fPathMapRemoveButton.setEnabled(false);
+                               fPathMapEditButton.setEnabled (false);
+                               fPathMapRemoveButton.setEnabled (false);
                        } else {
-                               fPathMapRemoveButton.setEnabled(true);
+                               fPathMapRemoveButton.setEnabled (true);
+
                                if (selectCount == 1) {
-                                       fPathMapEditButton.setEnabled(true);
+                                       fPathMapEditButton.setEnabled (true);
                                } else {
-                                       fPathMapEditButton.setEnabled(false);
+                                       fPathMapEditButton.setEnabled (false);
                                }
                        }
-                       fPathMapAddButton.setEnabled(true);
+
+                       fPathMapAddButton.setEnabled (true);
                }
        }
 
        /**
         * Show the specified dialog and update the pathMapTable table based on its
         * results.
-        * 
+        *
         * @param updateItem
         *            the item to update, or <code>null</code> if adding a new
         *            item
@@ -474,7 +476,7 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
        // loadPathDefaultButton.setLayoutData(new
        // GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        // loadPathDefaultButton.addSelectionListener(getLoadPathDefaultButtonSelectionListener());
-       //              
+       //
        // loadPathDefaultButton.setEnabled(false); //for now, until the load path
        // is customizable on the configuration
        // }
@@ -606,7 +608,9 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                } catch (CoreException ce) {
                        fRemoteDebugCheckBox.setSelection(DEFAULT_REMOTE_DEBUG);
                }
+
                tabFolder.setSelection(fRemoteDebugCheckBox.getSelection() ? 0 : 1);
+
                try {
                        fRemoteDebugTranslate.setSelection(configuration.getAttribute(
                                        PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE,
@@ -614,6 +618,7 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                } catch (CoreException ce) {
                        fRemoteDebugTranslate.setSelection(DEFAULT_REMOTE_DEBUG_TRANSLATE);
                }
+
                try {
                        fOpenDBGSessionInBrowserCheckBox
                                        .setSelection(configuration
@@ -624,6 +629,7 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                        fOpenDBGSessionInBrowserCheckBox
                                        .setSelection(DEFAULT_OPEN_DBGSESSION_IN_BROWSER);
                }
+
                try {
                        fOpenDBGSessionInExternalBrowserCheckBox
                                        .setSelection(configuration
@@ -632,9 +638,21 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                                                                        DEFAULT_OPEN_DBGSESSION_IN_EXTERNAL_BROWSER));
                } catch (CoreException ce) {
                        fOpenDBGSessionInExternalBrowserCheckBox
-                                       .setSelection(DEFAULT_OPEN_DBGSESSION_IN_EXTERNAL_BROWSER);
+                                       .setSelection (DEFAULT_OPEN_DBGSESSION_IN_EXTERNAL_BROWSER);
+               }
+
+               try {
+                       fRelaunchOnScriptTerminationCheckBox
+                                       .setSelection (configuration
+                                                       .getAttribute (
+                                                                       PHPLaunchConfigurationAttribute.RELAUNCH_ON_SCRIPT_TERMINATION,
+                                                                       DEFAULT_RELAUNCH_ON_SCRIPT_TERMINATION));
+               } catch (CoreException ce) {
+                       fRelaunchOnScriptTerminationCheckBox
+                                       .setSelection (DEFAULT_RELAUNCH_ON_SCRIPT_TERMINATION);
                }
 
+
                setRemoteTabEnableState();
 
                try {
@@ -796,10 +814,12 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                configuration.setAttribute(
                                PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER,
                                fOpenDBGSessionInBrowserCheckBox.getSelection());
-               configuration
-                               .setAttribute(
-                                               PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_EXTERNAL_BROWSER,
-                                               fOpenDBGSessionInExternalBrowserCheckBox.getSelection());
+               configuration.setAttribute(
+                               PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_EXTERNAL_BROWSER,
+                               fOpenDBGSessionInExternalBrowserCheckBox.getSelection());
+               configuration.setAttribute(
+                               PHPLaunchConfigurationAttribute.RELAUNCH_ON_SCRIPT_TERMINATION,
+                               fRelaunchOnScriptTerminationCheckBox.getSelection());
        }
 
        protected Composite createPageRoot(Composite parent) {
@@ -920,4 +940,4 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
                targetFile.setText(path);
        }
 
-}
\ No newline at end of file
+}