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,6 +46,9 @@ 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";
@ -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;
} }
@ -94,16 +96,13 @@ 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());
} }
@ -177,8 +176,8 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
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());
} }
@ -225,9 +224,7 @@ 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;
@ -256,17 +253,21 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
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, "");
@ -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);
} }