make compilable in 3.2 latest integration build, removed reference to no longer exist...
[phpeclipse.git] / net.sourceforge.phpeclipse.debug.ui / src / net / sourceforge / phpdt / internal / debug / ui / launcher / PHPEnvironmentTab2.java
index c6dd5e0..21f1307 100644 (file)
@@ -24,7 +24,6 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
 import org.eclipse.debug.core.ILaunchManager;
 import org.eclipse.debug.internal.ui.DebugPluginImages;
 import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.DialogSettingsHelper;
 import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
 import org.eclipse.debug.internal.ui.MultipleInputDialog;
 import org.eclipse.debug.internal.ui.launchConfigurations.EnvironmentVariable;
@@ -66,8 +65,8 @@ import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.dialogs.ListSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
 
 /**
  * @author Christian
@@ -105,7 +104,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
        protected Button appendEnvironment;
        protected Button replaceEnvironment;
        protected Button envSelectButton;
-       
+
        /**
         * Content provider for the environment table
         */
@@ -155,7 +154,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                        }
                }
        }
-       
+
        /**
         * Label provider for the environment table
         */
@@ -187,21 +186,21 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                // Create main composite
                Composite mainComposite = new Composite(parent, SWT.NONE);
                setControl(mainComposite);
-               WorkbenchHelp.setHelp(getControl(), IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_ENVIRONMENT_TAB);
+               PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_ENVIRONMENT_TAB);
                GridLayout layout = new GridLayout();
                layout.numColumns = 2;
                GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
                mainComposite.setLayout(layout);
                mainComposite.setLayoutData(gridData);
                mainComposite.setFont(parent.getFont());
-               
+
                createEnvironmentTable(mainComposite);
                createTableButtons(mainComposite);
                createAppendReplace(mainComposite);
-               
+
                Dialog.applyDialogFont(mainComposite);
        }
-       
+
        /**
         * Creates and configures the widgets which allow the user to
         * choose whether the specified environment should be appended
@@ -216,7 +215,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                appendReplaceComposite.setLayoutData(gridData);
                appendReplaceComposite.setLayout(layout);
                appendReplaceComposite.setFont(parent.getFont());
-               
+
        appendEnvironment= createRadioButton(appendReplaceComposite, LaunchConfigurationsMessages.EnvironmentTab_16); //$NON-NLS-1$
                appendEnvironment.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
@@ -225,7 +224,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                });
        replaceEnvironment= createRadioButton(appendReplaceComposite, LaunchConfigurationsMessages.EnvironmentTab_17); //$NON-NLS-1$
        }
-       
+
        /**
         * Updates the enablement of the append/replace widgets. The
         * widgets should disable when there are no environment variables specified.
@@ -235,7 +234,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                appendEnvironment.setEnabled(enable);
                replaceEnvironment.setEnabled(enable);
        }
-       
+
        /**
         * Creates and configures the table that displayed the key/value
         * pairs that comprise the environment.
@@ -290,7 +289,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                        tc.setText(envTableColumnHeaders[i]);
                }
        }
-       
+
        /**
         * Responds to a selection changed event in the environment table
         * @param event the selection change event
@@ -300,7 +299,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                envEditButton.setEnabled(size == 1);
                envRemoveButton.setEnabled(size > 0);
        }
-       
+
        /**
         * Creates the add/edit/remove buttons for the environment table
         * @param parent the composite in which the buttons should be created
@@ -332,7 +331,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                                handleEnvAddCGIButtonSelected();
                        }
                });
-               
+
        envSelectButton = createPushButton(buttonComposite, LaunchConfigurationsMessages.EnvironmentTab_18, null); //$NON-NLS-1$
                envSelectButton.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent event) {
@@ -356,7 +355,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                });
                envRemoveButton.setEnabled(false);
        }
-       
+
        /**
         * Adds a new environment variable to the table.
         */
@@ -364,20 +363,20 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
        MultipleInputDialog dialog = new MultipleInputDialog(getShell(), LaunchConfigurationsMessages.EnvironmentTab_22); //$NON-NLS-1$
                dialog.addTextField(NAME_LABEL, null, false);
                dialog.addVariablesField(VALUE_LABEL, null, true);
