Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodEntryBreakpoint.java')
-rw-r--r--org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodEntryBreakpoint.java117
1 files changed, 68 insertions, 49 deletions
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodEntryBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodEntryBreakpoint.java
index 0e60438a7..05f87b65c 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodEntryBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodEntryBreakpoint.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* 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
@@ -10,15 +10,18 @@
*******************************************************************************/
package org.eclipse.jdt.internal.debug.core.breakpoints;
-
import java.util.Map;
+
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;
import org.eclipse.jdt.debug.core.IJavaMethodEntryBreakpoint;
import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget;
+
import com.sun.jdi.ClassType;
import com.sun.jdi.Location;
import com.sun.jdi.Method;
@@ -30,117 +33,131 @@ import com.sun.jdi.request.EventRequest;
* A line breakpoint at the first executable location in a specific method.
*/
-public class JavaMethodEntryBreakpoint extends JavaLineBreakpoint implements IJavaMethodEntryBreakpoint {
-
+public class JavaMethodEntryBreakpoint extends JavaLineBreakpoint implements
+ IJavaMethodEntryBreakpoint {
+
protected static final String JAVA_METHOD_ENTRY_BREAKPOINT = "org.eclipse.jdt.debug.javaMethodEntryBreakpointMarker"; //$NON-NLS-1$
-
+
/**
- * Breakpoint attribute storing the name of the method
- * in which a breakpoint is contained.
- * (value <code>"org.eclipse.jdt.debug.core.methodName"</code>). This attribute is a <code>String</code>.
+ * Breakpoint attribute storing the name of the method in which a breakpoint
+ * is contained. (value <code>"org.eclipse.jdt.debug.core.methodName"</code>
+ * ). This attribute is a <code>String</code>.
*/
private static final String METHOD_NAME = "org.eclipse.jdt.debug.core.methodName"; //$NON-NLS-1$
-
+
/**
- * Breakpoint attribute storing the signature of the method
- * in which a breakpoint is contained.
- * (value <code>"org.eclipse.jdt.debug.core.methodSignature"</code>). This attribute is a <code>String</code>.
+ * Breakpoint attribute storing the signature of the method in which a
+ * breakpoint is contained. (value
+ * <code>"org.eclipse.jdt.debug.core.methodSignature"</code>). This
+ * attribute is a <code>String</code>.
*/
private static final String METHOD_SIGNATURE = "org.eclipse.jdt.debug.core.methodSignature"; //$NON-NLS-1$
-
+
/**
* Cache of method name attribute
*/
private String fMethodName = null;
-
+
/**
* Cache of method signature attribute
*/
private String fMethodSignature = null;
-
+
/**
- * Constructs a new unconfigured method breakpoint
+ * Constructs a new method breakpoint
*/
public JavaMethodEntryBreakpoint() {
}
-
- public JavaMethodEntryBreakpoint(final IResource resource, final String typeName, final String methodName, final String methodSignature, final int lineNumber, final int charStart, final int charEnd, final int hitCount, final boolean register, final Map attributes) throws CoreException {
- IWorkspaceRunnable wr= new IWorkspaceRunnable() {
+
+ public JavaMethodEntryBreakpoint(final IResource resource,
+ final String typeName, final String methodName,
+ final String methodSignature, final int lineNumber,
+ final int charStart, final int charEnd, final int hitCount,
+ final boolean register, final Map<String, Object> attributes) throws CoreException {
+ IWorkspaceRunnable wr = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
// create the marker
setMarker(resource.createMarker(JAVA_METHOD_ENTRY_BREAKPOINT));
-
+
// add attributes
- addLineBreakpointAttributes(attributes, getModelIdentifier(), true, lineNumber, charStart, charEnd);
- addMethodNameAndSignature(attributes, methodName, methodSignature);
+ addLineBreakpointAttributes(attributes, getModelIdentifier(),
+ true, lineNumber, charStart, charEnd);
+ addMethodNameAndSignature(attributes, methodName,
+ methodSignature);
addTypeNameAndHitCount(attributes, typeName, hitCount);
- //set attributes
- attributes.put(SUSPEND_POLICY, new Integer(getDefaultSuspendPolicy()));
+ // set attributes
+ attributes.put(SUSPEND_POLICY, new Integer(
+ getDefaultSuspendPolicy()));
ensureMarker().setAttributes(attributes);
-
+
register(register);
}
};
run(getMarkerRule(resource), wr);
}
-
+
/**
- * Adds the method name and signature attributes to the
- * given attribute map, and intializes the local cache
- * of method name and signature.
+ * Adds the method name and signature attributes to the given attribute map,
+ * and initializes the local cache of method name and signature.
*/
- private void addMethodNameAndSignature(Map attributes, String methodName, String methodSignature) {
- if (methodName != null) {
+ private void addMethodNameAndSignature(Map<String, Object> attributes, String methodName,
+ String methodSignature) {
+ if (methodName != null) {
attributes.put(METHOD_NAME, methodName);
}
if (methodSignature != null) {
attributes.put(METHOD_SIGNATURE, methodSignature);
}
- fMethodName= methodName;
- fMethodSignature= methodSignature;
+ fMethodName = methodName;
+ fMethodSignature = methodSignature;
}
-
+
/**
- * @see IJavaMethodEntryBreakpoint#getMethodName()
+ * @see IJavaMethodEntryBreakpoint#getMethodName()
*/
public String getMethodName() {
return fMethodName;
}
-
+
/**
- * @see IJavaMethodEntryBreakpoint#getMethodSignature()
+ * @see IJavaMethodEntryBreakpoint#getMethodSignature()
*/
public String getMethodSignature() {
return fMethodSignature;
- }
-
+ }
+
/**
* Initialize cache of attributes
*
* @see IBreakpoint#setMarker(IMarker)
*/
+ @Override
public void setMarker(IMarker marker) throws CoreException {
super.setMarker(marker);
fMethodName = marker.getAttribute(METHOD_NAME, null);
- fMethodSignature = marker.getAttribute(METHOD_SIGNATURE, null);
- }
-
+ fMethodSignature = marker.getAttribute(METHOD_SIGNATURE, null);
+ }
+
/**
* @see IJavaLineBreakpoint#supportsCondition()
*/
+ @Override
public boolean supportsCondition() {
return false;
}
-
+
/**
* @see JavaBreakpoint#newRequests(JDIDebugTarget, ReferenceType)
*/
- protected EventRequest[] newRequests(JDIDebugTarget target, ReferenceType type) throws CoreException {
+ @Override
+ protected EventRequest[] newRequests(JDIDebugTarget target,
+ ReferenceType type) throws CoreException {
try {
if (type instanceof ClassType) {
- ClassType clazz = (ClassType)type;
- Method method = clazz.concreteMethodByName(getMethodName(), getMethodSignature());
+ ClassType clazz = (ClassType) type;
+ Method method = clazz.concreteMethodByName(getMethodName(),
+ getMethodSignature());
if (method == null) {
return null;
}
@@ -148,13 +165,15 @@ public class JavaMethodEntryBreakpoint extends JavaLineBreakpoint implements IJa
if (location == null || location.codeIndex() == -1) {
return null;
}
- BreakpointRequest req = type.virtualMachine().eventRequestManager().createBreakpointRequest(location);
+ BreakpointRequest req = type.virtualMachine()
+ .eventRequestManager()
+ .createBreakpointRequest(location);
configureRequest(req, target);
- return new EventRequest[]{req};
+ return new EventRequest[] { req };
}
return null;
} catch (RuntimeException e) {
- target.internalError(e);
+ target.internalError(e);
return null;
}
}

Back to the top