2 * Created on 14.07.2004
4 * TODO To change the template for this generated file go to
5 * Window - Preferences - Java - Code Style - Code Templates
7 package net.sourceforge.phpeclipse.xdebug.ui.php.launching;
9 import java.text.MessageFormat;
10 import java.util.Comparator;
11 import java.util.HashMap;
12 import java.util.Iterator;
14 import java.util.TreeMap;
16 import net.sourceforge.phpeclipse.xdebug.core.XDebugCorePlugin;
17 import net.sourceforge.phpeclipse.xdebug.ui.EnvironmentVariable;
18 import net.sourceforge.phpeclipse.xdebug.ui.MultipleInputDialog;
19 import net.sourceforge.phpeclipse.xdebug.ui.XDebugUIPluginImages;
21 import org.eclipse.core.runtime.CoreException;
22 import org.eclipse.core.runtime.IStatus;
23 import org.eclipse.core.runtime.Status;
24 import org.eclipse.debug.core.DebugPlugin;
25 import org.eclipse.debug.core.ILaunchConfiguration;
26 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
27 import org.eclipse.debug.core.ILaunchManager;
28 import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
29 import org.eclipse.debug.ui.IDebugUIConstants;
30 import org.eclipse.jface.dialogs.Dialog;
31 import org.eclipse.jface.dialogs.IDialogSettings;
32 import org.eclipse.jface.dialogs.MessageDialog;
33 import org.eclipse.jface.viewers.ColumnLayoutData;
34 import org.eclipse.jface.viewers.ColumnWeightData;
35 import org.eclipse.jface.viewers.DoubleClickEvent;
36 import org.eclipse.jface.viewers.IDoubleClickListener;
37 import org.eclipse.jface.viewers.ILabelProvider;
38 import org.eclipse.jface.viewers.ILabelProviderListener;
39 import org.eclipse.jface.viewers.ISelectionChangedListener;
40 import org.eclipse.jface.viewers.IStructuredContentProvider;
41 import org.eclipse.jface.viewers.IStructuredSelection;
42 import org.eclipse.jface.viewers.ITableLabelProvider;
43 import org.eclipse.jface.viewers.LabelProvider;
44 import org.eclipse.jface.viewers.SelectionChangedEvent;
45 import org.eclipse.jface.viewers.TableLayout;
46 import org.eclipse.jface.viewers.TableViewer;
47 import org.eclipse.jface.viewers.Viewer;
48 import org.eclipse.jface.viewers.ViewerSorter;
49 import org.eclipse.jface.window.Window;
50 import org.eclipse.swt.SWT;
51 import org.eclipse.swt.events.SelectionAdapter;
52 import org.eclipse.swt.events.SelectionEvent;
53 import org.eclipse.swt.graphics.Font;
54 import org.eclipse.swt.graphics.Image;
55 import org.eclipse.swt.layout.GridData;
56 import org.eclipse.swt.layout.GridLayout;
57 import org.eclipse.swt.widgets.Button;
58 import org.eclipse.swt.widgets.Composite;
59 import org.eclipse.swt.widgets.Label;
60 import org.eclipse.swt.widgets.Shell;
61 import org.eclipse.swt.widgets.Table;
62 import org.eclipse.swt.widgets.TableColumn;
63 import org.eclipse.swt.widgets.TableItem;
64 import org.eclipse.ui.dialogs.ListSelectionDialog;
69 * TODO To change the template for this generated type comment go to Window -
70 * Preferences - Java - Code Style - Code Templates
72 public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
74 protected TableViewer environmentTable;
76 protected String[] envTableColumnHeaders = { "Variable", "Value" };
78 protected ColumnLayoutData[] envTableColumnLayouts = {
79 new ColumnWeightData(50), new ColumnWeightData(50) };
81 private static final String NAME_LABEL = "Name";
83 private static final String VALUE_LABEL = "Value";
85 protected static final String P_VARIABLE = "variable"; //$NON-NLS-1$
87 protected static final String P_VALUE = "value"; //$NON-NLS-1$
89 protected static String[] envTableColumnProperties = { P_VARIABLE, P_VALUE };
91 protected Button envAddButton;
93 protected Button envAddCGIButton;
95 protected Button envEditButton;
97 protected Button envRemoveButton;
99 protected Button appendEnvironment;
101 protected Button replaceEnvironment;
103 protected Button envSelectButton;
106 * Content provider for the environment table
108 protected class EnvironmentVariableContentProvider implements
109 IStructuredContentProvider {
110 public Object[] getElements(Object inputElement) {
111 EnvironmentVariable[] elements = new EnvironmentVariable[0];
112 ILaunchConfiguration config = (ILaunchConfiguration) inputElement;
115 m = config.getAttribute(
116 ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map) null);
117 } catch (CoreException e) {
118 XDebugCorePlugin.log(new Status(IStatus.ERROR,
119 XDebugCorePlugin.PLUGIN_ID, IStatus.ERROR,
120 "Error reading configuration", e)); //$NON-NLS-1$
123 if (m != null && !m.isEmpty()) {
124 elements = new EnvironmentVariable[m.size()];
125 String[] varNames = new String[m.size()];
126 m.keySet().toArray(varNames);
127 for (int i = 0; i < m.size(); i++) {
128 elements[i] = new EnvironmentVariable(varNames[i],
129 (String) m.get(varNames[i]));
135 public void dispose() {
138 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
139 if (newInput == null) {
142 if (viewer instanceof TableViewer) {
143 TableViewer tableViewer = (TableViewer) viewer;
144 if (tableViewer.getTable().isDisposed()) {
147 tableViewer.setSorter(new ViewerSorter() {
148 public int compare(Viewer iviewer, Object e1, Object e2) {
151 } else if (e2 == null) {
154 return ((EnvironmentVariable) e1).getName()
155 .compareToIgnoreCase(
156 ((EnvironmentVariable) e2)
166 * Label provider for the environment table
168 public class EnvironmentVariableLabelProvider extends LabelProvider
169 implements ITableLabelProvider {
170 public String getColumnText(Object element, int columnIndex) {
171 String result = null;
172 if (element != null) {
173 EnvironmentVariable var = (EnvironmentVariable) element;
174 switch (columnIndex) {
176 result = var.getName();
179 result = var.getValue();
186 public Image getColumnImage(Object element, int columnIndex) {
194 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
196 public void createControl(Composite parent) {
197 // Create main composite
198 Composite mainComposite = new Composite(parent, SWT.NONE);
199 setControl(mainComposite);
200 // WorkbenchHelp.setHelp(getControl(),
201 // IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_ENVIRONMENT_TAB);
202 GridLayout layout = new GridLayout();
203 layout.numColumns = 2;
204 GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
205 mainComposite.setLayout(layout);
206 mainComposite.setLayoutData(gridData);
207 mainComposite.setFont(parent.getFont());
209 createEnvironmentTable(mainComposite);
210 createTableButtons(mainComposite);
211 createAppendReplace(mainComposite);
213 Dialog.applyDialogFont(mainComposite);
217 * Creates and configures the widgets which allow the user to choose whether
218 * the specified environment should be appended to the native environment or
219 * if it should completely replace it.
222 * the composite in which the widgets should be created
224 protected void createAppendReplace(Composite parent) {
225 Composite appendReplaceComposite = new Composite(parent, SWT.NONE);
226 GridData gridData = new GridData();
227 gridData.horizontalSpan = 2;
228 GridLayout layout = new GridLayout();
229 appendReplaceComposite.setLayoutData(gridData);
230 appendReplaceComposite.setLayout(layout);
231 appendReplaceComposite.setFont(parent.getFont());
233 appendEnvironment = createRadioButton(appendReplaceComposite,
234 "&Append environment to native environment");
235 appendEnvironment.addSelectionListener(new SelectionAdapter() {
236 public void widgetSelected(SelectionEvent e) {
237 updateLaunchConfigurationDialog();
240 replaceEnvironment = createRadioButton(appendReplaceComposite,
241 "Re&place native environment with specified environment");
245 * Updates the enablement of the append/replace widgets. The widgets should
246 * disable when there are no environment variables specified.
248 protected void updateAppendReplace() {
249 boolean enable = environmentTable.getTable().getItemCount() > 0;
250 appendEnvironment.setEnabled(enable);
251 replaceEnvironment.setEnabled(enable);
255 * Creates and configures the table that displayed the key/value pairs that
256 * comprise the environment.
259 * the composite in which the table should be created
261 protected void createEnvironmentTable(Composite parent) {
262 Font font = parent.getFont();
263 // Create table composite
264 Composite tableComposite = new Composite(parent, SWT.NONE);
265 GridLayout layout = new GridLayout();
266 layout.marginHeight = 0;
267 layout.marginWidth = 0;
268 layout.numColumns = 1;
269 GridData gridData = new GridData(GridData.FILL_BOTH);
270 gridData.heightHint = 150;
271 tableComposite.setLayout(layout);
272 tableComposite.setLayoutData(gridData);
273 tableComposite.setFont(font);
275 Label label = new Label(tableComposite, SWT.NONE);
277 label.setText("Environment variables to &set");
279 environmentTable = new TableViewer(tableComposite, SWT.BORDER
280 | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
281 Table table = environmentTable.getTable();
282 TableLayout tableLayout = new TableLayout();
283 table.setLayout(tableLayout);
284 table.setHeaderVisible(true);
286 gridData = new GridData(GridData.FILL_BOTH);
287 environmentTable.getControl().setLayoutData(gridData);
289 .setContentProvider(new EnvironmentVariableContentProvider());
291 .setLabelProvider(new EnvironmentVariableLabelProvider());
292 environmentTable.setColumnProperties(envTableColumnProperties);
294 .addSelectionChangedListener(new ISelectionChangedListener() {
295 public void selectionChanged(SelectionChangedEvent event) {
296 handleTableSelectionChanged(event);
299 environmentTable.addDoubleClickListener(new IDoubleClickListener() {
300 public void doubleClick(DoubleClickEvent event) {
301 if (!environmentTable.getSelection().isEmpty()) {
302 handleEnvEditButtonSelected();
307 for (int i = 0; i < envTableColumnHeaders.length; i++) {
308 tableLayout.addColumnData(envTableColumnLayouts[i]);
309 TableColumn tc = new TableColumn(table, SWT.NONE, i);
310 tc.setResizable(envTableColumnLayouts[i].resizable);
311 tc.setText(envTableColumnHeaders[i]);
316 * Responds to a selection changed event in the environment table
319 * the selection change event
321 protected void handleTableSelectionChanged(SelectionChangedEvent event) {
322 int size = ((IStructuredSelection) event.getSelection()).size();
323 envEditButton.setEnabled(size == 1);
324 envRemoveButton.setEnabled(size > 0);
328 * Creates the add/edit/remove buttons for the environment table
331 * the composite in which the buttons should be created
333 protected void createTableButtons(Composite parent) {
334 // Create button composite
335 Composite buttonComposite = new Composite(parent, SWT.NONE);
336 GridLayout glayout = new GridLayout();
337 glayout.marginHeight = 0;
338 glayout.marginWidth = 0;
339 glayout.numColumns = 1;
340 GridData gdata = new GridData(GridData.VERTICAL_ALIGN_BEGINNING
341 | GridData.HORIZONTAL_ALIGN_END);
342 buttonComposite.setLayout(glayout);
343 buttonComposite.setLayoutData(gdata);
344 buttonComposite.setFont(parent.getFont());
346 createVerticalSpacer(buttonComposite, 1);
348 envAddButton = createPushButton(buttonComposite, "New", null);
349 envAddButton.addSelectionListener(new SelectionAdapter() {
350 public void widgetSelected(SelectionEvent event) {
351 handleEnvAddButtonSelected();
354 envAddCGIButton = createPushButton(buttonComposite, "CGIButton", null);
355 envAddCGIButton.addSelectionListener(new SelectionAdapter() {
356 public void widgetSelected(SelectionEvent event) {
357 handleEnvAddCGIButtonSelected();
361 envSelectButton = createPushButton(buttonComposite, "Se&lect...", null);
362 envSelectButton.addSelectionListener(new SelectionAdapter() {
363 public void widgetSelected(SelectionEvent event) {
364 handleEnvSelectButtonSelected();
367 envEditButton = createPushButton(buttonComposite, "Edit", null);
368 envEditButton.addSelectionListener(new SelectionAdapter() {
369 public void widgetSelected(SelectionEvent event) {
370 handleEnvEditButtonSelected();
373 envEditButton.setEnabled(false);
374 envRemoveButton = createPushButton(buttonComposite, "Remove", null);
375 envRemoveButton.addSelectionListener(new SelectionAdapter() {
376 public void widgetSelected(SelectionEvent event) {
377 handleEnvRemoveButtonSelected();
380 envRemoveButton.setEnabled(false);
384 * Adds a new environment variable to the table.
386 protected void handleEnvAddButtonSelected() {
387 MultipleInputDialog dialog = new MultipleInputDialog(getShell(),
388 "New Environment Variable");
389 dialog.addTextField(NAME_LABEL, null, false);
390 dialog.addVariablesField(VALUE_LABEL, null, true);
392 if (dialog.open() != Window.OK) {
396 String name = dialog.getStringValue(NAME_LABEL);
397 String value = dialog.getStringValue(VALUE_LABEL);
399 if (name != null && value != null && name.length() > 0
400 && value.length() > 0) {
401 addVariable(new EnvironmentVariable(name.trim(), value.trim()));
402 updateAppendReplace();
407 * Attempts to add the given variable. Returns whether the variable was
408 * added or not (as when the user answers not to overwrite an existing
412 * the variable to add
413 * @return whether the variable was added
415 protected boolean addVariable(EnvironmentVariable variable) {
416 String name = variable.getName();
417 TableItem[] items = environmentTable.getTable().getItems();
418 for (int i = 0; i < items.length; i++) {
419 EnvironmentVariable existingVariable = (EnvironmentVariable) items[i]
421 if (existingVariable.getName().equals(name)) {
422 boolean overWrite = MessageDialog
425 "Overwrite variable?",
428 "A variable named {0} already exists. Overwrite?",
429 new String[] { name }));
433 environmentTable.remove(existingVariable);
437 environmentTable.add(variable);
438 updateLaunchConfigurationDialog();
443 * Displays a dialog that allows user to select native environment variables
444 * to add to the table.
446 private void handleEnvSelectButtonSelected() {
447 // get Environment Variables from the OS
448 Map envVariables = getNativeEnvironment();
450 // get Environment Variables from the table
451 TableItem[] items = environmentTable.getTable().getItems();
452 for (int i = 0; i < items.length; i++) {
453 EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
454 envVariables.remove(var.getName());
457 ListSelectionDialog dialog = new NativeEnvironmentDialog(getShell(),
458 envVariables, createSelectionDialogContentProvider(),
459 createSelectionDialogLabelProvider(),
460 "Select &environment variables to add:");
461 dialog.setTitle("Select Environment Variables");
463 int button = dialog.open();
464 if (button == Window.OK) {
465 Object[] selected = dialog.getResult();
466 for (int i = 0; i < selected.length; i++) {
467 environmentTable.add(selected[i]);
471 updateAppendReplace();
472 updateLaunchConfigurationDialog();
476 * Displays a dialog that allows user to select native environment variables
477 * to add to the table.
479 private void handleEnvAddCGIButtonSelected() {
481 Map envVariables = new HashMap();
483 envVariables.put("HTTP_COOKIE", new EnvironmentVariable("HTTP_COOKIE",
485 envVariables.put("REDIRECT_QUERY_STRING", new EnvironmentVariable(
486 "REDIRECT_QUERY_STRING", ""));
487 envVariables.put("REDIRECT_STATUS", new EnvironmentVariable(
488 "REDIRECT_STATUS", "200"));
489 envVariables.put("REDIRECT_URL", new EnvironmentVariable(
490 "REDIRECT_URL", ""));
491 envVariables.put("SERVER_SOFTWARE", new EnvironmentVariable(
492 "SERVER_SOFTWARE", "DBG / 2.1"));
493 envVariables.put("SERVER_NAME", new EnvironmentVariable("SERVER_NAME",
495 envVariables.put("SERVER_ADDR", new EnvironmentVariable("SERVER_ADDR",
497 envVariables.put("SERVER_PORT", new EnvironmentVariable("SERVER_PORT",
499 envVariables.put("REMOTE_ADDR", new EnvironmentVariable("REMOTE_ADDR",
501 envVariables.put("GATEWAY_INTERFACE", new EnvironmentVariable(
502 "GATEWAY_INTERFACE", "CGI / 1.1"));
503 envVariables.put("SERVER_PROTOCOL", new EnvironmentVariable(
504 "SERVER_PROTOCOL", "HTTP / 1.1"));
505 envVariables.put("REQUEST_METHOD", new EnvironmentVariable(
506 "REQUEST_METHOD", "GET"));
507 envVariables.put("QUERY_STRING", new EnvironmentVariable(
508 "QUERY_STRING", ""));
509 envVariables.put("REDIRECT_QUERY_STRING", new EnvironmentVariable(
510 "REDIRECT_QUERY_STRING", ""));
511 // envVariables.put("REQUEST_URI" + OSFilePath;
512 // envVariables.put("PATH_INFO=" + OSFilePath;
513 // envVariables.put("PATH_TRANSLATED=" + OSFilePath;
515 // get Environment Variables from the table
516 TableItem[] items = environmentTable.getTable().getItems();
517 for (int i = 0; i < items.length; i++) {
518 EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
519 envVariables.remove(var.getName());
522 ListSelectionDialog dialog = new NativeEnvironmentDialog(getShell(),
523 envVariables, createSelectionDialogContentProvider(),
524 createSelectionDialogLabelProvider(),
525 "Select &environment variables to add:");
526 dialog.setTitle("Select Environment Variables");
528 int button = dialog.open();
529 if (button == Window.OK) {
530 Object[] selected = dialog.getResult();
531 for (int i = 0; i < selected.length; i++) {
532 environmentTable.add(selected[i]);
536 updateAppendReplace();
537 updateLaunchConfigurationDialog();
541 * Creates a label provider for the native native environment variable
544 * @return A label provider for the native native environment variable
547 private ILabelProvider createSelectionDialogLabelProvider() {
548 return new ILabelProvider() {
549 public Image getImage(Object element) {
553 public String getText(Object element) {
554 EnvironmentVariable var = (EnvironmentVariable) element;
555 return var.getName() + " [" + var.getValue() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
558 public void addListener(ILabelProviderListener listener) {
561 public void dispose() {
564 public boolean isLabelProperty(Object element, String property) {
568 public void removeListener(ILabelProviderListener listener) {
574 * Creates a content provider for the native native environment variable
577 * @return A content provider for the native native environment variable
580 private IStructuredContentProvider createSelectionDialogContentProvider() {
581 return new IStructuredContentProvider() {
582 public Object[] getElements(Object inputElement) {
583 EnvironmentVariable[] elements = null;
584 if (inputElement instanceof HashMap) {
585 Comparator comparator = new Comparator() {
586 public int compare(Object o1, Object o2) {
587 String s1 = (String) o1;
588 String s2 = (String) o2;
589 return s1.compareTo(s2);
593 TreeMap envVars = new TreeMap(comparator);
594 envVars.putAll((Map) inputElement);
595 elements = new EnvironmentVariable[envVars.size()];
597 for (Iterator iterator = envVars.keySet().iterator(); iterator
598 .hasNext(); index++) {
599 Object key = iterator.next();
600 elements[index] = (EnvironmentVariable) envVars
607 public void dispose() {
610 public void inputChanged(Viewer viewer, Object oldInput,
617 * Gets native environment variable from the LaunchManager. Creates
618 * EnvironmentVariable objects.
620 * @return Map of name - EnvironmentVariable pairs based on native
623 private Map getNativeEnvironment() {
624 Map stringVars = DebugPlugin.getDefault().getLaunchManager()
625 .getNativeEnvironment();
626 HashMap vars = new HashMap();
627 for (Iterator i = stringVars.keySet().iterator(); i.hasNext();) {
628 String key = (String) i.next();
629 String value = (String) stringVars.get(key);
630 vars.put(key, new EnvironmentVariable(key, value));
636 * Creates an editor for the value of the selected environment variable.
638 private void handleEnvEditButtonSelected() {
639 IStructuredSelection sel = (IStructuredSelection) environmentTable
641 EnvironmentVariable var = (EnvironmentVariable) sel.getFirstElement();
645 String originalName = var.getName();
646 String value = var.getValue();
647 MultipleInputDialog dialog = new MultipleInputDialog(getShell(),
648 "Edit Environment Variable");
649 dialog.addTextField(NAME_LABEL, originalName, false);
650 dialog.addVariablesField(VALUE_LABEL, value, true);
652 if (dialog.open() != Window.OK) {
655 String name = dialog.getStringValue(NAME_LABEL);
656 value = dialog.getStringValue(VALUE_LABEL);
657 if (!originalName.equals(name)) {
658 if (addVariable(new EnvironmentVariable(name, value))) {
659 environmentTable.remove(var);
663 environmentTable.update(var, null);
664 updateLaunchConfigurationDialog();
669 * Removes the selected environment variable from the table.
671 private void handleEnvRemoveButtonSelected() {
672 IStructuredSelection sel = (IStructuredSelection) environmentTable
674 environmentTable.getControl().setRedraw(false);
675 for (Iterator i = sel.iterator(); i.hasNext();) {
676 EnvironmentVariable var = (EnvironmentVariable) i.next();
677 environmentTable.remove(var);
679 environmentTable.getControl().setRedraw(true);
680 updateAppendReplace();
681 updateLaunchConfigurationDialog();
685 * Updates the environment table for the given launch configuration
687 * @param configuration
689 protected void updateEnvironment(ILaunchConfiguration configuration) {
690 environmentTable.setInput(configuration);
696 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
698 public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
704 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
706 public void initializeFrom(ILaunchConfiguration configuration) {
707 boolean append = true;
709 append = configuration.getAttribute(
710 ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
711 } catch (CoreException e) {
712 XDebugCorePlugin.log(e.getStatus());
715 appendEnvironment.setSelection(true);
716 replaceEnvironment.setSelection(false);
718 replaceEnvironment.setSelection(true);
719 appendEnvironment.setSelection(false);
721 updateEnvironment(configuration);
722 updateAppendReplace();
726 * Stores the environment in the given configuration
728 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
730 public void performApply(ILaunchConfigurationWorkingCopy configuration) {
731 // Convert the table's items into a Map so that this can be saved in the
732 // configuration's attributes.
733 TableItem[] items = environmentTable.getTable().getItems();
734 Map map = new HashMap(items.length);
735 for (int i = 0; i < items.length; i++) {
736 EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
737 map.put(var.getName(), var.getValue());
739 if (map.size() == 0) {
740 configuration.setAttribute(
741 ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map) null);
743 configuration.setAttribute(
744 ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map);
746 configuration.setAttribute(
747 ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES,
748 appendEnvironment.getSelection());
754 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
756 public String getName() {
757 return "Environment";
763 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
765 public Image getImage() {
766 return XDebugUIPluginImages
767 .get(XDebugUIPluginImages.IMG_EVIEW_ENVIROMENT_TAB);
773 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
775 public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
776 // do nothing when activated
782 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
784 public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) {
785 // do nothing when deactivated
788 private class NativeEnvironmentDialog extends ListSelectionDialog {
789 public NativeEnvironmentDialog(Shell parentShell, Object input,
790 IStructuredContentProvider contentProvider,
791 ILabelProvider labelProvider, String message) {
792 super(parentShell, input, contentProvider, labelProvider, message);
793 setShellStyle(getShellStyle() | SWT.RESIZE);
796 protected IDialogSettings getDialogSettings() {
797 IDialogSettings settings = XDebugCorePlugin.getDefault()
798 .getDialogSettings();
799 IDialogSettings section = settings
800 .getSection(getDialogSettingsSectionName());
801 if (section == null) {
803 .addNewSection(getDialogSettingsSectionName());
809 * Returns the name of the section that this dialog stores its settings
814 protected String getDialogSettingsSectionName() {
815 return IDebugUIConstants.PLUGIN_ID
816 + ".ENVIRONMENT_TAB.NATIVE_ENVIROMENT_DIALOG"; //$NON-NLS-1$
821 // org.eclipse.jface.window.Window#getInitialLocation(org.eclipse.swt.graphics.Point)
823 // protected Point getInitialLocation(Point initialSize) {
824 // Point initialLocation=
825 // DialogSettingsHelper.getInitialLocation(getDialogSettingsSectionName());
826 // if (initialLocation != null) {
827 // return initialLocation;
829 // return super.getInitialLocation(initialSize);
833 // * @see org.eclipse.jface.window.Window#getInitialSize()
835 // protected Point getInitialSize() {
836 // Point size = super.getInitialSize();
838 // DialogSettingsHelper.getInitialSize(getDialogSettingsSectionName(),
843 // * @see org.eclipse.jface.window.Window#close()
845 // public boolean close() {
846 // DialogSettingsHelper.persistShellGeometry(getShell(),
847 // getDialogSettingsSectionName());
848 // return super.close();