1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +02:00

fixed 'revert' behavior

This commit is contained in:
David Inglis 2003-01-16 20:59:21 +00:00
parent ec5c2fbaa9
commit a25c4af562
2 changed files with 29 additions and 20 deletions

View file

@ -12,6 +12,8 @@ import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener; 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.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
@ -51,6 +53,12 @@ public class CDebuggerPage extends AbstractLaunchConfigurationTab {
fAutoSoLibButton = new Button(comp, SWT.CHECK ) ; fAutoSoLibButton = new Button(comp, SWT.CHECK ) ;
fAutoSoLibButton.setText("Load shared library symbols automatically"); fAutoSoLibButton.setText("Load shared library symbols automatically");
fAutoSoLibButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
gd = new GridData(); gd = new GridData();
gd.horizontalSpan = 2; gd.horizontalSpan = 2;
fAutoSoLibButton.setLayoutData(gd); fAutoSoLibButton.setLayoutData(gd);

View file

@ -125,15 +125,15 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
protected Control createDialogArea(Composite parent) { protected Control createDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE); Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false); GridLayout layout = new GridLayout(2, false);
layout.marginWidth= 5; layout.marginWidth = 5;
layout.numColumns= 2; layout.numColumns = 2;
composite.setLayout(layout); composite.setLayout(layout);
GC gc = new GC(composite); GC gc = new GC(composite);
gc.setFont(composite.getFont()); gc.setFont(composite.getFont());
FontMetrics metrics= gc.getFontMetrics(); FontMetrics metrics = gc.getFontMetrics();
gc.dispose(); gc.dispose();
int fieldWidthHint= convertWidthInCharsToPixels(metrics, 50); int fieldWidthHint = convertWidthInCharsToPixels(metrics, 50);
Label label = new Label(composite, SWT.NONE); Label label = new Label(composite, SWT.NONE);
label.setText("Name:"); label.setText("Name:");
@ -195,7 +195,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
fElements = new Properties(); fElements = new Properties();
Composite control = new Composite(parent, SWT.NONE); Composite control = new Composite(parent, SWT.NONE);
GridLayout gl = new GridLayout(2, false); GridLayout gl = new GridLayout(2, false);
createVerticalSpacer(control, 2); createVerticalSpacer(control, 2);
control.setLayout(gl); control.setLayout(gl);
@ -204,7 +204,6 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
setControl(control); setControl(control);
fVariableList.setInput(fElements); fVariableList.setInput(fElements);
fVariableList.getTable().setFocus(); fVariableList.getTable().setFocus();
updateButtons();
} }
public void set(String env) { public void set(String env) {
@ -212,8 +211,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
ByteArrayInputStream input = new ByteArrayInputStream(env.getBytes()); ByteArrayInputStream input = new ByteArrayInputStream(env.getBytes());
try { try {
fElements.load(input); fElements.load(input);
} } catch (IOException e) {
catch (IOException e) {
} }
fVariableList.refresh(); fVariableList.refresh();
@ -265,17 +263,16 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
column2.setText("Value"); column2.setText("Value");
tableLayout.addColumnData(new ColumnWeightData(30)); tableLayout.addColumnData(new ColumnWeightData(30));
fVariableList.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent e) {
updateButtons();
}
});
fVariableList.addDoubleClickListener(new IDoubleClickListener() { fVariableList.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent e) { public void doubleClick(DoubleClickEvent e) {
elementDoubleClicked((IStructuredSelection) e.getSelection()); elementDoubleClicked((IStructuredSelection) e.getSelection());
} }
}); });
fVariableList.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent e) {
updateButtons();
}
});
} }
private void createButtons(Composite parent) { private void createButtons(Composite parent) {
@ -327,6 +324,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
fVariableList.refresh(); fVariableList.refresh();
} }
updateButtons(); updateButtons();
updateLaunchConfigurationDialog();
} }
protected void edit() { protected void edit() {
@ -342,6 +340,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
fVariableList.refresh(); fVariableList.refresh();
} }
updateButtons(); updateButtons();
updateLaunchConfigurationDialog();
} }
protected void remove() { protected void remove() {
@ -351,6 +350,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
fElements.remove(((Map.Entry) elements[i]).getKey()); fElements.remove(((Map.Entry) elements[i]).getKey());
fVariableList.refresh(); fVariableList.refresh();
updateButtons(); updateButtons();
updateLaunchConfigurationDialog();
} }
public void setDefaults(ILaunchConfigurationWorkingCopy config) { public void setDefaults(ILaunchConfigurationWorkingCopy config) {
@ -360,19 +360,20 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
public void initializeFrom(ILaunchConfiguration config) { public void initializeFrom(ILaunchConfiguration config) {
try { try {
Map env = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map)null); Map env = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map) null);
if ( env != null ) { if (env != null) {
fElements.clear();
fElements.putAll(env); fElements.putAll(env);
fVariableList.refresh(); fVariableList.refresh();
updateButtons(); updateButtons();
} }
// config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_INHERIT, true); // config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_INHERIT, true);
} catch ( CoreException e ) { } catch (CoreException e) {
} }
} }
public void performApply(ILaunchConfigurationWorkingCopy config) { 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); config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_INHERIT, true);
} }