diff options
author | Mike Rennie | 2013-07-31 16:44:16 +0000 |
---|---|---|
committer | Mike Rennie | 2013-07-31 16:44:16 +0000 |
commit | d975f27f12707ae6598994c5e3c6bd5e271d46c4 (patch) | |
tree | c7d1b2b1a202e19c0c2ccaaff959f4dd25286f0d /org.eclipse.debug.examples.core/src/org | |
parent | 4fcde1ffaf34791bd406d47ce72d17e2801432a3 (diff) | |
download | eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.tar.gz eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.tar.xz eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.zip |
Bug 352626 - Move platform debug to Java 1.6 BREE
Diffstat (limited to 'org.eclipse.debug.examples.core/src/org')
61 files changed, 428 insertions, 233 deletions
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/ClockControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/ClockControl.java index f972867d8..242236705 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/ClockControl.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/ClockControl.java @@ -33,6 +33,7 @@ public class ClockControl extends TimeControl { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.midi.launcher.TimeControl#getTimeValue() */ + @Override protected long getTimeValue() { return getSequencer().getMicrosecondPosition(); } @@ -40,6 +41,7 @@ public class ClockControl extends TimeControl { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#isEditable() */ + @Override public boolean isEditable() { return true; } @@ -47,6 +49,7 @@ public class ClockControl extends TimeControl { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#setValue(java.lang.String) */ + @Override public IStatus setValue(String newValue) { try { long value = getLong(newValue); @@ -61,6 +64,7 @@ public class ClockControl extends TimeControl { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#validateValue(java.lang.String) */ + @Override public IStatus validateValue(String value) { try { getLong(value); diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/LengthControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/LengthControl.java index 01e63a6b9..3ab8d18c4 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/LengthControl.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/LengthControl.java @@ -28,6 +28,7 @@ public class LengthControl extends TimeControl { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.midi.launcher.TimeControl#getTimeValue() */ + @Override protected long getTimeValue() { return getSequencer().getMicrosecondLength(); } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java index 75801ecea..674e2fc49 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java @@ -85,6 +85,7 @@ public class MidiLaunch extends Launch implements ISuspendResume { /* (non-Javadoc) * @see org.eclipse.debug.core.Launch#canTerminate() */ + @Override public boolean canTerminate() { return getSequencer().isOpen(); } @@ -92,6 +93,7 @@ public class MidiLaunch extends Launch implements ISuspendResume { /* (non-Javadoc) * @see org.eclipse.debug.core.Launch#isTerminated() */ + @Override public boolean isTerminated() { if (fSequencer != null) { return !fSequencer.isOpen(); @@ -102,6 +104,7 @@ public class MidiLaunch extends Launch implements ISuspendResume { /* (non-Javadoc) * @see org.eclipse.debug.core.Launch#terminate() */ + @Override public void terminate() throws DebugException { getSequencer().stop(); getSequencer().close(); @@ -112,6 +115,7 @@ public class MidiLaunch extends Launch implements ISuspendResume { /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#canResume() */ + @Override public boolean canResume() { return isSuspended(); } @@ -119,6 +123,7 @@ public class MidiLaunch extends Launch implements ISuspendResume { /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() */ + @Override public boolean canSuspend() { if (fSequencer != null) { return fSequencer.isRunning(); @@ -129,6 +134,7 @@ public class MidiLaunch extends Launch implements ISuspendResume { /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() */ + @Override public boolean isSuspended() { if (fSequencer != null) { return fSequencer.isOpen() & !fSequencer.isRunning(); @@ -139,6 +145,7 @@ public class MidiLaunch extends Launch implements ISuspendResume { /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#resume() */ + @Override public void resume() throws DebugException { getSequencer().start(); fireChanged(); @@ -148,6 +155,7 @@ public class MidiLaunch extends Launch implements ISuspendResume { /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#suspend() */ + @Override public void suspend() throws DebugException { getSequencer().stop(); fireChanged(); diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunchDelegate.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunchDelegate.java index fbd531236..65123a55c 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunchDelegate.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunchDelegate.java @@ -67,6 +67,7 @@ public class MidiLaunchDelegate extends LaunchConfigurationDelegate { /* (non-Javadoc) * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor) */ + @Override public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { String excep = configuration.getAttribute(ATTR_THROW_EXCEPTION, (String)null); if (excep != null) { @@ -135,6 +136,7 @@ public class MidiLaunchDelegate extends LaunchConfigurationDelegate { /* (non-Javadoc) * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate2#getLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String) */ + @Override public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws CoreException { return new MidiLaunch(configuration, mode); } @@ -142,6 +144,7 @@ public class MidiLaunchDelegate extends LaunchConfigurationDelegate { /* (non-Javadoc) * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#buildForLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) */ + @Override public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException { return false; } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java index 3274582cc..c5b51ea6a 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java @@ -113,6 +113,7 @@ public abstract class SequencerControl { /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ + @Override public boolean equals(Object obj) { if (obj != null) { if (getClass().equals(obj.getClass())) { @@ -126,6 +127,7 @@ public abstract class SequencerControl { /* (non-Javadoc) * @see java.lang.Object#hashCode() */ + @Override public int hashCode() { return getSequencer().hashCode() + getClass().hashCode(); } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java index 28def4594..2980adc83 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java @@ -33,6 +33,7 @@ public class TempoControl extends SequencerControl { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#getValue() */ + @Override public String getValue() { float bpm = getSequencer().getTempoInBPM(); return Float.toString(bpm); @@ -41,6 +42,7 @@ public class TempoControl extends SequencerControl { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#isEditable() */ + @Override public boolean isEditable() { return getSequencer().isOpen(); } @@ -48,6 +50,7 @@ public class TempoControl extends SequencerControl { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#setValue(java.lang.String) */ + @Override public IStatus setValue(String newValue) { try { float value = getFloat(newValue); @@ -62,6 +65,7 @@ public class TempoControl extends SequencerControl { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#validateValue(java.lang.String) */ + @Override public IStatus validateValue(String value) { try { getFloat(value); diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java index 93aa54df4..4bcb85ac6 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java @@ -33,6 +33,7 @@ public abstract class TimeControl extends SequencerControl { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#getValue() */ + @Override public String getValue() { long position = getTimeValue(); int milli = (int) (position & 0x3F); @@ -67,6 +68,7 @@ public abstract class TimeControl extends SequencerControl { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#isEditable() */ + @Override public boolean isEditable() { return false; } @@ -74,6 +76,7 @@ public abstract class TimeControl extends SequencerControl { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#setValue(java.lang.String) */ + @Override public IStatus setValue(String newValue) { return null; } @@ -81,6 +84,7 @@ public abstract class TimeControl extends SequencerControl { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#validateValue(java.lang.String) */ + @Override public IStatus validateValue(String value) { return null; } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/DebugCorePlugin.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/DebugCorePlugin.java index dbdb1fc85..759f1088a 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/DebugCorePlugin.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/DebugCorePlugin.java @@ -71,6 +71,7 @@ public class DebugCorePlugin extends Plugin { /** * This method is called upon plug-in activation */ + @Override public void start(BundleContext context) throws Exception { super.start(context); } @@ -78,6 +79,7 @@ public class DebugCorePlugin extends Plugin { /** * This method is called when the plug-in is stopped */ + @Override public void stop(BundleContext context) throws Exception { super.stop(context); plugin = null; diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java index 41d3a9074..325402c7f 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java @@ -60,6 +60,7 @@ public class PDALineBreakpoint extends LineBreakpoint implements IPDAEventListen */ public PDALineBreakpoint(final IResource resource, final int lineNumber) throws CoreException { IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { IMarker marker = resource.createMarker("org.eclipse.debug.examples.core.pda.markerType.lineBreakpoint"); //$NON-NLS-1$ setMarker(marker); @@ -75,6 +76,7 @@ public class PDALineBreakpoint extends LineBreakpoint implements IPDAEventListen /* (non-Javadoc) * @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier() */ + @Override public String getModelIdentifier() { return DebugCorePlugin.ID_PDA_DEBUG_MODEL; } @@ -174,6 +176,7 @@ public class PDALineBreakpoint extends LineBreakpoint implements IPDAEventListen * * @see org.eclipse.debug.examples.core.pda.model.IPDAEventListener#handleEvent(java.lang.String) */ + @Override public void handleEvent(PDAEvent event) { if (event instanceof PDASuspendedEvent || event instanceof PDAVMSuspendedEvent) { PDARunControlEvent rcEvent = (PDARunControlEvent)event; diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java index 42705dd62..2d406d9d2 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java @@ -36,6 +36,7 @@ public class PDARunToLineBreakpoint extends PDALineBreakpoint { */ public PDARunToLineBreakpoint(final IFile resource, final int lineNumber) throws DebugException { IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { // associate with workspace root to avoid drawing in editor ruler IMarker marker = ResourcesPlugin.getWorkspace().getRoot().createMarker("org.eclipse.debug.examples.core.pda.markerType.lineBreakpoint"); //$NON-NLS-1$ @@ -55,6 +56,7 @@ public class PDARunToLineBreakpoint extends PDALineBreakpoint { * * @return whether this breakpoint is a run-to-line breakpoint */ + @Override public boolean isRunToLineBreakpoint() { return true; } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java index d3f7dc593..ce7c15226 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java @@ -65,6 +65,7 @@ public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint { */ public PDAWatchpoint(final IResource resource, final int lineNumber, final String functionName, final String varName, final boolean access, final boolean modification) throws CoreException { IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { IMarker marker = resource.createMarker("org.eclipse.debug.examples.core.pda.markerType.watchpoint"); //$NON-NLS-1$ setMarker(marker); @@ -83,42 +84,48 @@ public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IWatchpoint#isAccess() */ - public boolean isAccess() throws CoreException { + @Override + public boolean isAccess() throws CoreException { return getMarker().getAttribute(ACCESS, true); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IWatchpoint#setAccess(boolean) */ - public void setAccess(boolean access) throws CoreException { + @Override + public void setAccess(boolean access) throws CoreException { setAttribute(ACCESS, access); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IWatchpoint#isModification() */ - public boolean isModification() throws CoreException { + @Override + public boolean isModification() throws CoreException { return getMarker().getAttribute(MODIFICATION, true); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IWatchpoint#setModification(boolean) */ - public void setModification(boolean modification) throws CoreException { + @Override + public void setModification(boolean modification) throws CoreException { setAttribute(MODIFICATION, modification); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IWatchpoint#supportsAccess() */ - public boolean supportsAccess() { + @Override + public boolean supportsAccess() { return true; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IWatchpoint#supportsModification() */ - public boolean supportsModification() { + @Override + public boolean supportsModification() { return true; } @@ -175,6 +182,7 @@ public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.pda.breakpoints.PDALineBreakpoint#createRequest(org.eclipse.debug.examples.core.pda.model.PDADebugTarget) */ + @Override protected void createRequest(PDADebugTarget target) throws CoreException { int flag = 0; if (isAccess()) { @@ -189,6 +197,7 @@ public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.pda.breakpoints.PDALineBreakpoint#clearRequest(org.eclipse.debug.examples.core.pda.model.PDADebugTarget) */ + @Override protected void clearRequest(PDADebugTarget target) throws CoreException { target.sendCommand(new PDAWatchCommand(getFunctionName(), getVariableName(), 0)); } @@ -196,6 +205,7 @@ public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint { /* (non-Javadoc) * @see org.eclipse.debug.examples.core.pda.model.IPDAEventListener#handleEvent(java.lang.String) */ + @Override public void handleEvent(PDAEvent event) { if (event instanceof PDASuspendedEvent || event instanceof PDAVMSuspendedEvent) { PDARunControlEvent rcEvent = (PDARunControlEvent)event; diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java index 95c4c34d6..b4a2ecf73 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java @@ -44,22 +44,23 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate { /* (non-Javadoc) * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor) */ + @Override public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { //#ifdef ex1 //# // TODO: Exercise 1 - Launch a command shell as a system process to echo "foo" //#elseif ex1_answer //# Process process = DebugPlugin.exec(new String[]{"cmd", "/C", "\"echo foo\""}, null); //# new RuntimeProcess(launch, process, "Hello", null); - //#else - - List commandList = new ArrayList(); - + //#else + + List<String> commandList = new ArrayList<String>(); + // Get Java VM path String javaVMHome = System.getProperty("java.home"); //$NON-NLS-1$ String javaVMExec = javaVMHome + File.separatorChar + "bin" + File.separatorChar + "java"; //$NON-NLS-1$ //$NON-NLS-2$ if (File.separatorChar == '\\') { javaVMExec += ".exe"; //$NON-NLS-1$ - } + } File exe = new File(javaVMExec); if (!exe.exists()) { abort(MessageFormat.format("Specified java VM executable {0} does not exist.", new Object[]{javaVMExec}), null); //$NON-NLS-1$ @@ -68,7 +69,7 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate { commandList.add("-cp"); //$NON-NLS-1$ commandList.add(File.pathSeparator + DebugCorePlugin.getFileInPlugin(new Path("bin"))); //$NON-NLS-1$ - + commandList.add("org.eclipse.debug.examples.pdavm.PDAVirtualMachine"); //$NON-NLS-1$ // program name @@ -76,14 +77,14 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate { if (program == null) { abort("Perl program unspecified.", null); //$NON-NLS-1$ } - + IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(program)); if (!file.exists()) { - abort(MessageFormat.format("Perl program {0} does not exist.", new String[] {file.getFullPath().toString()}), null); //$NON-NLS-1$ + abort(MessageFormat.format("Perl program {0} does not exist.", new Object[] { file.getFullPath().toString() }), null); //$NON-NLS-1$ } - + commandList.add(file.getLocation().toOSString()); - + // if in debug mode, add debug arguments - i.e. '-debug requestPort eventPort' int requestPort = -1; int eventPort = -1; @@ -97,22 +98,22 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate { commandList.add("" + requestPort); //$NON-NLS-1$ commandList.add("" + eventPort); //$NON-NLS-1$ } - - String[] commandLine = (String[]) commandList.toArray(new String[commandList.size()]); + + String[] commandLine = commandList.toArray(new String[commandList.size()]); Process process = DebugPlugin.exec(commandLine, null); IProcess p = DebugPlugin.newProcess(launch, process, javaVMExec); - // if in debug mode, create a debug target + // if in debug mode, create a debug target if (mode.equals(ILaunchManager.DEBUG_MODE)) { IDebugTarget target = new PDADebugTarget(launch, p, requestPort, eventPort); launch.addDebugTarget(target); } //#endif } - + /** * Throws an exception with a new status containing the given * message and optional exception. - * + * * @param message error message * @param e underlying exception * @throws CoreException @@ -120,10 +121,10 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate { private void abort(String message, Throwable e) throws CoreException { throw new CoreException(new Status(IStatus.ERROR, DebugCorePlugin.PLUGIN_ID, 0, message, e)); } - + /** * Returns a free port number on localhost, or -1 if unable to find a free port. - * + * * @return a free port number on localhost, or -1 if unable to find a free port */ public static int findFreePort() { @@ -131,7 +132,7 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate { try { socket= new ServerSocket(0); return socket.getLocalPort(); - } catch (IOException e) { + } catch (IOException e) { } finally { if (socket != null) { try { @@ -140,13 +141,14 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate { } } } - return -1; - } - + return -1; + } + /* (non-Javadoc) * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#buildForLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) */ + @Override public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException { return false; - } + } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArray.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArray.java index 5107b2695..effe377c2 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArray.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArray.java @@ -30,6 +30,7 @@ public class PDAArray extends PDAValue { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValue#hasVariables() */ + @Override public boolean hasVariables() throws DebugException { return true; } @@ -37,6 +38,7 @@ public class PDAArray extends PDAValue { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValue#getVariables() */ + @Override public IVariable[] getVariables() throws DebugException { String string = getValueString(); String[] words = string.split("\\W+"); //$NON-NLS-1$ diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArrayEntry.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArrayEntry.java index 834198ebe..2c9dd55cb 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArrayEntry.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArrayEntry.java @@ -37,6 +37,7 @@ public class PDAArrayEntry extends PDADebugElement implements IVariable { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IVariable#getValue() */ + @Override public IValue getValue() throws DebugException { return fValue; } @@ -44,6 +45,7 @@ public class PDAArrayEntry extends PDADebugElement implements IVariable { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IVariable#getName() */ + @Override public String getName() throws DebugException { return "[" + fIndex + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } @@ -51,6 +53,7 @@ public class PDAArrayEntry extends PDADebugElement implements IVariable { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName() */ + @Override public String getReferenceTypeName() throws DebugException { return "String"; //$NON-NLS-1$ } @@ -58,6 +61,7 @@ public class PDAArrayEntry extends PDADebugElement implements IVariable { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IVariable#hasValueChanged() */ + @Override public boolean hasValueChanged() throws DebugException { return false; } @@ -65,18 +69,21 @@ public class PDAArrayEntry extends PDADebugElement implements IVariable { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String) */ + @Override public void setValue(String expression) throws DebugException { } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue) */ + @Override public void setValue(IValue value) throws DebugException { } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValueModification#supportsValueModification() */ + @Override public boolean supportsValueModification() { return false; } @@ -84,6 +91,7 @@ public class PDAArrayEntry extends PDADebugElement implements IVariable { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String) */ + @Override public boolean verifyValue(String expression) throws DebugException { return false; } @@ -91,6 +99,7 @@ public class PDAArrayEntry extends PDADebugElement implements IVariable { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue) */ + @Override public boolean verifyValue(IValue value) throws DebugException { return false; } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java index fb854ba15..f07fac187 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java @@ -39,6 +39,7 @@ public class PDADebugElement extends DebugElement { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier() */ + @Override public String getModelIdentifier() { return DebugCorePlugin.ID_PDA_DEBUG_MODEL; } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java index b5e4a0607..e024badf6 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2005, 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation * Bjorn Freeman-Benson - initial API and implementation @@ -67,41 +67,41 @@ import org.eclipse.debug.examples.core.pda.protocol.PDAVMTerminatedEvent; * PDA Debug Target */ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBreakpointManagerListener, IPDAEventListener { - + // associated system process (VM) private IProcess fProcess; - + // containing launch object private ILaunch fLaunch; - + // sockets to communicate with VM private Socket fRequestSocket; private PrintWriter fRequestWriter; private BufferedReader fRequestReader; private Socket fEventSocket; private BufferedReader fEventReader; - + // suspended state private boolean fVMSuspended = false; - + // terminated state private boolean fTerminated = false; - + // threads - private Map fThreads = Collections.synchronizedMap(new LinkedHashMap()); - + private Map<Integer, PDAThread> fThreads = Collections.synchronizedMap(new LinkedHashMap<Integer, PDAThread>()); + // event dispatch job private EventDispatchJob fEventDispatch; - + // event listeners - private List fEventListeners = Collections.synchronizedList(new ArrayList()); - + private List<IPDAEventListener> fEventListeners = Collections.synchronizedList(new ArrayList<IPDAEventListener>()); + /** - * Listens to events from the PDA VM and fires corresponding + * Listens to events from the PDA VM and fires corresponding * debug events. */ class EventDispatchJob extends Job { - + public EventDispatchJob() { super("PDA Event Dispatch"); //$NON-NLS-1$ setSystem(true); @@ -110,6 +110,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr /* (non-Javadoc) * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) */ + @Override protected IStatus run(IProgressMonitor monitor) { String message = ""; //$NON-NLS-1$ while (!isTerminated() && message != null) { @@ -127,7 +128,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr } Object[] listeners = fEventListeners.toArray(); for (int i = 0; i < listeners.length; i++) { - ((IPDAEventListener)listeners[i]).handleEvent(event); + ((IPDAEventListener)listeners[i]).handleEvent(event); } } } catch (IOException e) { @@ -136,14 +137,14 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr } return Status.OK_STATUS; } - + } - + /** * Registers the given event listener. The listener will be notified of * events in the program being interpretted. Has no effect if the listener * is already registered. - * + * * @param listener event listener */ public void addEventListener(IPDAEventListener listener) { @@ -153,21 +154,21 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr } } } - + /** * Deregisters the given event listener. Has no effect if the listener is * not currently registered. - * + * * @param listener event listener */ public void removeEventListener(IPDAEventListener listener) { fEventListeners.remove(listener); } - + /** - * Constructs a new debug target in the given launch for the + * Constructs a new debug target in the given launch for the * associated PDA VM process. - * + * * @param launch containing launch * @param process PDA VM * @param requestPort port to send requests to the VM @@ -214,32 +215,37 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr /* (non-Javadoc) * @see org.eclipse.debug.core.model.IDebugTarget#getProcess() */ + @Override public IProcess getProcess() { return fProcess; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IDebugTarget#getThreads() */ + @Override public IThread[] getThreads() throws DebugException { synchronized (fThreads) { - return (IThread[])fThreads.values().toArray(new IThread[fThreads.size()]); + return fThreads.values().toArray(new IThread[fThreads.size()]); } } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IDebugTarget#hasThreads() */ + @Override public boolean hasThreads() throws DebugException { return fThreads.size() > 0; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IDebugTarget#getName() */ + @Override public String getName() throws DebugException { return "PDA"; //$NON-NLS-1$ } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IDebugTarget#supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint) */ + @Override public boolean supportsBreakpoint(IBreakpoint breakpoint) { if (!isTerminated() && breakpoint.getModelIdentifier().equals(getModelIdentifier())) { try { @@ -261,40 +267,45 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr } } } catch (CoreException e) { - } + } } return false; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget() */ + @Override public IDebugTarget getDebugTarget() { return this; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IDebugElement#getLaunch() */ + @Override public ILaunch getLaunch() { return fLaunch; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ITerminate#canTerminate() */ + @Override public boolean canTerminate() { return getProcess().canTerminate(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ITerminate#isTerminated() */ + @Override public synchronized boolean isTerminated() { return fTerminated || getProcess().isTerminated(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ITerminate#terminate() */ + @Override public void terminate() throws DebugException { //#ifdef ex2 -//# // TODO: Exercise 2 - send termination request to interpreter +//# // TODO: Exercise 2 - send termination request to interpreter //#else sendCommand(new PDATerminateCommand()); //#endif @@ -302,39 +313,45 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#canResume() */ + @Override public boolean canResume() { return !isTerminated() && isSuspended(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() */ + @Override public boolean canSuspend() { return !isTerminated() && !isSuspended(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() */ + @Override public synchronized boolean isSuspended() { return !isTerminated() && fVMSuspended; } - + /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#resume() */ + @Override public void resume() throws DebugException { sendCommand(new PDAVMResumeCommand()); - } - + } + /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#suspend() */ + @Override public void suspend() throws DebugException { sendCommand(new PDAVMSuspendCommand()); } - + /* (non-Javadoc) * @see org.eclipse.debug.core.IBreakpointListener#breakpointAdded(org.eclipse.debug.core.model.IBreakpoint) */ + @Override public void breakpointAdded(IBreakpoint breakpoint) { if (supportsBreakpoint(breakpoint)) { try { @@ -349,6 +366,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr /* (non-Javadoc) * @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta) */ + @Override public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { if (supportsBreakpoint(breakpoint)) { try { @@ -361,6 +379,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr /* (non-Javadoc) * @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta) */ + @Override public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) { if (supportsBreakpoint(breakpoint)) { try { @@ -376,29 +395,34 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr /* (non-Javadoc) * @see org.eclipse.debug.core.model.IDisconnect#canDisconnect() */ + @Override public boolean canDisconnect() { return false; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IDisconnect#disconnect() */ + @Override public void disconnect() throws DebugException { } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IDisconnect#isDisconnected() */ + @Override public boolean isDisconnected() { return false; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#supportsStorageRetrieval() */ + @Override public boolean supportsStorageRetrieval() { return true; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long) */ + @Override public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException { return new PDAMemoryBlock(this, startAddress, length); } @@ -416,7 +440,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr } catch (DebugException e) { } } - + /** * Install breakpoints that are already registered with the breakpoint * manager. @@ -427,7 +451,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr breakpointAdded(breakpoints[i]); } } - + /** * Called when this debug target terminates. */ @@ -440,17 +464,17 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr fireTerminateEvent(); removeEventListener(this); } - + private void vmResumed(PDAVMResumedEvent event) { setVMSuspended(false); fireResumeEvent(calcDetail(event.fReason)); } - + private void vmSuspended(PDAVMSuspendedEvent event) { setVMSuspended(true); fireSuspendEvent(calcDetail(event.fReason)); } - + private int calcDetail(String reason) { if (reason.equals("breakpoint") || reason.equals("watch")) { //$NON-NLS-1$ //$NON-NLS-2$ return DebugEvent.BREAKPOINT; @@ -464,30 +488,30 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr return DebugEvent.BREAKPOINT; } else { return DebugEvent.UNSPECIFIED; - } + } } - + private void started(PDAStartedEvent event) { PDAThread newThread = new PDAThread(this, event.fThreadId); fThreads.put(new Integer(event.fThreadId), newThread); newThread.start(); } - + private void exited(PDAExitedEvent event) { - PDAThread thread = (PDAThread)fThreads.remove(new Integer(event.fThreadId)); + PDAThread thread = fThreads.remove(new Integer(event.fThreadId)); if (thread != null) { thread.exit(); } } - + private synchronized void setVMSuspended(boolean suspended) { fVMSuspended = suspended; } - + private synchronized void setTerminated(boolean terminated) { fTerminated = terminated; } - + /* (non-Javadoc) * @see org.eclipse.debug.examples.core.pda.model.PDADebugElement#sendRequest(java.lang.String) */ @@ -508,8 +532,9 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr } // Should never reach this satement. return null; - } - + } + + @Override public PDACommandResult sendCommand(PDACommand command) throws DebugException { String response = sendRequest(command.getRequest()); return command.createResult(response); @@ -519,6 +544,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr * When the breakpoint manager disables, remove all registered breakpoints * requests from the VM. When it enables, reinstall them. */ + @Override public void breakpointManagerEnablementChanged(boolean enabled) { IBreakpoint[] breakpoints = getBreakpointManager().getBreakpoints(getModelIdentifier()); for (int i = 0; i < breakpoints.length; i++) { @@ -528,11 +554,12 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr breakpointRemoved(breakpoints[i], null); } } - } + } /* (non-Javadoc) * @see org.eclipse.debug.examples.core.pda.model.IPDAEventListener#handleEvent(java.lang.String) */ + @Override public void handleEvent(PDAEvent event) { if (event instanceof PDAStartedEvent) { started((PDAStartedEvent)event); @@ -546,13 +573,13 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr vmSuspended((PDAVMSuspendedEvent)event); } else if (event instanceof PDAVMResumedEvent) { vmResumed((PDAVMResumedEvent)event); - } + } } - + /** * Returns this debug target's single thread, or <code>null</code> * if terminated. - * + * * @param threadId ID of the thread to return, or <code>0</code> * to return the first available thread * @return this debug target's single thread, or <code>null</code> @@ -560,24 +587,24 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr */ public PDAThread getThread(int threadId) { if (threadId > 0) { - return (PDAThread)fThreads.get(new Integer(threadId)); + return fThreads.get(new Integer(threadId)); } else { synchronized(fThreads) { if (fThreads.size() > 0) { - return (PDAThread)fThreads.values().iterator().next(); + return fThreads.values().iterator().next(); } } } return null; } - + /** * Restarts the current debug session - * + * * @throws DebugException */ public void restart() throws DebugException { sendCommand(new PDARestartCommand()); - } + } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAMemoryBlock.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAMemoryBlock.java index 616578131..394c7c1da 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAMemoryBlock.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAMemoryBlock.java @@ -42,6 +42,7 @@ public class PDAMemoryBlock extends PDADebugElement implements IMemoryBlock { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IMemoryBlock#getStartAddress() */ + @Override public long getStartAddress() { return fStart; } @@ -49,6 +50,7 @@ public class PDAMemoryBlock extends PDADebugElement implements IMemoryBlock { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IMemoryBlock#getLength() */ + @Override public long getLength() { return fLength; } @@ -56,6 +58,7 @@ public class PDAMemoryBlock extends PDADebugElement implements IMemoryBlock { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IMemoryBlock#getBytes() */ + @Override public byte[] getBytes() throws DebugException { return fBytes; } @@ -63,6 +66,7 @@ public class PDAMemoryBlock extends PDADebugElement implements IMemoryBlock { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IMemoryBlock#supportsValueModification() */ + @Override public boolean supportsValueModification() { return true; } @@ -70,6 +74,7 @@ public class PDAMemoryBlock extends PDADebugElement implements IMemoryBlock { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IMemoryBlock#setValue(long, byte[]) */ + @Override public void setValue(long offset, byte[] bytes) throws DebugException { int i = 0; long off = offset; diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java index b235690f3..24dfefcd2 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java @@ -65,30 +65,35 @@ public class PDAStackFrame extends PDADebugElement implements IStackFrame { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStackFrame#getThread() */ + @Override public IThread getThread() { return fThread; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStackFrame#getVariables() */ + @Override public IVariable[] getVariables() throws DebugException { return fThread.getVariables(this); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStackFrame#hasVariables() */ + @Override public boolean hasVariables() throws DebugException { return getVariables().length > 0; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStackFrame#getLineNumber() */ + @Override public int getLineNumber() throws DebugException { return fPC; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStackFrame#getCharStart() */ + @Override public int getCharStart() throws DebugException { return -1; } @@ -96,114 +101,133 @@ public class PDAStackFrame extends PDADebugElement implements IStackFrame { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStackFrame#getCharEnd() */ + @Override public int getCharEnd() throws DebugException { return -1; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStackFrame#getName() */ + @Override public String getName() throws DebugException { return fName; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups() */ + @Override public IRegisterGroup[] getRegisterGroups() throws DebugException { return null; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups() */ + @Override public boolean hasRegisterGroups() throws DebugException { return false; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#canStepInto() */ + @Override public boolean canStepInto() { return getThread().canStepInto(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#canStepOver() */ + @Override public boolean canStepOver() { return getThread().canStepOver(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#canStepReturn() */ + @Override public boolean canStepReturn() { return getThread().canStepReturn(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#isStepping() */ + @Override public boolean isStepping() { return getThread().isStepping(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#stepInto() */ + @Override public void stepInto() throws DebugException { getThread().stepInto(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#stepOver() */ + @Override public void stepOver() throws DebugException { getThread().stepOver(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#stepReturn() */ + @Override public void stepReturn() throws DebugException { getThread().stepReturn(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#canResume() */ + @Override public boolean canResume() { return getThread().canResume(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() */ + @Override public boolean canSuspend() { return getThread().canSuspend(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() */ + @Override public boolean isSuspended() { return getThread().isSuspended(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#resume() */ + @Override public void resume() throws DebugException { getThread().resume(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#suspend() */ + @Override public void suspend() throws DebugException { getThread().suspend(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ITerminate#canTerminate() */ + @Override public boolean canTerminate() { return getThread().canTerminate(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ITerminate#isTerminated() */ + @Override public boolean isTerminated() { return getThread().isTerminated(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ITerminate#terminate() */ + @Override public void terminate() throws DebugException { getThread().terminate(); } @@ -221,6 +245,7 @@ public class PDAStackFrame extends PDADebugElement implements IStackFrame { /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ + @Override public boolean equals(Object obj) { if (obj instanceof PDAStackFrame) { PDAStackFrame sf = (PDAStackFrame)obj; @@ -233,6 +258,7 @@ public class PDAStackFrame extends PDADebugElement implements IStackFrame { /* (non-Javadoc) * @see java.lang.Object#hashCode() */ + @Override public int hashCode() { return getSourceName().hashCode() + fId; } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java index a7909d485..4fc8e5289 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java @@ -46,38 +46,44 @@ public class PDAStackValue extends PDADebugElement implements IValue { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValue#getValueString() */ - public String getValueString() throws DebugException { + @Override + public String getValueString() throws DebugException { return fValue; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValue#isAllocated() */ - public boolean isAllocated() throws DebugException { + @Override + public boolean isAllocated() throws DebugException { return true; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValue#getVariables() */ - public IVariable[] getVariables() throws DebugException { + @Override + public IVariable[] getVariables() throws DebugException { return new IVariable[0]; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValue#hasVariables() */ - public boolean hasVariables() throws DebugException { + @Override + public boolean hasVariables() throws DebugException { return false; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName() */ - public String getReferenceTypeName() throws DebugException { + @Override + public String getReferenceTypeName() throws DebugException { return null; } /* * (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ - public boolean equals(Object obj) { + @Override + public boolean equals(Object obj) { return obj instanceof PDAStackValue && ((PDAStackValue)obj).fValue.equals(fValue) && ((PDAStackValue)obj).fIndex == fIndex; @@ -86,7 +92,8 @@ public class PDAStackValue extends PDADebugElement implements IValue { * (non-Javadoc) * @see java.lang.Object#hashCode() */ - public int hashCode() { + @Override + public int hashCode() { return super.hashCode() + fIndex; } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java index 409746bc3..c0798215d 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2005, 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation * Bjorn Freeman-Benson - initial API and implementation @@ -46,23 +46,23 @@ import org.eclipse.debug.examples.core.pda.protocol.PDAVMSuspendedEvent; * A PDA thread. A PDA VM is single threaded. */ public class PDAThread extends PDADebugElement implements IThread, IPDAEventListener { - + /** * ID of this thread as reported by PDA. */ private final int fThreadId; - + /** * Breakpoint this thread is suspended at or <code>null</code> * if none. */ private IBreakpoint fBreakpoint; - + /** * Whether this thread is stepping */ private boolean fStepping = false; - + /** * Whether this thread is suspended */ @@ -72,45 +72,46 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList * Most recent error event or <code>null</code> */ private String fErrorEvent; - + /** * Table mapping stack frames to current variables */ - private Map fVariables = Collections.synchronizedMap(new HashMap()); - + private Map<IStackFrame, IVariable[]> fVariables = Collections.synchronizedMap(new HashMap<IStackFrame, IVariable[]>()); + /** * Constructs a new thread for the given target - * + * * @param target VM */ public PDAThread(PDADebugTarget target, int threadId) { super(target); fThreadId = threadId; } - + /** * Called by the debug target after the thread is created. - * + * * @since 3.5 */ void start() { fireCreationEvent(); getPDADebugTarget().addEventListener(this); } - + /** * Called by the debug target before the thread is removed. - * + * * @since 3.5 */ void exit() { getPDADebugTarget().removeEventListener(this); fireTerminateEvent(); } - + /* (non-Javadoc) * @see org.eclipse.debug.core.model.IThread#getStackFrames() */ + @Override public IStackFrame[] getStackFrames() throws DebugException { if (isSuspended()) { PDAStackCommandResult result = (PDAStackCommandResult)sendCommand(new PDAStackCommand(fThreadId)); @@ -122,22 +123,25 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList } return new IStackFrame[0]; } - + /* (non-Javadoc) * @see org.eclipse.debug.core.model.IThread#hasStackFrames() */ + @Override public boolean hasStackFrames() throws DebugException { return isSuspended(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IThread#getPriority() */ + @Override public int getPriority() throws DebugException { return 0; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IThread#getTopStackFrame() */ + @Override public IStackFrame getTopStackFrame() throws DebugException { IStackFrame[] frames = getStackFrames(); if (frames.length > 0) { @@ -148,45 +152,50 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList /* (non-Javadoc) * @see org.eclipse.debug.core.model.IThread#getName() */ + @Override public String getName() { return "Main thread"; //$NON-NLS-1$ } - + /* (non-Javadoc) * @see org.eclipse.debug.core.model.IThread#getBreakpoints() */ + @Override public synchronized IBreakpoint[] getBreakpoints() { if (fBreakpoint == null) { return new IBreakpoint[0]; } return new IBreakpoint[]{fBreakpoint}; } - + /** * Notifies this thread it has been suspended by the given breakpoint. - * + * * @param breakpoint breakpoint */ public synchronized void suspendedBy(IBreakpoint breakpoint) { fBreakpoint = breakpoint; suspended(DebugEvent.BREAKPOINT); } - + /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#canResume() */ + @Override public boolean canResume() { return isSuspended() && !getDebugTarget().isSuspended(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() */ + @Override public boolean canSuspend() { return !isSuspended(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() */ + @Override public boolean isSuspended() { if (getDebugTarget().isTerminated()) { return false; @@ -201,9 +210,10 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#resume() */ + @Override public void resume() throws DebugException { //#ifdef ex2 -//# // TODO: Exercise 2 - send resume request to interpreter +//# // TODO: Exercise 2 - send resume request to interpreter //#else sendCommand(new PDAResumeCommand(fThreadId)); //#endif @@ -211,9 +221,10 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList /* (non-Javadoc) * @see org.eclipse.debug.core.model.ISuspendResume#suspend() */ + @Override public void suspend() throws DebugException { //#ifdef ex2 -//# // TODO: Exercise 2 - send suspend request to interpreter +//# // TODO: Exercise 2 - send suspend request to interpreter //#else sendCommand(new PDASuspendCommand(fThreadId)); //#endif @@ -221,74 +232,84 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#canStepInto() */ + @Override public boolean canStepInto() { return false; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#canStepOver() */ + @Override public boolean canStepOver() { return isSuspended(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#canStepReturn() */ + @Override public boolean canStepReturn() { return false; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#isStepping() */ + @Override public boolean isStepping() { return fStepping; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#stepInto() */ + @Override public void stepInto() throws DebugException { } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#stepOver() */ + @Override public void stepOver() throws DebugException { sendCommand(new PDAStepCommand(fThreadId)); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#stepReturn() */ + @Override public void stepReturn() throws DebugException { } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ITerminate#canTerminate() */ + @Override public boolean canTerminate() { return !isTerminated(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ITerminate#isTerminated() */ + @Override public boolean isTerminated() { return getDebugTarget().isTerminated(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.ITerminate#terminate() */ + @Override public void terminate() throws DebugException { getDebugTarget().terminate(); } - + /** * Sets whether this thread is stepping - * + * * @param stepping whether stepping */ private synchronized void setStepping(boolean stepping) { fStepping = stepping; } - + /** * Sets whether this thread is suspended - * + * * @param suspended whether suspended */ private synchronized void setSuspended(boolean suspended) { @@ -298,7 +319,7 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList /** * Sets the most recent error event encountered, or <code>null</code> * to clear the most recent error - * + * * @param event one of 'unimpinstr' or 'nosuchlabel' or <code>null</code> */ private synchronized void setError(String event) { @@ -308,7 +329,7 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList /** * Returns the most recent error event encountered since the last * suspend, or <code>null</code> if none. - * + * * @return the most recent error event encountered since the last * suspend, or <code>null</code> if none */ @@ -319,13 +340,14 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList /* (non-Javadoc) * @see org.eclipse.debug.examples.core.pda.model.IPDAEventListener#handleEvent(java.lang.String) */ + @Override public void handleEvent(PDAEvent _event) { if (_event instanceof PDARunControlEvent && fThreadId == ((PDARunControlEvent)_event).fThreadId) { PDARunControlEvent event = (PDARunControlEvent)_event; // clear previous state fBreakpoint = null; setStepping(false); - + // handle events if (event instanceof PDAResumedEvent || event instanceof PDAVMResumedEvent) { setSuspended(false); @@ -335,7 +357,7 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList //#ifdef ex2 //# } //# // TODO: Exercise 2 - handle/fire "client" resume event - //#else + //#else } else if ("client".equals(event.fReason)) { //$NON-NLS-1$ resumed(DebugEvent.CLIENT_REQUEST); } @@ -363,7 +385,7 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList suspended(DebugEvent.STEP_END); } else if ("event".equals(event.fReason) && getError() != null) { //$NON-NLS-1$ exceptionHit(); - } + } //#endif //#ifdef ex5 //# // TODO: Exercise 5 - handle end of drop event @@ -373,19 +395,19 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList } //#endif } else if (_event instanceof PDANoSuchLabelEvent || - _event instanceof PDAUnimplementedInstructionEvent) + _event instanceof PDAUnimplementedInstructionEvent) { setError(event.fMessage); } - } + } } - + /** * Notification the target has resumed for the given reason. * Clears any error condition that was last encountered and * fires a resume event, and clears all cached variables * for stack frames. - * + * * @param detail reason for the resume */ private void resumed(int detail) { @@ -393,10 +415,10 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList fVariables.clear(); fireResumeEvent(detail); } - + /** * Notification the target has suspended for the given reason - * + * * @param detail reason for the suspend */ private void suspended(int detail) { @@ -409,12 +431,12 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList */ private void exceptionHit() { suspended(DebugEvent.BREAKPOINT); - } - + } + /** * Sets the current variables for the given stack frame. Called * by PDA stack frame when it is created. - * + * * @param frame * @param variables */ @@ -423,49 +445,49 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList fVariables.put(frame, variables); } } - + /** * Returns the current variables for the given stack frame, or * <code>null</code> if none. - * + * * @param frame stack frame * @return variables or <code>null</code> */ protected IVariable[] getVariables(IStackFrame frame) { synchronized (fVariables) { - IVariable[] variables = (IVariable[]) fVariables.get(frame); + IVariable[] variables = fVariables.get(frame); if (variables == null) { return new IVariable[0]; } return variables; } } - + /** * Pops the top frame off the callstack. * * @throws DebugException - * + * * @since 3.5 */ public void popFrame() throws DebugException { //#ifdef ex5 -//# // TODO: Exercise 5 - send drop request +//# // TODO: Exercise 5 - send drop request //#else sendCommand(new PDADropFrameCommand(fThreadId)); //#endif } - + /** * Returns whether this thread can pop the top stack frame. * * @return whether this thread can pop the top stack frame - * + * * @since 3.5 */ public boolean canPopFrame() { //#ifdef ex5 -//# // TODO: Exercise 5 - allow pop if there is more than 1 frame on the stack +//# // TODO: Exercise 5 - allow pop if there is more than 1 frame on the stack //#else try { return getStackFrames().length > 1; @@ -474,12 +496,12 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList //#endif return false; } - + /** * Returns the values on the data stack (top down) - * + * * @return the values on the data stack (top down) - * + * * @since 3.5 */ public IValue[] getDataStack() throws DebugException { @@ -491,14 +513,14 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList } return values; } - return new IValue[0]; + return new IValue[0]; } - + /** * Returns whether popping the data stack is currently permitted - * + * * @return whether popping the data stack is currently permitted - * + * * @since 3.5 */ public boolean canPopData() { @@ -508,13 +530,13 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList } return false; } - + /** * Pops and returns the top of the data stack - * - * @return the top value on the stack + * + * @return the top value on the stack * @throws DebugException if the stack is empty or the request fails - * + * * @since 3.5 */ public IValue popData() throws DebugException { @@ -526,24 +548,24 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList requestFailed("Empty stack", null); //$NON-NLS-1$ return null; } - + /** * Returns whether pushing a value is currently supported. - * + * * @return whether pushing a value is currently supported - * + * * @since 3.5 */ public boolean canPushData() { return !isTerminated() && isSuspended(); } - + /** * Pushes a value onto the stack. - * + * * @param value value to push * @throws DebugException on failure - * + * * @since 3.5 */ public void pushData(String value) throws DebugException { @@ -552,9 +574,9 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList /** * Returns this thread's unique identifier - * + * * @return this thread's unique identifier - * + * * @since 3.5 */ public int getIdentifier() { diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java index 81a92db29..620f7ac83 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java @@ -35,6 +35,7 @@ public class PDAValue extends PDADebugElement implements IValue { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName() */ + @Override public String getReferenceTypeName() throws DebugException { try { Integer.parseInt(fValue); @@ -46,18 +47,21 @@ public class PDAValue extends PDADebugElement implements IValue { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValue#getValueString() */ + @Override public String getValueString() throws DebugException { return fValue; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValue#isAllocated() */ + @Override public boolean isAllocated() throws DebugException { return true; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValue#getVariables() */ + @Override public IVariable[] getVariables() throws DebugException { PDAStackFrame frame = fVariable.getStackFrame(); PDAListResult result = (PDAListResult) sendCommand( @@ -72,6 +76,7 @@ public class PDAValue extends PDADebugElement implements IValue { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValue#hasVariables() */ + @Override public boolean hasVariables() throws DebugException { if (getVariables().length != 0) { return true; @@ -85,14 +90,16 @@ public class PDAValue extends PDADebugElement implements IValue { * (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ - public boolean equals(Object obj) { + @Override + public boolean equals(Object obj) { return obj instanceof PDAValue && ((PDAValue)obj).fValue.equals(fValue); } /* * (non-Javadoc) * @see java.lang.Object#hashCode() */ - public int hashCode() { + @Override + public int hashCode() { return fValue.hashCode(); } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java index 08ca276be..3745028e1 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java @@ -46,6 +46,7 @@ public class PDAVariable extends PDADebugElement implements IVariable { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IVariable#getValue() */ + @Override public IValue getValue() throws DebugException { PDACommandResult result = sendCommand(new PDAVarCommand( fFrame.getThreadIdentifier(), getStackFrame().getIdentifier(), getName())); @@ -55,24 +56,28 @@ public class PDAVariable extends PDADebugElement implements IVariable { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IVariable#getName() */ + @Override public String getName() throws DebugException { return fName; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName() */ + @Override public String getReferenceTypeName() throws DebugException { return "Thing"; //$NON-NLS-1$ } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IVariable#hasValueChanged() */ + @Override public boolean hasValueChanged() throws DebugException { return false; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String) */ + @Override public void setValue(String expression) throws DebugException { sendCommand(new PDASetVarCommand( fFrame.getThreadIdentifier(), getStackFrame().getIdentifier(), getName(), expression)); @@ -81,23 +86,27 @@ public class PDAVariable extends PDADebugElement implements IVariable { /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue) */ + @Override public void setValue(IValue value) throws DebugException { } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValueModification#supportsValueModification() */ + @Override public boolean supportsValueModification() { return true; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String) */ + @Override public boolean verifyValue(String expression) throws DebugException { return true; } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue) */ + @Override public boolean verifyValue(IValue value) throws DebugException { return false; } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/WordStructureDelegate.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/WordStructureDelegate.java index ccc6b2647..2d218e08f 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/WordStructureDelegate.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/WordStructureDelegate.java @@ -24,6 +24,7 @@ public class WordStructureDelegate implements ILogicalStructureTypeDelegate { /* (non-Javadoc) * @see org.eclipse.debug.core.model.ILogicalStructureTypeDelegate#providesLogicalStructure(org.eclipse.debug.core.model.IValue) */ + @Override public boolean providesLogicalStructure(IValue value) { //#ifdef ex6 //# // TODO: Exercise 6 - provide logical structures if the value has multiple words @@ -41,6 +42,7 @@ public class WordStructureDelegate implements ILogicalStructureTypeDelegate { /* (non-Javadoc) * @see org.eclipse.debug.core.model.ILogicalStructureTypeDelegate#getLogicalStructure(org.eclipse.debug.core.model.IValue) */ + @Override public IValue getLogicalStructure(IValue value) throws CoreException { //#ifdef ex6 //# // TODO: Exercise 6 - create an array from the given value diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java index 6a8caaa19..b36e3dbcf 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Wind River Systems - initial API and implementation * IBM Corporation - bug fixing @@ -17,24 +17,24 @@ import java.util.StringTokenizer; /** * Object representing a bit field in the stack command results. - * - * @see PDARegistersCommand + * + * @see PDARegistersCommand */ public class PDABitFieldData { final public String fName; final public int fOffset; final public int fCount; - final public Map fMnemonics; - + final public Map<String, String> fMnemonics; + PDABitFieldData(String bitFieldString) { StringTokenizer st = new StringTokenizer(bitFieldString, " "); //$NON-NLS-1$ - + fName = st.nextToken(); fOffset = Integer.parseInt(st.nextToken()); fCount = Integer.parseInt(st.nextToken()); - - fMnemonics = new LinkedHashMap(0); + + fMnemonics = new LinkedHashMap<String, String>(0); while (st.hasMoreTokens()) { fMnemonics.put(st.nextToken(), st.nextToken()); } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java index 9886a920a..9d9339b75 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java @@ -29,7 +29,8 @@ public class PDAChildrenCommand extends PDACommand { super("children " + threadId + " " + frameId + " " + name); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDAListResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java index 76f688bf4..20eba643f 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java @@ -26,7 +26,8 @@ public class PDAClearBreakpointCommand extends PDACommand { super("clear " + line); //$NON-NLS-1$ } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java index 61cc412e1..e82630f1a 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java @@ -30,7 +30,8 @@ public class PDADataCommand extends PDACommand { super("data " + threadId); //$NON-NLS-1$ } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDAListResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java index 1d77bbe79..9777ff94c 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java @@ -39,7 +39,8 @@ public class PDADropFrameCommand extends PDACommand { super("drop " + threadId); //$NON-NLS-1$ } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java index 50f79cf26..499a9dd0a 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java @@ -38,7 +38,8 @@ public class PDAEvalCommand extends PDACommand { super("eval " + threadId + " " + operation); //$NON-NLS-1$ //$NON-NLS-2$ } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java index 713723eea..b96060fda 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java @@ -43,7 +43,8 @@ public class PDAEventStopCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java index 3c30b3bfb..92fb11de8 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java @@ -31,7 +31,8 @@ public class PDAFrameCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDAFrameCommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java index 01cfbf4cd..d3c5ab8d7 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Wind River Systems - initial API and implementation * IBM Corporation - bug fixing @@ -20,8 +20,8 @@ import org.eclipse.core.runtime.Path; /** * Object representing a frame in the stack command results. - * - * @see PDAStackCommand + * + * @see PDAStackCommand */ public class PDAFrameData { @@ -30,18 +30,18 @@ public class PDAFrameData { final public int fPC; final public String fFunction; final public String[] fVariables; - + PDAFrameData(String frameString) { StringTokenizer st = new StringTokenizer(frameString, "|"); //$NON-NLS-1$ - + fFilePath = new Path(st.nextToken()); fPC = Integer.parseInt(st.nextToken()); fFunction = st.nextToken(); - - List variablesList = new ArrayList(); + + List<String> variablesList = new ArrayList<String>(); while (st.hasMoreTokens()) { variablesList.add(st.nextToken()); } - fVariables = (String[])variablesList.toArray(new String[variablesList.size()]); + fVariables = variablesList.toArray(new String[variablesList.size()]); } }
\ No newline at end of file diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java index bf503d461..fb405b32c 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java @@ -28,7 +28,8 @@ public class PDAGroupsCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDAListResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java index 99199a5e9..e2b9a38ae 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Wind River Systems - initial API and implementation * IBM Corporation - bug fixing @@ -21,24 +21,24 @@ import java.util.StringTokenizer; */ public class PDAListResult extends PDACommandResult { - + final public String[] fValues; - + PDAListResult(String response) { super(response); StringTokenizer st = new StringTokenizer(response, "|"); //$NON-NLS-1$ - List valuesList = new ArrayList(); - + List<String> valuesList = new ArrayList<String>(); + while (st.hasMoreTokens()) { String token = st.nextToken(); if (token.length() != 0) { valuesList.add(token); } } - + fValues = new String[valuesList.size()]; for (int i = 0; i < valuesList.size(); i++) { - fValues[i] = (String)valuesList.get(i); + fValues[i] = valuesList.get(i); } } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java index c90b0b600..d96681c5a 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java @@ -32,7 +32,8 @@ public class PDANoSuchLabelEvent extends PDAEvent { return message.startsWith("no such label"); //$NON-NLS-1$ } - protected String getName(String message) { + @Override + protected String getName(String message) { if (isEventMessage(message)) { return "no such label"; //$NON-NLS-1$ } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java index c181a2971..1e3726c25 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java @@ -29,7 +29,8 @@ public class PDAPopDataCommand extends PDACommand { super("popdata " + threadId); //$NON-NLS-1$ } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java index c6ff895c6..fd3ccd8d1 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java @@ -31,7 +31,8 @@ public class PDAPushDataCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java index 05a12cd5e..27c1874d2 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java @@ -4,9 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Wind River Systems - initial API and implementation + * IBM Corporation - bug fixing *******************************************************************************/ package org.eclipse.debug.examples.core.pda.protocol; @@ -16,8 +17,8 @@ import java.util.StringTokenizer; /** * Object representing a register in the registers command results. - * - * @see PDARCommand + * + * @see PDARCommand */ public class PDARegisterData { @@ -25,19 +26,19 @@ public class PDARegisterData { final public String fName; final public boolean fWritable; final public PDABitFieldData[] fBitFields; - + PDARegisterData(String regString) { StringTokenizer st = new StringTokenizer(regString, "|"); //$NON-NLS-1$ - + String regInfo = st.nextToken(); StringTokenizer regSt = new StringTokenizer(regInfo, " "); //$NON-NLS-1$ fName = regSt.nextToken(); fWritable = Boolean.getBoolean(regSt.nextToken()); - - List bitFieldsList = new ArrayList(); + + List<PDABitFieldData> bitFieldsList = new ArrayList<PDABitFieldData>(); while (st.hasMoreTokens()) { bitFieldsList.add(new PDABitFieldData(st.nextToken())); } - fBitFields = (PDABitFieldData[])bitFieldsList.toArray(new PDABitFieldData[bitFieldsList.size()]); + fBitFields = bitFieldsList.toArray(new PDABitFieldData[bitFieldsList.size()]); } }
\ No newline at end of file diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java index 0592d6b56..045df225d 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java @@ -28,7 +28,8 @@ public class PDARegistersCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDARegistersCommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java index a53bac5e2..7eabe8af4 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Wind River Systems - initial API and implementation * IBM Corporation - bug fixing @@ -21,20 +21,20 @@ import java.util.StringTokenizer; */ public class PDARegistersCommandResult extends PDACommandResult { - + /** - * Array of registers returned by the registers commands. + * Array of registers returned by the registers commands. */ final public PDARegisterData[] fRegisters; - + PDARegistersCommandResult(String response) { super(response); StringTokenizer st = new StringTokenizer(response, "#"); //$NON-NLS-1$ - List regList = new ArrayList(); - + List<PDARegisterData> regList = new ArrayList<PDARegisterData>(); + while (st.hasMoreTokens()) { regList.add(new PDARegisterData(st.nextToken())); } - fRegisters = (PDARegisterData[])regList.toArray(new PDARegisterData[regList.size()]); + fRegisters = regList.toArray(new PDARegisterData[regList.size()]); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java index 6f518e9fe..29bfc78f3 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java @@ -30,7 +30,8 @@ public class PDARestartCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java index 657860137..64bac76a2 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java @@ -35,7 +35,8 @@ public class PDAResumeCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java index 3f507d1e4..c9e10a762 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java @@ -58,7 +58,8 @@ public class PDARunControlEvent extends PDAEvent { return message.substring(idx, endIdx); } - protected String getName(String message) { + @Override + protected String getName(String message) { int nameEnd = message.indexOf(' '); nameEnd = nameEnd == -1 ? message.length() : nameEnd; return message.substring(0, nameEnd); diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java index a5223a916..4459ebc2f 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java @@ -41,7 +41,8 @@ public class PDASetBreakpointCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java index 85ed35ae4..c6f5278bc 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java @@ -31,7 +31,8 @@ public class PDASetDataCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java index ac7dde342..c32570a6a 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java @@ -33,7 +33,8 @@ public class PDASetVarCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java index 92cd55bbc..836f5d6a9 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java @@ -34,7 +34,8 @@ public class PDAStackCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDAStackCommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java index b98bcba70..dfc583266 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Wind River Systems - initial API and implementation * IBM Corporation - bug fixing @@ -21,21 +21,21 @@ import java.util.StringTokenizer; */ public class PDAStackCommandResult extends PDACommandResult { - + /** - * Array of frames return by the stack commands. The frames are ordered + * Array of frames return by the stack commands. The frames are ordered * with the highest-level frame first. */ final public PDAFrameData[] fFrames; - + PDAStackCommandResult(String response) { super(response); StringTokenizer st = new StringTokenizer(response, "#"); //$NON-NLS-1$ - List framesList = new ArrayList(); - + List<PDAFrameData> framesList = new ArrayList<PDAFrameData>(); + while (st.hasMoreTokens()) { framesList.add(new PDAFrameData(st.nextToken())); } - fFrames = (PDAFrameData[])framesList.toArray(new PDAFrameData[framesList.size()]); + fFrames = framesList.toArray(new PDAFrameData[framesList.size()]); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java index 3b6abfa82..f30db3c68 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java @@ -31,7 +31,8 @@ public class PDAStackDepthCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDAStackDepthCommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java index 5a5124ef1..f767ba746 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java @@ -40,7 +40,8 @@ public class PDAStepCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java index 973c93e53..443513878 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java @@ -41,7 +41,8 @@ public class PDAStepReturnCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java index cba45439d..2100c4b11 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java @@ -35,7 +35,8 @@ public class PDASuspendCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java index 55db441ec..4f4ad3932 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java @@ -29,7 +29,8 @@ public class PDATerminateCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java index c6a593322..90e0103e9 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java @@ -33,7 +33,8 @@ public class PDAUnimplementedInstructionEvent extends PDAEvent { return message.startsWith("unimplemented instruction"); //$NON-NLS-1$ } - protected String getName(String message) { + @Override + protected String getName(String message) { if (isEventMessage(message)) { return "unimplemented instruction"; //$NON-NLS-1$ } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java index 83bb95d6e..43c726ed0 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java @@ -32,7 +32,8 @@ public class PDAVMResumeCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java index 88f7d5dd8..d65d07dd0 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java @@ -32,7 +32,8 @@ public class PDAVMSuspendCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java index b81302b79..cab160251 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java @@ -34,7 +34,8 @@ public class PDAVarCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java index c3b88cf64..1440049ff 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java @@ -38,7 +38,8 @@ public class PDAWatchCommand extends PDACommand { } - public PDACommandResult createResult(String resultText) { + @Override + public PDACommandResult createResult(String resultText) { return new PDACommandResult(resultText); } } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupDirector.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupDirector.java index f975cf7c3..83b1bc57a 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupDirector.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupDirector.java @@ -22,6 +22,7 @@ public class PDASourceLookupDirector extends AbstractSourceLookupDirector { /* (non-Javadoc) * @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupDirector#initializeParticipants() */ + @Override public void initializeParticipants() { //#ifdef ex4 //# // TODO: Exercise 4 - add our participant to this director diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupParticipant.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupParticipant.java index 0d07ce78d..7326ad37c 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupParticipant.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupParticipant.java @@ -24,6 +24,7 @@ public class PDASourceLookupParticipant extends AbstractSourceLookupParticipant /* (non-Javadoc) * @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupParticipant#getSourceName(java.lang.Object) */ + @Override public String getSourceName(Object object) throws CoreException { //#ifdef ex4 //# // TODO: Exercise 4 - return the name of the source file for the given stack frame diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourcePathComputerDelegate.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourcePathComputerDelegate.java index d91b3f245..208a5a4b4 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourcePathComputerDelegate.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourcePathComputerDelegate.java @@ -39,6 +39,7 @@ public class PDASourcePathComputerDelegate implements ISourcePathComputerDelegat /* (non-Javadoc) * @see org.eclipse.debug.internal.core.sourcelookup.ISourcePathComputerDelegate#computeSourceContainers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.runtime.IProgressMonitor) */ + @Override public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException { String path = configuration.getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null); ISourceContainer sourceContainer = null; |