Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugElement.java')
-rw-r--r--org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugElement.java286
1 files changed, 172 insertions, 114 deletions
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugElement.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugElement.java
index 0a5c5c5ad..1e207f6e8 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugElement.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugElement.java
@@ -9,7 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.debug.core.model;
-
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -34,36 +34,39 @@ import com.sun.jdi.event.EventSet;
import com.sun.jdi.request.EventRequest;
import com.sun.jdi.request.EventRequestManager;
-public abstract class JDIDebugElement extends DebugElement implements IDisconnect {
-
+public abstract class JDIDebugElement extends DebugElement implements
+ IDisconnect {
+
/**
- * Creates a JDI debug element associated with the
- * specified debug target.
+ * Creates a JDI debug element associated with the specified debug target.
*
- * @param target The associated debug target
+ * @param target
+ * The associated debug target
*/
public JDIDebugElement(JDIDebugTarget target) {
- super(target);
+ super(target);
}
/**
* Convenience method to log errors
*/
protected void logError(Exception e) {
- if (!((JDIDebugTarget)getDebugTarget()).isAvailable()) {
+ if (!((JDIDebugTarget) getDebugTarget()).isAvailable()) {
// Don't log VMDisconnectedExceptions that occur
// when the VM is unavailable.
- if (e instanceof VMDisconnectedException ||
- (e instanceof CoreException && ((CoreException)e).getStatus().getException() instanceof VMDisconnectedException)) {
+ if (e instanceof VMDisconnectedException
+ || (e instanceof CoreException && ((CoreException) e)
+ .getStatus().getException() instanceof VMDisconnectedException)) {
return;
}
}
JDIDebugPlugin.log(e);
}
-
+
/**
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
+ @Override
public Object getAdapter(Class adapter) {
if (adapter == IDebugElement.class) {
return this;
@@ -82,7 +85,7 @@ public abstract class JDIDebugElement extends DebugElement implements IDisconnec
}
return super.getAdapter(adapter);
}
-
+
/**
* @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
*/
@@ -91,66 +94,86 @@ public abstract class JDIDebugElement extends DebugElement implements IDisconnec
}
/**
- * Queues a debug event with the event dispatcher to be fired
- * as an event set when all event processing is complete.
+ * Queues a debug event with the event dispatcher to be fired as an event
+ * set when all event processing is complete.
*
- * @param event the event to queue
- * @param set the event set the event is associated with
+ * @param event
+ * the event to queue
+ * @param set
+ * the event set the event is associated with
*/
public void queueEvent(DebugEvent event, EventSet set) {
- EventDispatcher dispatcher = ((JDIDebugTarget)getDebugTarget()).getEventDispatcher();
+ EventDispatcher dispatcher = ((JDIDebugTarget) getDebugTarget())
+ .getEventDispatcher();
if (dispatcher != null) {
dispatcher.queue(event, set);
}
}
/**
- * Fires a debug event marking the SUSPEND of this element with
- * the associated detail.
+ * Fires a debug event marking the SUSPEND of this element with the
+ * associated detail.
*
- * @param detail The int detail of the event
+ * @param detail
+ * The int detail of the event
* @see org.eclipse.debug.core.DebugEvent
*/
+ @Override
public void fireSuspendEvent(int detail) {
- getJavaDebugTarget().incrementSuspendCount(detail);
+ getJavaDebugTarget().incrementSuspendCount(detail);
super.fireSuspendEvent(detail);
}
-
+
/**
- * Queues a debug event marking the SUSPEND of this element with
- * the associated detail.
+ * Queues a debug event marking the SUSPEND of this element with the
+ * associated detail.
*
- * @param detail The int detail of the event
- * @param set the event set the event is associated with
+ * @param detail
+ * The int detail of the event
+ * @param set
+ * the event set the event is associated with
* @see org.eclipse.debug.core.DebugEvent
*/
public void queueSuspendEvent(int detail, EventSet set) {
- getJavaDebugTarget().incrementSuspendCount(detail);
+ getJavaDebugTarget().incrementSuspendCount(detail);
queueEvent(new DebugEvent(this, DebugEvent.SUSPEND, detail), set);
}
-
+
/**
- * Throws a new debug exception with a status code of <code>REQUEST_FAILED</code>.
+ * Throws a new debug exception with a status code of
+ * <code>REQUEST_FAILED</code>.
*
- * @param message Failure message
- * @param e Exception that has occurred (<code>can be null</code>)
- * @throws DebugException The exception with a status code of <code>REQUEST_FAILED</code>
+ * @param message
+ * Failure message
+ * @param e
+ * Exception that has occurred (<code>can be null</code>)
+ * @throws DebugException
+ * The exception with a status code of
+ * <code>REQUEST_FAILED</code>
*/
- public void requestFailed(String message, Exception e) throws DebugException {
+ public void requestFailed(String message, Exception e)
+ throws DebugException {
requestFailed(message, e, DebugException.REQUEST_FAILED);
}
-
+
/**
- * Throws a new debug exception with a status code of <code>TARGET_REQUEST_FAILED</code>
- * with the given underlying exception. If the underlying exception is not a JDI
- * exception, the original exception is thrown.
+ * Throws a new debug exception with a status code of
+ * <code>TARGET_REQUEST_FAILED</code> with the given underlying exception.
+ * If the underlying exception is not a JDI exception, the original
+ * exception is thrown.
*
- * @param message Failure message
- * @param e underlying exception that has occurred
- * @throws DebugException The exception with a status code of <code>TARGET_REQUEST_FAILED</code>
+ * @param message
+ * Failure message
+ * @param e
+ * underlying exception that has occurred
+ * @throws DebugException
+ * The exception with a status code of
+ * <code>TARGET_REQUEST_FAILED</code>
*/
- public void targetRequestFailed(String message, RuntimeException e) throws DebugException {
- if (e == null || e.getClass().getName().startsWith("com.sun.jdi") || e instanceof TimeoutException) { //$NON-NLS-1$
+ public void targetRequestFailed(String message, RuntimeException e)
+ throws DebugException {
+ if (e == null
+ || e.getClass().getName().startsWith("com.sun.jdi") || e instanceof TimeoutException) { //$NON-NLS-1$
requestFailed(message, e, DebugException.TARGET_REQUEST_FAILED);
} else {
throw e;
@@ -160,66 +183,88 @@ public abstract class JDIDebugElement extends DebugElement implements IDisconnec
/**
* Throws a new debug exception with the given status code.
*
- * @param message Failure message
- * @param e Exception that has occurred (<code>can be null</code>)
- * @param code status code
- * @throws DebugException a new exception with given status code
+ * @param message
+ * Failure message
+ * @param e
+ * Exception that has occurred (<code>can be null</code>)
+ * @param code
+ * status code
+ * @throws DebugException
+ * a new exception with given status code
*/
- public void requestFailed(String message, Throwable e, int code) throws DebugException {
+ public void requestFailed(String message, Throwable e, int code)
+ throws DebugException {
throwDebugException(message, code, e);
}
-
+
/**
- * Throws a new debug exception with a status code of <code>TARGET_REQUEST_FAILED</code>.
+ * Throws a new debug exception with a status code of
+ * <code>TARGET_REQUEST_FAILED</code>.
*
- * @param message Failure message
- * @param e Throwable that has occurred
- * @throws DebugException The exception with a status code of <code>TARGET_REQUEST_FAILED</code>
+ * @param message
+ * Failure message
+ * @param e
+ * Throwable that has occurred
+ * @throws DebugException
+ * The exception with a status code of
+ * <code>TARGET_REQUEST_FAILED</code>
*/
- public void targetRequestFailed(String message, Throwable e) throws DebugException {
+ public void targetRequestFailed(String message, Throwable e)
+ throws DebugException {
throwDebugException(message, DebugException.TARGET_REQUEST_FAILED, e);
}
-
+
/**
- * Throws a new debug exception with a status code of <code>TARGET_REQUEST_FAILED</code>
- * with the given underlying exception. The underlying exception is an exception thrown
- * by a JDI request.
+ * Throws a new debug exception with a status code of
+ * <code>TARGET_REQUEST_FAILED</code> with the given underlying exception.
+ * The underlying exception is an exception thrown by a JDI request.
*
- * @param message Failure message
- * @param e throwable exception that has occurred
- * @throws DebugException the exception with a status code of <code>TARGET_REQUEST_FAILED</code>
+ * @param message
+ * Failure message
+ * @param e
+ * throwable exception that has occurred
+ * @throws DebugException
+ * the exception with a status code of
+ * <code>TARGET_REQUEST_FAILED</code>
*/
- public void jdiRequestFailed(String message, Throwable e) throws DebugException {
+ public void jdiRequestFailed(String message, Throwable e)
+ throws DebugException {
throwDebugException(message, DebugException.TARGET_REQUEST_FAILED, e);
- }
-
+ }
+
/**
- * Throws a new debug exception with a status code of <code>NOT_SUPPORTED</code>.
+ * Throws a new debug exception with a status code of
+ * <code>NOT_SUPPORTED</code>.
*
- * @param message Failure message
- * @throws DebugException The exception with a status code of <code>NOT_SUPPORTED</code>.
+ * @param message
+ * Failure message
+ * @throws DebugException
+ * The exception with a status code of
+ * <code>NOT_SUPPORTED</code>.
*/
public void notSupported(String message) throws DebugException {
throwDebugException(message, DebugException.NOT_SUPPORTED, null);
}
-
+
/**
- * Throws a debug exception with the given message, error code, and underlying
- * exception.
+ * Throws a debug exception with the given message, error code, and
+ * underlying exception.
*/
- protected void throwDebugException(String message, int code, Throwable exception) throws DebugException {
- if(exception instanceof VMDisconnectedException) {
+ protected void throwDebugException(String message, int code,
+ Throwable exception) throws DebugException {
+ if (exception instanceof VMDisconnectedException) {
disconnected();
}
- throw new DebugException(new Status(IStatus.ERROR, JDIDebugModel.getPluginIdentifier(),
- code, message, exception));
+ throw new DebugException(new Status(IStatus.ERROR,
+ JDIDebugModel.getPluginIdentifier(), code, message, exception));
}
-
+
/**
- * Logs the given exception if it is a JDI exception, otherwise throws the
+ * Logs the given exception if it is a JDI exception, otherwise throws the
* runtime exception.
*
- * @param e The internal runtime exception
+ * @param e
+ * The internal runtime exception
*/
public void internalError(RuntimeException e) {
if (e.getClass().getName().startsWith("com.sun.jdi") || e instanceof TimeoutException) { //$NON-NLS-1$
@@ -228,16 +273,18 @@ public abstract class JDIDebugElement extends DebugElement implements IDisconnec
throw e;
}
}
-
+
/**
- * Logs a debug exception with the given message,
- * with a status code of <code>INTERNAL_ERROR</code>.
+ * Logs a debug exception with the given message, with a status code of
+ * <code>INTERNAL_ERROR</code>.
*
- * @param message The internal error message
+ * @param message
+ * The internal error message
*/
protected void internalError(String message) {
- logError(new DebugException(new Status(IStatus.ERROR, JDIDebugModel.getPluginIdentifier(),
- DebugException.INTERNAL_ERROR, message, null)));
+ logError(new DebugException(new Status(IStatus.ERROR,
+ JDIDebugModel.getPluginIdentifier(),
+ DebugException.INTERNAL_ERROR, message, null)));
}
/**
@@ -246,17 +293,16 @@ public abstract class JDIDebugElement extends DebugElement implements IDisconnec
* @return the unknown String
*/
protected String getUnknownMessage() {
- return JDIDebugModelMessages.JDIDebugElement_unknown;
+ return JDIDebugModelMessages.JDIDebugElement_unknown;
}
-
+
/**
- * Returns this elements debug target as its implementation
- * class.
+ * Returns this elements debug target as its implementation class.
*
* @return Java debug target
*/
public JDIDebugTarget getJavaDebugTarget() {
- return (JDIDebugTarget)getDebugTarget();
+ return (JDIDebugTarget) getDebugTarget();
}
/**
@@ -266,9 +312,9 @@ public abstract class JDIDebugElement extends DebugElement implements IDisconnec
* @return target VM or <code>null</code> if none
*/
protected VirtualMachine getVM() {
- return ((JDIDebugTarget)getDebugTarget()).getVM();
+ return ((JDIDebugTarget) getDebugTarget()).getVM();
}
-
+
/**
* Returns the underlying VM's event request manager, or <code>null</code>
* if none (disconnected/terminated)
@@ -282,38 +328,46 @@ public abstract class JDIDebugElement extends DebugElement implements IDisconnec
}
return vm.eventRequestManager();
}
-
+
/**
- * Adds the given listener to this target's event dispatcher's
- * table of listeners for the specified event request. The listener
- * will be notified each time the event occurs.
+ * Adds the given listener to this target's event dispatcher's table of
+ * listeners for the specified event request. The listener will be notified
+ * each time the event occurs.
*
- * @param listener the listener to register
- * @param request the event request
+ * @param listener
+ * the listener to register
+ * @param request
+ * the event request
*/
- public void addJDIEventListener(IJDIEventListener listener, EventRequest request) {
- EventDispatcher dispatcher = ((JDIDebugTarget)getDebugTarget()).getEventDispatcher();
+ public void addJDIEventListener(IJDIEventListener listener,
+ EventRequest request) {
+ EventDispatcher dispatcher = ((JDIDebugTarget) getDebugTarget())
+ .getEventDispatcher();
if (dispatcher != null) {
dispatcher.addJDIEventListener(listener, request);
}
}
-
+
/**
- * Removes the given listener from this target's event dispatcher's
- * table of listeners for the specifed event request. The listener
- * will no longer be notified when the event occurs. Listeners
- * are responsible for deleting the event request if desired.
+ * Removes the given listener from this target's event dispatcher's table of
+ * listeners for the specifed event request. The listener will no longer be
+ * notified when the event occurs. Listeners are responsible for deleting
+ * the event request if desired.
*
- * @param listener the listener to remove
- * @param request the event request
+ * @param listener
+ * the listener to remove
+ * @param request
+ * the event request
*/
- public void removeJDIEventListener(IJDIEventListener listener, EventRequest request) {
- EventDispatcher dispatcher = ((JDIDebugTarget)getDebugTarget()).getEventDispatcher();
+ public void removeJDIEventListener(IJDIEventListener listener,
+ EventRequest request) {
+ EventDispatcher dispatcher = ((JDIDebugTarget) getDebugTarget())
+ .getEventDispatcher();
if (dispatcher != null) {
dispatcher.removeJDIEventListener(listener, request);
}
}
-
+
/**
* The VM has disconnected. Notify the target.
*/
@@ -322,7 +376,7 @@ public abstract class JDIDebugElement extends DebugElement implements IDisconnec
getJavaDebugTarget().disconnected();
}
}
-
+
/**
* @see IJavaDebugTarget#setRequestTimeout(int)
*/
@@ -330,11 +384,12 @@ public abstract class JDIDebugElement extends DebugElement implements IDisconnec
if (supportsRequestTimeout()) {
VirtualMachine vm = getVM();
if (vm != null) {
- ((org.eclipse.jdi.VirtualMachine)vm).setRequestTimeout(timeout);
+ ((org.eclipse.jdi.VirtualMachine) vm)
+ .setRequestTimeout(timeout);
}
}
}
-
+
/**
* @see IJavaDebugTarget#getRequestTimeout()
*/
@@ -342,18 +397,21 @@ public abstract class JDIDebugElement extends DebugElement implements IDisconnec
if (supportsRequestTimeout()) {
VirtualMachine vm = getVM();
if (vm != null) {
- return ((org.eclipse.jdi.VirtualMachine)vm).getRequestTimeout();
+ return ((org.eclipse.jdi.VirtualMachine) vm)
+ .getRequestTimeout();
}
}
return -1;
- }
+ }
+
/**
* @see IJavaDebugTarget#supportsRequestTimeout()
*/
public boolean supportsRequestTimeout() {
- return getJavaDebugTarget().isAvailable() && getVM() instanceof org.eclipse.jdi.VirtualMachine;
+ return getJavaDebugTarget().isAvailable()
+ && getVM() instanceof org.eclipse.jdi.VirtualMachine;
}
-
+
/**
* @see org.eclipse.debug.core.model.IDisconnect#canDisconnect()
*/

Back to the top