From a25c4af5624deca9dbdb14083228bebd9ca2a59d Mon Sep 17 00:00:00 2001 From: David Inglis Date: Thu, 16 Jan 2003 20:59:21 +0000 Subject: [PATCH] fixed 'revert' behavior --- .../debug/mi/internal/ui/CDebuggerPage.java | 8 ++++ .../cdt/launch/ui/CEnvironmentTab.java | 41 ++++++++++--------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/CDebuggerPage.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/CDebuggerPage.java index 21fc7383d07..12449f30957 100644 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/CDebuggerPage.java +++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/CDebuggerPage.java @@ -12,6 +12,8 @@ import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; @@ -51,6 +53,12 @@ public class CDebuggerPage extends AbstractLaunchConfigurationTab { fAutoSoLibButton = new Button(comp, SWT.CHECK ) ; fAutoSoLibButton.setText("Load shared library symbols automatically"); + fAutoSoLibButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + updateLaunchConfigurationDialog(); + } + }); + gd = new GridData(); gd.horizontalSpan = 2; fAutoSoLibButton.setLayoutData(gd); diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CEnvironmentTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CEnvironmentTab.java index 48adef10173..14f1a45666d 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CEnvironmentTab.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CEnvironmentTab.java @@ -125,15 +125,15 @@ public class CEnvironmentTab extends CLaunchConfigurationTab { protected Control createDialogArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); - layout.marginWidth= 5; - layout.numColumns= 2; + layout.marginWidth = 5; + layout.numColumns = 2; composite.setLayout(layout); - + GC gc = new GC(composite); gc.setFont(composite.getFont()); - FontMetrics metrics= gc.getFontMetrics(); + FontMetrics metrics = gc.getFontMetrics(); gc.dispose(); - int fieldWidthHint= convertWidthInCharsToPixels(metrics, 50); + int fieldWidthHint = convertWidthInCharsToPixels(metrics, 50); Label label = new Label(composite, SWT.NONE); label.setText("Name:"); @@ -195,7 +195,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab { fElements = new Properties(); Composite control = new Composite(parent, SWT.NONE); GridLayout gl = new GridLayout(2, false); - + createVerticalSpacer(control, 2); control.setLayout(gl); @@ -204,7 +204,6 @@ public class CEnvironmentTab extends CLaunchConfigurationTab { setControl(control); fVariableList.setInput(fElements); fVariableList.getTable().setFocus(); - updateButtons(); } public void set(String env) { @@ -212,8 +211,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab { ByteArrayInputStream input = new ByteArrayInputStream(env.getBytes()); try { fElements.load(input); - } - catch (IOException e) { + } catch (IOException e) { } fVariableList.refresh(); @@ -265,17 +263,16 @@ public class CEnvironmentTab extends CLaunchConfigurationTab { column2.setText("Value"); tableLayout.addColumnData(new ColumnWeightData(30)); - fVariableList.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent e) { - updateButtons(); - } - }); - fVariableList.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent e) { elementDoubleClicked((IStructuredSelection) e.getSelection()); } }); + fVariableList.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent e) { + updateButtons(); + } + }); } private void createButtons(Composite parent) { @@ -327,6 +324,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab { fVariableList.refresh(); } updateButtons(); + updateLaunchConfigurationDialog(); } protected void edit() { @@ -342,6 +340,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab { fVariableList.refresh(); } updateButtons(); + updateLaunchConfigurationDialog(); } protected void remove() { @@ -351,6 +350,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab { fElements.remove(((Map.Entry) elements[i]).getKey()); fVariableList.refresh(); updateButtons(); + updateLaunchConfigurationDialog(); } public void setDefaults(ILaunchConfigurationWorkingCopy config) { @@ -360,19 +360,20 @@ public class CEnvironmentTab extends CLaunchConfigurationTab { public void initializeFrom(ILaunchConfiguration config) { try { - Map env = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map)null); - if ( env != null ) { + Map env = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map) null); + if (env != null) { + fElements.clear(); fElements.putAll(env); fVariableList.refresh(); updateButtons(); } -// config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_INHERIT, true); - } catch ( CoreException e ) { + // config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_INHERIT, true); + } catch (CoreException e) { } } public void performApply(ILaunchConfigurationWorkingCopy config) { - config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, fElements); + config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map) fElements.clone()); config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_INHERIT, true); }