1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

see change log - David Inglis 2003-06-26

This commit is contained in:
David Inglis 2003-06-26 14:53:11 +00:00
parent 87e8a2b4d3
commit 75881ff48b
4 changed files with 85 additions and 38 deletions

View file

@ -1,3 +1,16 @@
2003-06-26 David Inglis
* src/org/eclipse/cdt/launch/ui/CDebuggerTab.java
Added variable book-keeping option in config.
* src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java (getContext)
Returns an ICElement even if CDescriptor does not exsist.
* src/org/eclipse/cdt/launch/ui/CMainTab.java
Use BusyIndicator when getting binary list from project
fixed problem with prefilling a new config when the project did not have a CDescriptor
2003-04-17 Alain Magloire 2003-04-17 Alain Magloire
* src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortCut.java: * src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortCut.java:

View file

@ -30,21 +30,29 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
public class CDebuggerTab extends AbstractCDebuggerTab { public class CDebuggerTab extends AbstractCDebuggerTab {
protected Combo fDCombo; protected Combo fDCombo;
protected Button fStopInMain; protected Button fStopInMain;
protected Button fAttachButton; protected Button fAttachButton;
protected Button fRunButton; protected Button fRunButton;
protected Button fVarBookKeeping;
private final boolean DEFAULT_STOP_AT_MAIN = true; private final boolean DEFAULT_STOP_AT_MAIN = true;
public void createControl(Composite parent) { public void createControl(Composite parent) {
GridData gd; GridData gd;
Composite comp = new Composite(parent, SWT.NONE); Composite comp = new Composite(parent, SWT.NONE);
setControl(comp); setControl(comp);
GridLayout topLayout = new GridLayout(2, false); GridLayout layout = new GridLayout(2, false);
comp.setLayout(topLayout); comp.setLayout(layout);
Label dlabel = new Label(comp, SWT.NONE);
Composite comboComp = new Composite(comp, SWT.NONE);
layout = new GridLayout(2, false);
comboComp.setLayout(layout);
Label dlabel = new Label(comboComp, SWT.NONE);
dlabel.setText("Debugger:"); dlabel.setText("Debugger:");
fDCombo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY); fDCombo = new Combo(comboComp, SWT.DROP_DOWN | SWT.READ_ONLY);
fDCombo.addModifyListener(new ModifyListener() { fDCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) { public void modifyText(ModifyEvent e) {
updateComboFromSelection(); updateComboFromSelection();
@ -56,10 +64,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
radioLayout.marginHeight = 0; radioLayout.marginHeight = 0;
radioLayout.marginWidth = 0; radioLayout.marginWidth = 0;
radioComp.setLayout(radioLayout); radioComp.setLayout(radioLayout);
gd = new GridData(); fRunButton = createRadioButton(radioComp, "Run program in debugger.");
gd.horizontalSpan = 2;
radioComp.setLayoutData(gd);
fRunButton = createRadioButton(radioComp, "Run program in debugger");
fRunButton.addSelectionListener(new SelectionAdapter() { fRunButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
if (fRunButton.getSelection() == true) { if (fRunButton.getSelection() == true) {
@ -70,23 +75,36 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
updateLaunchConfigurationDialog(); updateLaunchConfigurationDialog();
} }
}); });
fAttachButton = createRadioButton(radioComp, "Attach to running process"); fAttachButton = createRadioButton(radioComp, "Attach to running process.");
fAttachButton.addSelectionListener(new SelectionAdapter() { fAttachButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog(); updateLaunchConfigurationDialog();
} }
}); });
fStopInMain = new Button(comp, SWT.CHECK);
fStopInMain.setText("Stop at main() on startup"); Composite optionComp = new Composite(comp, SWT.NONE);
layout = new GridLayout(2, false);
optionComp.setLayout(layout);
gd = new GridData();
gd.horizontalSpan = 2;
optionComp.setLayoutData(gd);
fStopInMain = new Button(optionComp, SWT.CHECK);
fStopInMain.setText("Stop at main() on startup.");
fStopInMain.addSelectionListener(new SelectionAdapter() { fStopInMain.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog(); updateLaunchConfigurationDialog();
} }
}); });
gd = new GridData();
gd.horizontalSpan = 2; fVarBookKeeping = new Button(optionComp, SWT.CHECK);
fStopInMain.setLayoutData(gd); fVarBookKeeping.setText("Enable variable bookkeeping.");
fVarBookKeeping.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
Group debuggerGroup = new Group(comp, SWT.SHADOW_ETCHED_IN); Group debuggerGroup = new Group(comp, SWT.SHADOW_ETCHED_IN);
debuggerGroup.setText("Debugger Options"); debuggerGroup.setText("Debugger Options");
@ -176,6 +194,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
public void setDefaults(ILaunchConfigurationWorkingCopy config) { public void setDefaults(ILaunchConfigurationWorkingCopy config) {
super.setDefaults(config); super.setDefaults(config);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, DEFAULT_STOP_AT_MAIN); config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, DEFAULT_STOP_AT_MAIN);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false);
config.setAttribute( config.setAttribute(
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN); ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
@ -202,6 +221,9 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
if (config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, DEFAULT_STOP_AT_MAIN) == true) { if (config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, DEFAULT_STOP_AT_MAIN) == true) {
fStopInMain.setSelection(true); fStopInMain.setSelection(true);
} }
if (config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false) == true) {
fVarBookKeeping.setSelection(true);
}
} catch (CoreException e) { } catch (CoreException e) {
return; return;
} }
@ -211,6 +233,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
if (isValid(config)) { if (isValid(config)) {
super.performApply(config); super.performApply(config);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false); config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, fVarBookKeeping.getSelection());
if (fAttachButton.getSelection() == true) { if (fAttachButton.getSelection() == true) {
config.setAttribute( config.setAttribute(
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,

View file

@ -77,15 +77,14 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
ICDescriptor descriptor; ICDescriptor descriptor;
try { try {
descriptor = CCorePlugin.getDefault().getCProjectDescription(((ICElement) obj).getCProject().getProject()); descriptor = CCorePlugin.getDefault().getCProjectDescription(((ICElement) obj).getCProject().getProject());
}
catch (CoreException e) {
return null;
}
String projectPlatform = descriptor.getPlatform(); String projectPlatform = descriptor.getPlatform();
if (!projectPlatform.equals(platform) && !projectPlatform.equals("*")) { if (!projectPlatform.equals(platform) && !projectPlatform.equals("*")) {
obj = null; obj = null;
} }
} }
catch (CoreException e) {
}
}
if (obj != null) { if (obj != null) {
if (programName == null || programName.equals("")) { if (programName == null || programName.equals("")) {
return (ICElement) obj; return (ICElement) obj;

View file

@ -11,7 +11,6 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor; import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IBinary; import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.IBinaryContainer;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
@ -27,6 +26,7 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
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.SelectionAdapter;
@ -36,6 +36,7 @@ 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;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ElementListSelectionDialog; import org.eclipse.ui.dialogs.ElementListSelectionDialog;
@ -156,8 +157,7 @@ public class CMainTab extends CLaunchConfigurationTab {
String projectName = EMPTY_STRING; String projectName = EMPTY_STRING;
try { try {
projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, EMPTY_STRING); projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, EMPTY_STRING);
} } catch (CoreException ce) {
catch (CoreException ce) {
LaunchUIPlugin.log(ce); LaunchUIPlugin.log(ce);
} }
fProjText.setText(projectName); fProjText.setText(projectName);
@ -167,8 +167,7 @@ public class CMainTab extends CLaunchConfigurationTab {
String programName = EMPTY_STRING; String programName = EMPTY_STRING;
try { try {
programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EMPTY_STRING); programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EMPTY_STRING);
} } catch (CoreException ce) {
catch (CoreException ce) {
LaunchUIPlugin.log(ce); LaunchUIPlugin.log(ce);
} }
fProgText.setText(programName); fProgText.setText(programName);
@ -194,11 +193,9 @@ public class CMainTab extends CLaunchConfigurationTab {
"Project must first be entered before searching for a program"); "Project must first be entered before searching for a program");
return; return;
} }
IBinary[] executables = getBinaryFiles(getCProject());
ILabelProvider labelProvider = new CElementLabelProvider(); ILabelProvider labelProvider = new CElementLabelProvider();
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider); ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
dialog.setElements(executables); dialog.setElements(getBinaryFiles(getCProject()));
dialog.setMessage("Choose a &program to run"); dialog.setMessage("Choose a &program to run");
dialog.setTitle("Program Selection"); dialog.setTitle("Program Selection");
if (dialog.open() == ElementListSelectionDialog.OK) { if (dialog.open() == ElementListSelectionDialog.OK) {
@ -211,8 +208,21 @@ public class CMainTab extends CLaunchConfigurationTab {
* Iterate through and suck up all of the executable files that * Iterate through and suck up all of the executable files that
* we can find. * we can find.
*/ */
protected IBinary[] getBinaryFiles(ICProject cproject) { protected IBinary[] getBinaryFiles(final ICProject cproject) {
return cproject.getBinaryContainer().getBinaries(); final Display display;
if ( getShell() == null ) {
display = LaunchUIPlugin.getShell().getDisplay();
} else {
display = getShell().getDisplay();
}
final Object[] ret = new Object[1];
BusyIndicator.showWhile(display, new Runnable() {
public void run() {
ret[0] = cproject.getBinaryContainer().getBinaries();
}
});
return (IBinary[])ret[0];
} }
/** /**
@ -268,13 +278,13 @@ public class CMainTab extends CLaunchConfigurationTab {
try { try {
cdesciptor = CCorePlugin.getDefault().getCProjectDescription((IProject) cproject[i].getResource()); cdesciptor = CCorePlugin.getDefault().getCProjectDescription((IProject) cproject[i].getResource());
String projectPlatform = cdesciptor.getPlatform(); String projectPlatform = cdesciptor.getPlatform();
if (filterPlatform.equals("*") || projectPlatform.equals("*") || if (filterPlatform.equals("*")
(isNative && cdesciptor.getPlatform().equalsIgnoreCase("native")) || projectPlatform.equals("*")
|| (isNative && cdesciptor.getPlatform().equalsIgnoreCase("native"))
|| filterPlatform.equalsIgnoreCase(cdesciptor.getPlatform()) == true) { || filterPlatform.equalsIgnoreCase(cdesciptor.getPlatform()) == true) {
list.add(cproject[i]); list.add(cproject[i]);
} }
} } catch (CoreException e) {
catch (CoreException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -346,9 +356,9 @@ public class CMainTab extends CLaunchConfigurationTab {
cElement = getContext(config, getPlatform(config)); cElement = getContext(config, getPlatform(config));
if (cElement != null) { if (cElement != null) {
initializeCProject(cElement, config); initializeCProject(cElement, config);
}
initializeProgramName(cElement, config); initializeProgramName(cElement, config);
} }
}
/** /**
* Set the program name attributes on the working copy based on the ICElement * Set the program name attributes on the working copy based on the ICElement
@ -356,8 +366,7 @@ public class CMainTab extends CLaunchConfigurationTab {
protected void initializeProgramName(ICElement cElement, ILaunchConfigurationWorkingCopy config) { protected void initializeProgramName(ICElement cElement, ILaunchConfigurationWorkingCopy config) {
IBinary binary = null; IBinary binary = null;
if (cElement instanceof ICProject) { if (cElement instanceof ICProject) {
IBinaryContainer bc = ((ICProject) cElement).getBinaryContainer(); IBinary[] bins = getBinaryFiles((ICProject) cElement);
IBinary[] bins = bc.getBinaries();
if (bins.length == 1) { if (bins.length == 1) {
binary = bins[0]; binary = bins[0];
} }
@ -374,6 +383,9 @@ public class CMainTab extends CLaunchConfigurationTab {
} }
name = getLaunchConfigurationDialog().generateName(name); name = getLaunchConfigurationDialog().generateName(name);
config.rename(name); config.rename(name);
} else {
String name = getLaunchConfigurationDialog().generateName(cElement.getElementName());
config.rename(name);
} }
} }
/** /**