-               
+
                if (dialog.open() != Window.OK) {
                        return;
                }
-               
+
                String name = dialog.getStringValue(NAME_LABEL);
                String value = dialog.getStringValue(VALUE_LABEL);
-               
+
                if (name != null && value != null && name.length() > 0 && value.length() >0) {
                        addVariable(new EnvironmentVariable(name.trim(), value.trim()));
                        updateAppendReplace();
                }
        }
-       
+
        /**
         * Attempts to add the given variable. Returns whether the variable
         * was added or not (as when the user answers not to overwrite an
@@ -403,9 +402,9 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                updateLaunchConfigurationDialog();
                return true;
        }
-       
+
        /**
-        * Displays a dialog that allows user to select native environment variables 
+        * Displays a dialog that allows user to select native environment variables
         * to add to the table.
         */
        private void handleEnvSelectButtonSelected() {
@@ -418,30 +417,30 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                        EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
                        envVariables.remove(var.getName());
                }
-               
+
        ListSelectionDialog dialog = new NativeEnvironmentDialog(getShell(), envVariables, createSelectionDialogContentProvider(), createSelectionDialogLabelProvider(), LaunchConfigurationsMessages.EnvironmentTab_19); //$NON-NLS-1$
        dialog.setTitle(LaunchConfigurationsMessages.EnvironmentTab_20); //$NON-NLS-1$
-               
+
                int button = dialog.open();
                if (button == Window.OK) {
-                       Object[] selected = dialog.getResult();         
+                       Object[] selected = dialog.getResult();
                        for (int i = 0; i < selected.length; i++) {
-                               environmentTable.add(selected[i]);                              
+                               environmentTable.add(selected[i]);
                        }
                }
-               
+
                updateAppendReplace();
                updateLaunchConfigurationDialog();
        }
-       
+
        /**
-        * Displays a dialog that allows user to select native environment variables 
+        * Displays a dialog that allows user to select native environment variables
         * to add to the table.
         */
        private void handleEnvAddCGIButtonSelected() {
 
                Map envVariables = new HashMap();
-               
+
 
                envVariables.put("HTTP_COOKIE",new EnvironmentVariable("HTTP_COOKIE", "TestCookie=1"));
                envVariables.put("REDIRECT_QUERY_STRING",new EnvironmentVariable("REDIRECT_QUERY_STRING", ""));
@@ -460,26 +459,26 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
 //             envVariables.put("REQUEST_URI" + OSFilePath;
 //             envVariables.put("PATH_INFO=" + OSFilePath;
 //             envVariables.put("PATH_TRANSLATED=" + OSFilePath;
-               
-               
+
+
                //get Environment Variables from the table
                TableItem[] items = environmentTable.getTable().getItems();
                for (int i = 0; i < items.length; i++) {
                        EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
                        envVariables.remove(var.getName());
                }
-               
+
        ListSelectionDialog dialog = new NativeEnvironmentDialog(getShell(), envVariables, createSelectionDialogContentProvider(), createSelectionDialogLabelProvider(), LaunchConfigurationsMessages.EnvironmentTab_19); //$NON-NLS-1$
        dialog.setTitle(LaunchConfigurationsMessages.EnvironmentTab_20); //$NON-NLS-1$
-               
+
                int button = dialog.open();
                if (button == Window.OK) {
-                       Object[] selected = dialog.getResult();         
+                       Object[] selected = dialog.getResult();
                        for (int i = 0; i < selected.length; i++) {
-                               environmentTable.add(selected[i]);                              
+                               environmentTable.add(selected[i]);
                        }
                }
-               
+
                updateAppendReplace();
                updateLaunchConfigurationDialog();
        }
@@ -506,7 +505,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                                return false;
                        }
                        public void removeListener(ILabelProviderListener listener) {
-                       }                               
+                       }
                };
        }
 
@@ -525,7 +524,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                                                        String s2 = (String)o2;
                                                        return s1.compareTo(s2);
                                                }
