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.openQuestion(getShell(),"Overwrite variable?",
423 MessageFormat.format("A variable named {0} already exists. Overwrite?",new String[] { name }));
427 environmentTable.remove(existingVariable);
431 environmentTable.add(variable);
432 updateLaunchConfigurationDialog();
437 * Displays a dialog that allows user to select native environment variables
438 * to add to the table.
440 private void handleEnvSelectButtonSelected() {
441 // get Environment Variables from the OS
442 Map envVariables = getNativeEnvironment();
444 // get Environment Variables from the table
445 TableItem[] items = environmentTable.getTable().getItems();
446 for (int i = 0; i < items.length; i++) {
447 EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
448 envVariables.remove(var.getName());
451 ListSelectionDialog dialog = new NativeEnvironmentDialog(getShell(),
452 envVariables, createSelectionDialogContentProvider(),
453 createSelectionDialogLabelProvider(),
454 "Select &environment variables to add:");
455 dialog.setTitle("Select Environment Variables");
457 int button = dialog.open();
458 if (button == Window.OK) {
459 Object[] selected = dialog.getResult();
460 for (int i = 0; i < selected.length; i++) {
461 environmentTable.add(selected[i]);
465 updateAppendReplace();
466 updateLaunchConfigurationDialog();
470 * Displays a dialog that allows user to select native environment variables
471 * to add to the table.
473 private void handleEnvAddCGIButtonSelected() {
475 Map envVariables = new HashMap();
477 envVariables.put("HTTP_COOKIE", new EnvironmentVariable("HTTP_COOKIE",
479 envVariables.put("REDIRECT_QUERY_STRING", new EnvironmentVariable(
480 "REDIRECT_QUERY_STRING", ""));
481 envVariables.put("REDIRECT_STATUS", new EnvironmentVariable(
482 "REDIRECT_STATUS", "200"));
483 envVariables.put("REDIRECT_URL", new EnvironmentVariable(
484 "REDIRECT_URL", ""));
485 envVariables.put("SERVER_SOFTWARE", new EnvironmentVariable(
486 "SERVER_SOFTWARE", "DBG / 2.1"));
487 envVariables.put("SERVER_NAME", new EnvironmentVariable("SERVER_NAME",
489 envVariables.put("SERVER_ADDR", new EnvironmentVariable("SERVER_ADDR",
491 envVariables.put("SERVER_PORT", new EnvironmentVariable("SERVER_PORT",
493 envVariables.put("REMOTE_ADDR", new EnvironmentVariable("REMOTE_ADDR",
495 envVariables.put("GATEWAY_INTERFACE", new EnvironmentVariable(
496 "GATEWAY_INTERFACE", "CGI / 1.1"));
497 envVariables.put("SERVER_PROTOCOL", new EnvironmentVariable(
498 "SERVER_PROTOCOL", "HTTP / 1.1"));
499 envVariables.put("REQUEST_METHOD", new EnvironmentVariable(
500 "REQUEST_METHOD", "GET"));
501 envVariables.put("QUERY_STRING", new EnvironmentVariable(
502 "QUERY_STRING", ""));
503 envVariables.put("REDIRECT_QUERY_STRING", new EnvironmentVariable(
504 "REDIRECT_QUERY_STRING", ""));
505 // envVariables.put("REQUEST_URI" + OSFilePath;
506 // envVariables.put("PATH_INFO=" + OSFilePath;
507 // envVariables.put("PATH_TRANSLATED=" + OSFilePath;
509 // get Environment Variables from the table
510 TableItem[] items = environmentTable.getTable().getItems();
511 for (int i = 0; i < items.length; i++) {
512 EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
513 envVariables.remove(var.getName());
516 ListSelectionDialog dialog = new NativeEnvironmentDialog(getShell(),
517 envVariables, createSelectionDialogContentProvider(),
518 createSelectionDialogLabelProvider(),
519 "Select &environment variables to add:");
520 dialog.setTitle("Select Environment Variables");
522 int button = dialog.open();
523 if (button == Window.OK) {
524 Object[] selected = dialog.getResult();
525 for (int i = 0; i < selected.length; i++) {
526 environmentTable.add(selected[i]);
530 updateAppendReplace();
531 updateLaunchConfigurationDialog();
535 * Creates a label provider for the native native environment variable
538 * @return A label provider for the native native environment variable
541 private ILabelProvider createSelectionDialogLabelProvider() {
542 return new ILabelProvider() {
543 public Image getImage(Object element) {
547 public String getText(Object element) {
548 EnvironmentVariable var = (EnvironmentVariable) element;
549 return var.getName() + " [" + var.getValue() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
552 public void addListener(ILabelProviderListener listener) {
555 public void dispose() {
558 public boolean isLabelProperty(Object element, String property) {
562 public void removeListener(ILabelProviderListener listener) {
568 * Creates a content provider for the native native environment variable
571 * @return A content provider for the native native environment variable
574 private IStructuredContentProvider createSelectionDialogContentProvider() {
575 return new IStructuredContentProvider() {
576 public Object[] getElements(Object inputElement) {
577 EnvironmentVariable[] elements = null;
578 if (inputElement instanceof HashMap) {
579 Comparator comparator = new Comparator() {
580 public int compare(Object o1, Object o2) {
581 String s1 = (String) o1;
582 String s2 = (String) o2;
583 return s1.compareTo(s2);
587 TreeMap envVars = new TreeMap(comparator);
588 envVars.putAll((Map) inputElement);
589 elements = new EnvironmentVariable[envVars.size()];
591 for (Iterator iterator = envVars.keySet().iterator(); iterator
592 .hasNext(); index++) {
593 Object key = iterator.next();
594 elements[index] = (EnvironmentVariable) envVars
601 public void dispose() {
604 public void inputChanged(Viewer viewer, Object oldInput,
611 * Gets native environment variable from the LaunchManager. Creates
612 * EnvironmentVariable objects.
614 * @return Map of name - EnvironmentVariable pairs based on native
617 private Map getNativeEnvironment() {
618 Map stringVars = DebugPlugin.getDefault().getLaunchManager()
619 .getNativeEnvironment();
620 HashMap vars = new HashMap();
621 for (Iterator i = stringVars.keySet().iterator(); i.hasNext();) {
622 String key = (String) i.next();
623 String value = (String) stringVars.get(key);
624 vars.put(key, new EnvironmentVariable(key, value));
630 * Creates an editor for the value of the selected environment variable.
632 private void handleEnvEditButtonSelected() {
633 IStructuredSelection sel = (IStructuredSelection) environmentTable
635 EnvironmentVariable var = (EnvironmentVariable) sel.getFirstElement();
639 String originalName = var.getName();
640 String value = var.getValue();
641 MultipleInputDialog dialog = new MultipleInputDialog(getShell(),
642 "Edit Environment Variable");
643 dialog.addTextField(NAME_LABEL, originalName, false);
644 dialog.addVariablesField(VALUE_LABEL, value, true);
646 if (dialog.open() != Window.OK) {
649 String name = dialog.getStringValue(NAME_LABEL);
650 value = dialog.getStringValue(VALUE_LABEL);
651 if (!originalName.equals(name)) {
652 if (addVariable(new EnvironmentVariable(name, value))) {
653 environmentTable.remove(var);
657 environmentTable.update(var, null);
658 updateLaunchConfigurationDialog();
663 * Removes the selected environment variable from the table.
665 private void handleEnvRemoveButtonSelected() {
666 IStructuredSelection sel = (IStructuredSelection) environmentTable
668 environmentTable.getControl().setRedraw(false);
669 for (Iterator i = sel.iterator(); i.hasNext();) {
670 EnvironmentVariable var = (EnvironmentVariable) i.next();
671 environmentTable.remove(var);
673 environmentTable.getControl().setRedraw(true);
674 updateAppendReplace();
675 updateLaunchConfigurationDialog();
679 * Updates the environment table for the given launch configuration
681 * @param configuration
683 protected void updateEnvironment(ILaunchConfiguration configuration) {
684 environmentTable.setInput(configuration);
690 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
692 public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
698 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
700 public void initializeFrom(ILaunchConfiguration configuration) {
701 boolean append = true;
703 append = configuration.getAttribute(
704 ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
705 } catch (CoreException e) {
706 XDebugCorePlugin.log(e.getStatus());
709 appendEnvironment.setSelection(true);
710 replaceEnvironment.setSelection(false);
712 replaceEnvironment.setSelection(true);
713 appendEnvironment.setSelection(false);
715 updateEnvironment(configuration);
716 updateAppendReplace();
720 * Stores the environment in the given configuration
722 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
724 public void performApply(ILaunchConfigurationWorkingCopy configuration) {
725 // Convert the table's items into a Map so that this can be saved in the
726 // configuration's attributes.
727 TableItem[] items = environmentTable.getTable().getItems();
728 Map map = new HashMap(items.length);
729 for (int i = 0; i < items.length; i++) {
730 EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
731 map.put(var.getName(), var.getValue());
733 if (map.size() == 0) {
734 configuration.setAttribute(
735 ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map) null);
737 configuration.setAttribute(
738 ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map);
740 configuration.setAttribute(
741 ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES,
742 appendEnvironment.getSelection());
748 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
750 public String getName() {
751 return "Environment";
757 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
759 public Image getImage() {
760 return XDebugUIPluginImages.get(XDebugUIPluginImages.IMG_EVIEW_ENVIROMENT_TAB);
766 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
768 public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
769 // do nothing when activated
775 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
777 public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) {
778 // do nothing when deactivated
781 private class NativeEnvironmentDialog extends ListSelectionDialog {
782 public NativeEnvironmentDialog(Shell parentShell, Object input,
783 IStructuredContentProvider contentProvider,
784 ILabelProvider labelProvider, String message) {
785 super(parentShell, input, contentProvider, labelProvider, message);
786 setShellStyle(getShellStyle() | SWT.RESIZE);
789 protected IDialogSettings getDialogSettings() {
790 // IDialogSettings settings = XDebugCorePlugin.getDefault().getDialogSettings();
791 IDialogSettings settings = getDialogSettings();
792 IDialogSettings section = settings
793 .getSection(getDialogSettingsSectionName());
794 if (section == null) {
796 .addNewSection(getDialogSettingsSectionName());
802 * Returns the name of the section that this dialog stores its settings
807 protected String getDialogSettingsSectionName() {
808 return IDebugUIConstants.PLUGIN_ID
809 + ".ENVIRONMENT_TAB.NATIVE_ENVIROMENT_DIALOG"; //$NON-NLS-1$
814 // org.eclipse.jface.window.Window#getInitialLocation(org.eclipse.swt.graphics.Point)
816 // protected Point getInitialLocation(Point initialSize) {
817 // Point initialLocation=
818 // DialogSettingsHelper.getInitialLocation(getDialogSettingsSectionName());
819 // if (initialLocation != null) {
820 // return initialLocation;
822 // return super.getInitialLocation(initialSize);
826 // * @see org.eclipse.jface.window.Window#getInitialSize()
828 // protected Point getInitialSize() {
829 // Point size = super.getInitialSize();
830 // return DialogSettingsHelper.getInitialSize(getDialogSettingsSectionName(), size);
834 // * @see org.eclipse.jface.window.Window#close()
836 // public boolean close() {
837 // DialogSettingsHelper.persistShellGeometry(getShell(), getDialogSettingsSectionName());
838 // return super.close();