1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

- fixed API errors

This commit is contained in:
Alena Laskavaia 2010-04-22 17:52:00 +00:00
parent 4c2c31028a
commit e8775e724f
6 changed files with 62 additions and 46 deletions

View file

@ -59,6 +59,9 @@ public class Activator extends Plugin {
return PLUGIN_ID; return PLUGIN_ID;
} }
/**
* @since 6.0
*/
public static BundleContext getBundleContext() { public static BundleContext getBundleContext() {
return getDefault().getBundle().getBundleContext(); return getDefault().getBundle().getBundleContext();
} }

View file

@ -65,6 +65,7 @@ import org.eclipse.debug.core.ILaunchConfiguration;
* It adds Jtag hardware debugging specific steps to initialize remote target * It adds Jtag hardware debugging specific steps to initialize remote target
* and start the remote Jtag debugging. * and start the remote Jtag debugging.
* <p> * <p>
* @since 6.0
*/ */
public class GDBJtagDSFFinalLaunchSequence extends Sequence { public class GDBJtagDSFFinalLaunchSequence extends Sequence {

View file

@ -33,6 +33,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
* It extends the standard DSF/GDB launch delegate <code>GdbLaunchDelegate</code> * It extends the standard DSF/GDB launch delegate <code>GdbLaunchDelegate</code>
* but overrides the <code>getFinalLaunchSequence</code> method to return the Jtag * but overrides the <code>getFinalLaunchSequence</code> method to return the Jtag
* hardware debugging specific launch sequence. * hardware debugging specific launch sequence.
* @since 6.0
*/ */
@ThreadSafe @ThreadSafe
public class GDBJtagDSFLaunchConfigurationDelegate extends GdbLaunchDelegate { public class GDBJtagDSFLaunchConfigurationDelegate extends GdbLaunchDelegate {

View file

@ -12,6 +12,9 @@ package org.eclipse.cdt.debug.gdbjtag.ui;
import org.eclipse.cdt.launch.ui.CMainTab; import org.eclipse.cdt.launch.ui.CMainTab;
/**
* @since 6.0
*/
public class GDBJtagCDICMainTab extends CMainTab { public class GDBJtagCDICMainTab extends CMainTab {
public GDBJtagCDICMainTab() { public GDBJtagCDICMainTab() {

View file

@ -17,6 +17,9 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchDelegate; import org.eclipse.debug.core.ILaunchDelegate;
/**
* @since 6.0
*/
public class GDBJtagDSFCMainTab extends CMainTab { public class GDBJtagDSFCMainTab extends CMainTab {
public GDBJtagDSFCMainTab() { public GDBJtagDSFCMainTab() {

View file

@ -46,11 +46,14 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
/**
* @since 6.0
*/
public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
private static final String TAB_NAME = "Debugger"; private static final String TAB_NAME = "Debugger";
private static final String TAB_ID = "org.eclipse.cdt.debug.gdbjtag.ui.debuggertab.dsf"; private static final String TAB_ID = "org.eclipse.cdt.debug.gdbjtag.ui.debuggertab.dsf";
private Text gdbCommand; private Text gdbCommand;
private Button useRemote; private Button useRemote;
private Text ipAddress; private Text ipAddress;
@ -58,7 +61,6 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
private Combo jtagDevice; private Combo jtagDevice;
private String savedJtagDevice; private String savedJtagDevice;
public String getName() { public String getName() {
return TAB_NAME; return TAB_NAME;
} }
@ -66,7 +68,7 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
public Image getImage() { public Image getImage() {
return GDBJtagImages.getDebuggerTabImage(); return GDBJtagImages.getDebuggerTabImage();
} }
public void createControl(Composite parent) { public void createControl(Composite parent) {
ScrolledComposite sc = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL); ScrolledComposite sc = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
sc.setExpandHorizontal(true); sc.setExpandHorizontal(true);
@ -77,14 +79,14 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
sc.setContent(comp); sc.setContent(comp);
GridLayout layout = new GridLayout(); GridLayout layout = new GridLayout();
comp.setLayout(layout); comp.setLayout(layout);
Group group = new Group(comp, SWT.NONE); Group group = new Group(comp, SWT.NONE);
layout = new GridLayout(); layout = new GridLayout();
group.setLayout(layout); group.setLayout(layout);
GridData gd = new GridData(GridData.FILL_HORIZONTAL); GridData gd = new GridData(GridData.FILL_HORIZONTAL);
group.setLayoutData(gd); group.setLayoutData(gd);
group.setText(Messages.getString("GDBJtagDebuggerTab.gdbSetupGroup_Text")); group.setText(Messages.getString("GDBJtagDebuggerTab.gdbSetupGroup_Text"));
createCommandControl(group); createCommandControl(group);
createRemoteControl(comp); createRemoteControl(comp);
} }
@ -94,21 +96,18 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
dialog.setText(title); dialog.setText(title);
String str = text.getText().trim(); String str = text.getText().trim();
int lastSeparatorIndex = str.lastIndexOf(File.separator); int lastSeparatorIndex = str.lastIndexOf(File.separator);
if (lastSeparatorIndex != -1) if (lastSeparatorIndex != -1) dialog.setFilterPath(str.substring(0, lastSeparatorIndex));
dialog.setFilterPath(str.substring(0, lastSeparatorIndex));
str = dialog.open(); str = dialog.open();
if (str != null) if (str != null) text.setText(str);
text.setText(str);
} }
private void variablesButtonSelected(Text text) { private void variablesButtonSelected(Text text) {
StringVariableSelectionDialog dialog = new StringVariableSelectionDialog( StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
getShell());
if (dialog.open() == StringVariableSelectionDialog.OK) { if (dialog.open() == StringVariableSelectionDialog.OK) {
text.append(dialog.getVariableExpression()); text.append(dialog.getVariableExpression());
} }
} }
private void createCommandControl(Composite parent) { private void createCommandControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE); Composite comp = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(); GridLayout layout = new GridLayout();
@ -117,13 +116,13 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
GridData gd = new GridData(GridData.FILL_HORIZONTAL); GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 1; gd.horizontalSpan = 1;
comp.setLayoutData(gd); comp.setLayoutData(gd);
Label label = new Label(comp, SWT.NONE); Label label = new Label(comp, SWT.NONE);
label.setText(Messages.getString("GDBJtagDebuggerTab.gdbCommandLabel")); label.setText(Messages.getString("GDBJtagDebuggerTab.gdbCommandLabel"));
gd = new GridData(); gd = new GridData();
gd.horizontalSpan = 3; gd.horizontalSpan = 3;
label.setLayoutData(gd); label.setLayoutData(gd);
gdbCommand = new Text(comp, SWT.SINGLE | SWT.BORDER); gdbCommand = new Text(comp, SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL); gd = new GridData(GridData.FILL_HORIZONTAL);
gdbCommand.setLayoutData(gd); gdbCommand.setLayoutData(gd);
@ -140,7 +139,7 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
browseButtonSelected(Messages.getString("GDBJtagDebuggerTab.gdbCommandBrowse_Title"), gdbCommand); browseButtonSelected(Messages.getString("GDBJtagDebuggerTab.gdbCommandBrowse_Title"), gdbCommand);
} }
}); });
button = new Button(comp, SWT.NONE); button = new Button(comp, SWT.NONE);
button.setText(Messages.getString("GDBJtagDebuggerTab.gdbCommandVariable")); button.setText(Messages.getString("GDBJtagDebuggerTab.gdbCommandVariable"));
button.addSelectionListener(new SelectionAdapter() { button.addSelectionListener(new SelectionAdapter() {
@ -149,7 +148,7 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
} }
}); });
} }
private void createRemoteControl(Composite parent) { private void createRemoteControl(Composite parent) {
Group group = new Group(parent, SWT.NONE); Group group = new Group(parent, SWT.NONE);
GridLayout layout = new GridLayout(); GridLayout layout = new GridLayout();
@ -157,7 +156,7 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
GridData gd = new GridData(GridData.FILL_HORIZONTAL); GridData gd = new GridData(GridData.FILL_HORIZONTAL);
group.setLayoutData(gd); group.setLayoutData(gd);
group.setText(Messages.getString("GDBJtagDebuggerTab.remoteGroup_Text")); group.setText(Messages.getString("GDBJtagDebuggerTab.remoteGroup_Text"));
useRemote = new Button(group, SWT.CHECK); useRemote = new Button(group, SWT.CHECK);
useRemote.setText(Messages.getString("GDBJtagDebuggerTab.useRemote_Text")); useRemote.setText(Messages.getString("GDBJtagDebuggerTab.useRemote_Text"));
useRemote.addSelectionListener(new SelectionAdapter() { useRemote.addSelectionListener(new SelectionAdapter() {
@ -166,23 +165,23 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
updateLaunchConfigurationDialog(); updateLaunchConfigurationDialog();
} }
}); });
Composite comp = new Composite(group, SWT.NONE); Composite comp = new Composite(group, SWT.NONE);
layout = new GridLayout(); layout = new GridLayout();
layout.numColumns = 2; layout.numColumns = 2;
comp.setLayout(layout); comp.setLayout(layout);
Label label = new Label(comp, SWT.NONE); Label label = new Label(comp, SWT.NONE);
label.setText(Messages.getString("GDBJtagDebuggerTab.jtagDeviceLabel")); label.setText(Messages.getString("GDBJtagDebuggerTab.jtagDeviceLabel"));
jtagDevice = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN); jtagDevice = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN);
GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory. GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance()
getInstance().getGDBJtagDeviceContribution(); .getGDBJtagDeviceContribution();
for (int i = 0; i < availableDevices.length; i++) { for (int i = 0; i < availableDevices.length; i++) {
jtagDevice.add(availableDevices[i].getDeviceName()); jtagDevice.add(availableDevices[i].getDeviceName());
} }
jtagDevice.select(0); jtagDevice.select(0);
jtagDevice.addModifyListener(new ModifyListener() { jtagDevice.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) { public void modifyText(ModifyEvent e) {
@ -190,7 +189,7 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
updateLaunchConfigurationDialog(); updateLaunchConfigurationDialog();
} }
}); });
label = new Label(comp, SWT.NONE); label = new Label(comp, SWT.NONE);
label.setText(Messages.getString("GDBJtagDebuggerTab.ipAddressLabel")); label.setText(Messages.getString("GDBJtagDebuggerTab.ipAddressLabel"));
ipAddress = new Text(comp, SWT.BORDER); ipAddress = new Text(comp, SWT.BORDER);
@ -202,7 +201,7 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
updateLaunchConfigurationDialog(); updateLaunchConfigurationDialog();
} }
}); });
label = new Label(comp, SWT.NONE); label = new Label(comp, SWT.NONE);
label.setText(Messages.getString("GDBJtagDebuggerTab.portNumberLabel")); label.setText(Messages.getString("GDBJtagDebuggerTab.portNumberLabel"));
portNumber = new Text(comp, SWT.BORDER); portNumber = new Text(comp, SWT.BORDER);
@ -220,14 +219,12 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
} }
}); });
} }
/** /**
* @param text * @param text
*/ */
protected void updateDeviceIpPort(String selectedDeviceName) { protected void updateDeviceIpPort(String selectedDeviceName) {
if (selectedDeviceName.equals(savedJtagDevice)) { if (selectedDeviceName.equals(savedJtagDevice)) { return; }
return;
}
GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance() GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance()
.getGDBJtagDeviceContribution(); .getGDBJtagDeviceContribution();
IGDBJtagDevice selectedDevice = null; IGDBJtagDevice selectedDevice = null;
@ -253,22 +250,26 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
ipAddress.setEnabled(enabled); ipAddress.setEnabled(enabled);
portNumber.setEnabled(enabled); portNumber.setEnabled(enabled);
} }
public void initializeFrom(ILaunchConfiguration configuration) { public void initializeFrom(ILaunchConfiguration configuration) {
try { try {
String gdbCommandAttr = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT); String gdbCommandAttr = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME,
IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
gdbCommand.setText(gdbCommandAttr); gdbCommand.setText(gdbCommandAttr);
boolean useRemoteAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET); boolean useRemoteAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET,
IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET);
useRemote.setSelection(useRemoteAttr); useRemote.setSelection(useRemoteAttr);
useRemoteChanged(); useRemoteChanged();
String ipAddressAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS); String ipAddressAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS,
IGDBJtagConstants.DEFAULT_IP_ADDRESS);
ipAddress.setText(ipAddressAttr); ipAddress.setText(ipAddressAttr);
int portNumberAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER); int portNumberAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER,
IGDBJtagConstants.DEFAULT_PORT_NUMBER);
portNumber.setText(String.valueOf(portNumberAttr)); portNumber.setText(String.valueOf(portNumberAttr));
savedJtagDevice = configuration.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, ""); savedJtagDevice = configuration.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, "");
for (int i = 0; i < jtagDevice.getItemCount(); i++) { for (int i = 0; i < jtagDevice.getItemCount(); i++) {
if (jtagDevice.getItem(i).equals(savedJtagDevice)) { if (jtagDevice.getItem(i).equals(savedJtagDevice)) {
@ -278,7 +279,7 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
} catch (CoreException e) { } catch (CoreException e) {
Activator.getDefault().getLog().log(e.getStatus()); Activator.getDefault().getLog().log(e.getStatus());
} }
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -288,7 +289,7 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
public String getId() { public String getId() {
return TAB_ID; return TAB_ID;
} }
public void performApply(ILaunchConfigurationWorkingCopy configuration) { public void performApply(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbCommand.getText().trim()); configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbCommand.getText().trim());
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbCommand.getText().trim()); // DSF configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbCommand.getText().trim()); // DSF
@ -297,20 +298,24 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, useRemote.getSelection()); configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, useRemote.getSelection());
configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ipAddress.getText().trim()); configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ipAddress.getText().trim());
try { try {
configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, Integer.parseInt(portNumber.getText().trim())); configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, Integer
.parseInt(portNumber.getText().trim()));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, 0); configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, 0);
} }
} }
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT); configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME,
IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
CommandFactoryManager cfManager = MIPlugin.getDefault().getCommandFactoryManager(); CommandFactoryManager cfManager = MIPlugin.getDefault().getCommandFactoryManager();
CommandFactoryDescriptor defDesc = cfManager.getDefaultDescriptor(IGDBJtagConstants.DEBUGGER_ID); CommandFactoryDescriptor defDesc = cfManager.getDefaultDescriptor(IGDBJtagConstants.DEBUGGER_ID);
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, defDesc.getName()); configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, defDesc.getName());
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, defDesc.getMIVersions()[0]); configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, defDesc.getMIVersions()[0]);
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, IMILaunchConfigurationConstants.DEBUGGER_VERBOSE_MODE_DEFAULT); configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE,
configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET); IMILaunchConfigurationConstants.DEBUGGER_VERBOSE_MODE_DEFAULT);
configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET,
IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET);
configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS); configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS);
configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER); configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER);
} }