-                                       
+
                                        };
                                        TreeMap envVars = new TreeMap(comparator);
                                        envVars.putAll((Map)inputElement);
@@ -538,7 +537,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                                }
                                return elements;
                        }
-                       public void dispose() { 
+                       public void dispose() {
                        }
                        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
                        }
@@ -574,7 +573,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
        MultipleInputDialog dialog= new MultipleInputDialog(getShell(), LaunchConfigurationsMessages.EnvironmentTab_11); //$NON-NLS-1$
                dialog.addTextField(NAME_LABEL, originalName, false);
                dialog.addVariablesField(VALUE_LABEL, value, true);
-               
+
                if (dialog.open() != Window.OK) {
                        return;
                }
@@ -598,7 +597,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                IStructuredSelection sel = (IStructuredSelection) environmentTable.getSelection();
                environmentTable.getControl().setRedraw(false);
                for (Iterator i = sel.iterator(); i.hasNext(); ) {
-                       EnvironmentVariable var = (EnvironmentVariable) i.next();       
+                       EnvironmentVariable var = (EnvironmentVariable) i.next();
                environmentTable.remove(var);
                }
                environmentTable.getControl().setRedraw(true);
@@ -645,7 +644,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
         * Stores the environment in the given configuration
         * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
         */
-       public void performApply(ILaunchConfigurationWorkingCopy configuration) {       
+       public void performApply(ILaunchConfigurationWorkingCopy configuration) {
                // Convert the table's items into a Map so that this can be saved in the
                // configuration's attributes.
                TableItem[] items = environmentTable.getTable().getItems();
@@ -654,7 +653,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
                {
                        EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
                        map.put(var.getName(), var.getValue());
-               } 
+               }
                if (map.size() == 0) {
                        configuration.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map) null);
                } else {
@@ -669,7 +668,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
        public String getName() {
        return LaunchConfigurationsMessages.EnvironmentTab_Environment_7; //$NON-NLS-1$
        }
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
         */
@@ -690,58 +689,30 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
        public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) {
                // do nothing when deactivated
        }
-       
+
        private class NativeEnvironmentDialog extends ListSelectionDialog {
                public NativeEnvironmentDialog(Shell parentShell, Object input, IStructuredContentProvider contentProvider, ILabelProvider labelProvider, String message) {
                        super(parentShell, input, contentProvider, labelProvider, message);
                        setShellStyle(getShellStyle() | SWT.RESIZE);
                }
-               
+
                protected IDialogSettings getDialogSettings() {
                        IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
                        IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
                        if (section == null) {
                                section = settings.addNewSection(getDialogSettingsSectionName());
-                       } 
+                       }
                        return section;
                }
-               
+
                /**
                 * Returns the name of the section that this dialog stores its settings in
-                * 
+                *
                 * @return String
                 */
                protected String getDialogSettingsSectionName() {
                        return IDebugUIConstants.PLUGIN_ID + ".ENVIRONMENT_TAB.NATIVE_ENVIROMENT_DIALOG"; //$NON-NLS-1$
                }
-
-
-               /* (non-Javadoc)
-                * @see org.eclipse.jface.window.Window#getInitialLocation(org.eclipse.swt.graphics.Point)
-                */
-               protected Point getInitialLocation(Point initialSize) {
-                       Point initialLocation= DialogSettingsHelper.getInitialLocation(getDialogSettingsSectionName());
-                       if (initialLocation != null) {
-                               return initialLocation;
-                       }
-                       return super.getInitialLocation(initialSize);
-               }
-                       
-               /* (non-Javadoc)
-                * @see org.eclipse.jface.window.Window#getInitialSize()
-                */
-               protected Point getInitialSize() {
-                       Point size = super.getInitialSize();
-                       return DialogSettingsHelper.getInitialSize(getDialogSettingsSectionName(), size);
-               }
-               
-               /* (non-Javadoc)
-                * @see org.eclipse.jface.window.Window#close()
-                */
-               public boolean close() {
-                       DialogSettingsHelper.persistShellGeometry(getShell(), getDialogSettingsSectionName());
-                       return super.close();
-               }
        }
 }