1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +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
* 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;
public class CDebuggerTab extends AbstractCDebuggerTab {
protected Combo fDCombo;
protected Button fStopInMain;
protected Button fAttachButton;
protected Button fRunButton;
protected Button fVarBookKeeping;
private final boolean DEFAULT_STOP_AT_MAIN = true;
public void createControl(Composite parent) {
GridData gd;
Composite comp = new Composite(parent, SWT.NONE);
setControl(comp);
GridLayout topLayout = new GridLayout(2, false);
comp.setLayout(topLayout);
Label dlabel = new Label(comp, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
comp.setLayout(layout);
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:");
fDCombo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY);
fDCombo = new Combo(comboComp, SWT.DROP_DOWN | SWT.READ_ONLY);
fDCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateComboFromSelection();
@ -56,10 +64,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
radioLayout.marginHeight = 0;
radioLayout.marginWidth = 0;
radioComp.setLayout(radioLayout);
gd = new GridData();
gd.horizontalSpan = 2;
radioComp.setLayoutData(gd);
fRunButton = createRadioButton(radioComp, "Run program in debugger");
fRunButton = createRadioButton(radioComp, "Run program in debugger.");
fRunButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (fRunButton.getSelection() == true) {
@ -70,24 +75,37 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
updateLaunchConfigurationDialog();
}
});
fAttachButton = createRadioButton(radioComp, "Attach to running process");
fAttachButton = createRadioButton(radioComp, "Attach to running process.");
fAttachButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
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() {
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
gd = new GridData();
gd.horizontalSpan = 2;
fStopInMain.setLayoutData(gd);
fVarBookKeeping = new Button(optionComp, SWT.CHECK);
fVarBookKeeping.setText("Enable variable bookkeeping.");
fVarBookKeeping.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
Group debuggerGroup = new Group(comp, SWT.SHADOW_ETCHED_IN);
debuggerGroup.setText("Debugger Options");
setDynamicTabHolder(debuggerGroup);
@ -176,6 +194,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
super.setDefaults(config);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, DEFAULT_STOP_AT_MAIN);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false);
config.setAttribute(
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
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) {
fStopInMain.setSelection(true);
}
if (config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false) == true) {
fVarBookKeeping.setSelection(true);
}
} catch (CoreException e) {
return;
}
@ -211,6 +233,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
if (isValid(config)) {
super.performApply(config);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, fVarBookKeeping.getSelection());
if (fAttachButton.getSelection() == true) {
config.setAttribute(
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,

View file

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

View file

@ -11,7 +11,6 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.model.CoreModel;
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.ICProject;
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.viewers.ILabelProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
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.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
@ -156,8 +157,7 @@ public class CMainTab extends CLaunchConfigurationTab {
String projectName = EMPTY_STRING;
try {
projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, EMPTY_STRING);
}
catch (CoreException ce) {
} catch (CoreException ce) {
LaunchUIPlugin.log(ce);
}
fProjText.setText(projectName);
@ -167,8 +167,7 @@ public class CMainTab extends CLaunchConfigurationTab {
String programName = EMPTY_STRING;
try {
programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EMPTY_STRING);
}
catch (CoreException ce) {
} catch (CoreException ce) {
LaunchUIPlugin.log(ce);
}
fProgText.setText(programName);
@ -194,11 +193,9 @@ public class CMainTab extends CLaunchConfigurationTab {
"Project must first be entered before searching for a program");
return;
}
IBinary[] executables = getBinaryFiles(getCProject());
ILabelProvider labelProvider = new CElementLabelProvider();
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
dialog.setElements(executables);
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
dialog.setElements(getBinaryFiles(getCProject()));
dialog.setMessage("Choose a &program to run");
dialog.setTitle("Program Selection");
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
* we can find.
*/
protected IBinary[] getBinaryFiles(ICProject cproject) {
return cproject.getBinaryContainer().getBinaries();
protected IBinary[] getBinaryFiles(final ICProject cproject) {
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 {
cdesciptor = CCorePlugin.getDefault().getCProjectDescription((IProject) cproject[i].getResource());
String projectPlatform = cdesciptor.getPlatform();
if (filterPlatform.equals("*") || projectPlatform.equals("*") ||
(isNative && cdesciptor.getPlatform().equalsIgnoreCase("native"))
if (filterPlatform.equals("*")
|| projectPlatform.equals("*")
|| (isNative && cdesciptor.getPlatform().equalsIgnoreCase("native"))
|| filterPlatform.equalsIgnoreCase(cdesciptor.getPlatform()) == true) {
list.add(cproject[i]);
}
}
catch (CoreException e) {
} catch (CoreException e) {
e.printStackTrace();
}
}
@ -346,8 +356,8 @@ public class CMainTab extends CLaunchConfigurationTab {
cElement = getContext(config, getPlatform(config));
if (cElement != null) {
initializeCProject(cElement, config);
initializeProgramName(cElement, config);
}
initializeProgramName(cElement, config);
}
/**
@ -356,8 +366,7 @@ public class CMainTab extends CLaunchConfigurationTab {
protected void initializeProgramName(ICElement cElement, ILaunchConfigurationWorkingCopy config) {
IBinary binary = null;
if (cElement instanceof ICProject) {
IBinaryContainer bc = ((ICProject) cElement).getBinaryContainer();
IBinary[] bins = bc.getBinaries();
IBinary[] bins = getBinaryFiles((ICProject) cElement);
if (bins.length == 1) {
binary = bins[0];
}
@ -374,6 +383,9 @@ public class CMainTab extends CLaunchConfigurationTab {
}
name = getLaunchConfigurationDialog().generateName(name);
config.rename(name);
} else {
String name = getLaunchConfigurationDialog().generateName(cElement.getElementName());
config.rename(name);
}
}
/**