Code review cleanup
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/IJavaPatternBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/IJavaPatternBreakpoint.java
index 8784a90..f17d13c 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/IJavaPatternBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/IJavaPatternBreakpoint.java
@@ -8,7 +8,7 @@
 import org.eclipse.core.runtime.CoreException;
 
 /**
- * A java pattern breakpoint is a java line breakpoint which will be installed in all 
+ * A java pattern breakpoint is a java line breakpoint which is installed in all 
  * classes whose fully qualified name matches a specified pattern.
  * 
  * This interface is not intended to be implemented.
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/IJavaWatchpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/IJavaWatchpoint.java
index 0239d70..79409f0 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/IJavaWatchpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/IJavaWatchpoint.java
@@ -70,7 +70,10 @@
 	 * Returns whether this breakpoint last suspended in this target due to an access

 	 * (<code>true</code>) or modification (<code>false</code>).

 	 * 

-	 * @return true if this watchpoint last suspended in this target due to an access

+	 * @return <code>true</code> if this watchpoint last suspended the given

+	 *  target due to a field access; <code>false</code> if this watchpoint last

+	 *  suspended the given target due to a modification access or if this

+	 *  watchpoint hasn't suspended the given target.

 	 * @exception CoreException if a <code>CoreException</code> is

 	 * 	thrown accessing this breakpoint's underlying marker

 	 */

diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/JDIDebugModel.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/JDIDebugModel.java
index a7a96e7..56494a6 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/JDIDebugModel.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/JDIDebugModel.java
@@ -182,7 +182,7 @@
 	

 	/**

 	 * Creates and returns a pattern breakpoint for the given resource at the

-	 * given line number, which will be installed in all classes whose fully 

+	 * given line number, which is installed in all classes whose fully 

 	 * qualified name matches the given pattern.

 	 * If hitCount > 0, the breakpoint will suspend execution when it is

 	 * "hit" the specified number of times. 

diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/AbstractJavaLineBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/AbstractJavaLineBreakpoint.java
deleted file mode 100644
index db5d038..0000000
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/AbstractJavaLineBreakpoint.java
+++ /dev/null
@@ -1,284 +0,0 @@
-package org.eclipse.jdt.internal.debug.core;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.IDebugConstants;
-import org.eclipse.jdt.core.IClassFile;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;
-
-import com.sun.jdi.AbsentInformationException;
-import com.sun.jdi.ClassNotPreparedException;
-import com.sun.jdi.InvalidLineNumberException;
-import com.sun.jdi.Location;
-import com.sun.jdi.NativeMethodException;
-import com.sun.jdi.ReferenceType;
-import com.sun.jdi.VMDisconnectedException;
-import com.sun.jdi.VirtualMachine;
-import com.sun.jdi.request.BreakpointRequest;
-import com.sun.jdi.request.EventRequest;
-
-/**
- * @see IJavaLineBreakpoint
- */
-public abstract class AbstractJavaLineBreakpoint extends JavaBreakpoint implements IJavaLineBreakpoint {
-	
-	// Marker label String keys
-	private static final String LINE= "line"; //$NON-NLS-1$
-	private static final String HITCOUNT= "hitCount"; //$NON-NLS-1$
-	
-	/**
-	 * Sets of attributes used to configure a line breakpoint
-	 */
-	protected static final String[] fgLineBreakpointAttributes= new String[]{IDebugConstants.ENABLED, IMarker.LINE_NUMBER, IMarker.CHAR_START, IMarker.CHAR_END};
-	
-	public AbstractJavaLineBreakpoint() {
-		super();
-	}
-	
-	/**
-	 * @see ILineBreakpoint
-	 */
-	public int getLineNumber() throws CoreException {
-		return ensureMarker().getAttribute(IMarker.LINE_NUMBER, -1);
-	}
-
-	/**
-	 * @see ILineBreakpoint
-	 */
-	public int getCharStart() throws CoreException {
-		return ensureMarker().getAttribute(IMarker.CHAR_START, -1);
-	}
-
-	/**
-	 * @see ILineBreakpoint
-	 */
-	public int getCharEnd() throws CoreException {
-		return ensureMarker().getAttribute(IMarker.CHAR_END, -1);
-	}
-		
-	/**
-	 * @see JavaBreakpoint#createRequest(JDIDebutTarget, ReferenceType)
-	 */
-	protected void createRequest(JDIDebugTarget target, ReferenceType type) throws CoreException {
-		Location location= null;
-		int lineNumber= getLineNumber();			
-		location= determineLocation(lineNumber, type);
-		if (location == null) {
-			// could be an inner type not yet loaded, or line information not available
-			return;
-		}
-		
-		EventRequest request = createLineBreakpointRequest(location, target);	
-		registerRequest(request, target);		
-	}	
-	
-	/**
-	 * Creates, installs, and returns a line breakpoint request at
-	 * the given location for this breakpoint.
-	 */
-	protected BreakpointRequest createLineBreakpointRequest(Location location, JDIDebugTarget target) throws CoreException {
-		BreakpointRequest request = null;
-		try {
-			request= target.getEventRequestManager().createBreakpointRequest(location);
-			configureRequest(request);
-		} catch (VMDisconnectedException e) {
-			if (target.isDisconnected() || target.isTerminated()) {			
-				return null;
-			} 
-			JDIDebugPlugin.logError(e);
-		} catch (RuntimeException e) {
-			JDIDebugPlugin.logError(e);
-			return null;
-		}
-		return request;
-	}
-	
-	
-	/**
-	 * Returns a location for the line number in the given type, or any of its
-	 * nested types. Returns <code>null</code> if a location cannot be determined.
-	 */
-	protected Location determineLocation(int lineNumber, ReferenceType type) {
-		List locations= null;
-		try {
-			locations= type.locationsOfLine(lineNumber);
-		} catch (AbsentInformationException e) {
-			return null;
-		} catch (NativeMethodException e) {
-			return null;
-		} catch (InvalidLineNumberException e) {
-			//possible in a nested type, fall through and traverse nested types
-		} catch (VMDisconnectedException e) {
-			return null;
-		} catch (ClassNotPreparedException e) {
-			// could be a nested type that is not yet loaded
-			return null;
-		} catch (RuntimeException e) {
-			// not able to retrieve line info
-			JDIDebugPlugin.logError(e);
-			return null;
-		}
-		
-		if (locations != null && locations.size() > 0) {
-			return (Location) locations.get(0);
-		} else {
-			Iterator nestedTypes= null;
-			try {
-				nestedTypes= type.nestedTypes().iterator();
-			} catch (RuntimeException e) {
-				// not able to retrieve line info
-				JDIDebugPlugin.logError(e);
-				return null;
-			}
-			while (nestedTypes.hasNext()) {
-				ReferenceType nestedType= (ReferenceType) nestedTypes.next();
-				Location innerLocation= determineLocation(lineNumber, nestedType);
-				if (innerLocation != null) {
-					return innerLocation;
-				}
-			}
-		}
-
-		return null;
-	}			
-
-	
-	/**
-	 * Update the hit count of an <code>EventRequest</code>. Return a new request with
-	 * the appropriate settings.
-	 */
-	protected EventRequest updateHitCount(EventRequest request, JDIDebugTarget target) throws CoreException {		
-		
-		// if the hit count has changed, or the request has expired and is being re-enabled,
-		// create a new request
-		if (hasHitCountChanged(request) || (isExpired(request) && isEnabled())) {
-			try {
-				Location location = ((BreakpointRequest) request).location();				
-				// delete old request
-				//on JDK you cannot delete (disable) an event request that has hit its count filter
-				if (!isExpired(request)) {
-					target.getEventRequestManager().deleteEventRequest(request); // disable & remove
-				}				
-				request = createLineBreakpointRequest(location, target);
-			} catch (VMDisconnectedException e) {
-				if (target.isDisconnected() || target.isTerminated()) {
-					return request;
-				}
-				JDIDebugPlugin.logError(e);
-			} catch (RuntimeException e) {
-				JDIDebugPlugin.logError(e);
-			}
-		}
-		return request;
-	}		
-	
-	/**
-	 * Configure a breakpoint request with common properties:
-	 * <ul>
-	 * <li><code>IDebugConstants.BREAKPOINT_MARKER</code></li>
-	 * <li><code>IJavaDebugConstants.HIT_COUNT</code></li>
-	 * <li><code>IJavaDebugConstants.EXPIRED</code></li>
-	 * <li><code>IDebugConstants.ENABLED</code></li>
-	 * </ul>
-	 * and sets the suspend policy of the request to suspend 
-	 * the event thread.
-	 */
-	protected void configureRequest(EventRequest request) throws CoreException {
-		request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
-		request.putProperty(JAVA_BREAKPOINT_PROPERTY, this);								
-		int hitCount= getHitCount();
-		if (hitCount > 0) {
-			request.addCountFilter(hitCount);
-			request.putProperty(HIT_COUNT, new Integer(hitCount));
-			request.putProperty(EXPIRED, Boolean.FALSE);
-		}
-		// Important: only enable a request after it has been configured
-		updateEnabledState(request);
-	}
-	
-	/**
-	 * Set standard attributes of a line breakpoint.
-	 * The standard attributes are:
-	 * <ol>
-	 * <li>IDebugConstants.MODEL_IDENTIFIER</li>
-	 * <li>IDebugConstants.ENABLED</li>
-	 * <li>IMarker.LINE_NUMBER</li>
-	 * <li>IMarker.CHAR_START</li>
-	 * <li>IMarker.CHAR_END</li>
-	 * </ol>	
-	 */	
-	public void setLineBreakpointAttributes(String modelIdentifier, boolean enabled, int lineNumber, int charStart, int charEnd) throws CoreException {
-		Object[] values= new Object[]{new Boolean(true), new Integer(lineNumber), new Integer(charStart), new Integer(charEnd)};
-		ensureMarker().setAttributes(fgLineBreakpointAttributes, values);			
-	}
-	
-	/**
-	 * @see IJavaLineBreakpoint#getMember()
-	 */
-	public IMember getMember() throws CoreException {
-		int start = getCharStart();
-		int end = getCharEnd();
-		IType type = getType();
-		IMember member = null;
-		if ((type != null) && (end >= start) && (start >= 0)) {
-			try {
-				member= binSearch(type, start, end);
-			} catch (CoreException ce) {
-				JDIDebugPlugin.logError(ce);
-			}
-		}
-		if (member == null) {
-			member= type;
-		}
-		return member;
-	}
-	
-	/**
-	 * Searches the given source range of the container for a member that is
-	 * not the same as the given type.
-	 */
-	protected IMember binSearch(IType type, int start, int end) throws JavaModelException {
-		IJavaElement je = getElementAt(type, start);
-		if (je != null && !je.equals(type)) {
-			return (IMember)je;
-		}
-		if (end > start) {
-			je = getElementAt(type, end);
-			if (je != null && !je.equals(type)) {
-				return (IMember)je;
-			}
-			int mid = ((end - start) / 2) + start;
-			if (mid > start) {
-				je = binSearch(type, start + 1, mid);
-				if (je == null) {
-					je = binSearch(type, mid + 1, end - 1);
-				}
-				return (IMember)je;
-			}
-		}
-		return null;
-	}	
-	
-	/**
-	 * Returns the element at the given position in the given type
-	 */
-	protected IJavaElement getElementAt(IType type, int pos) throws JavaModelException {
-		if (type.isBinary()) {
-			return type.getClassFile().getElementAt(pos);
-		} else {
-			return type.getCompilationUnit().getElementAt(pos);
-		}
-	}
-
-}
-
-
-
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaBreakpoint.java
index b30f15d..f2f91e4 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaBreakpoint.java
@@ -143,7 +143,7 @@
 	

 	/**

 	 * Returns a string corresponding to the reference type

-	 * name in which this breakpoint will be installed.

+	 * name in which this breakpoint is installed.

 	 */

 	protected String getReferenceTypeName() {

 		String name= "";

@@ -158,6 +158,9 @@
 		} catch (CoreException ce) {

 			JDIDebugPlugin.logError(ce);

 		}

+		if (name == null) {

+			name= "";

+		}

 		return name;

 	}	

 	

@@ -195,6 +198,11 @@
 		list.add(newRequest);

 		target.removeJDIEventListener(this, oldRequest);

 		target.addJDIEventListener(this, newRequest);

+		// delete old request

+		//on JDK you cannot delete (disable) an event request that has hit its count filter

+		if (!isExpired(oldRequest)) {

+			target.getEventRequestManager().deleteEventRequest(oldRequest); // disable & remove

+		}			

 	}

 

 	/**

@@ -270,7 +278,44 @@
 	 * Create a breakpoint request for this breakpoint in the given

 	 * reference type in the given target.

 	 */

-	protected abstract void createRequest(JDIDebugTarget target, ReferenceType type) throws CoreException;

+	protected void createRequest(JDIDebugTarget target, ReferenceType type) throws CoreException {

+		EventRequest request= newRequest(target, type);

+		registerRequest(request, target);

+	}

+	

+	/**

+	 * Configure a breakpoint request with common properties:

+	 * <ul>

+	 * <li><code>IDebugConstants.BREAKPOINT_MARKER</code></li>

+	 * <li><code>IJavaDebugConstants.HIT_COUNT</code></li>

+	 * <li><code>IJavaDebugConstants.EXPIRED</code></li>

+	 * <li><code>IDebugConstants.ENABLED</code></li>

+	 * </ul>

+	 * and sets the suspend policy of the request to suspend 

+	 * the event thread.

+	 */

+	protected void configureRequest(EventRequest request) throws CoreException {

+		request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);

+		request.putProperty(JAVA_BREAKPOINT_PROPERTY, this);								

+		int hitCount= getHitCount();

+		if (hitCount > 0) {

+			request.addCountFilter(hitCount);

+			request.putProperty(HIT_COUNT, new Integer(hitCount));

+			request.putProperty(EXPIRED, Boolean.FALSE);

+		}

+		// Important: only enable a request after it has been configured

+		updateEnabledState(request);

+	}	

+	

+	/**

+	 * Creates and returns a breakpoint request for this breakpoint which

+	 * has been installed in the given reference type and registered

+	 * in the given target.

+	 * 

+	 * @return the event request which was created or <code>null</code> if

+	 *  the request creation failed

+	 */

+	protected abstract EventRequest newRequest(JDIDebugTarget target, ReferenceType type) throws CoreException;

 	

 	/**

 	 * Add this breakpoint to the given target. After it has been

diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaExceptionBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaExceptionBreakpoint.java
index cb3b1ed..0e9aefd 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaExceptionBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaExceptionBreakpoint.java
@@ -68,8 +68,8 @@
 	 * @param caught whether to suspend in caught locations

 	 * @param uncaught whether to suspend in uncaught locations

  	 * @param checked whether the exception is a checked exception

-	 * @return an exception breakpoint

-	 * @exception DebugException if unable to create the breakpoint marker due

+	 * @return a java exception breakpoint

+	 * @exception DebugException if unable to create the associated marker due

 	 *  to a lower level exception.

 	 */	

 	public JavaExceptionBreakpoint(final IType exception, final boolean caught, final boolean uncaught, final boolean checked) throws DebugException {

@@ -89,7 +89,7 @@
 				setEnabled(true);

 				// configure caught, uncaught, checked, and the type attributes

 				setDefaultCaughtAndUncaught();

-				configureExceptionBreakpoint(checked, exception);

+				setTypeAndChecked(exception, checked);

 

 				// configure the marker as a Java marker

 				IMarker marker = ensureMarker();

@@ -97,7 +97,6 @@
 				JavaCore.addJavaElementMarkerAttributes(attributes, exception);

 				marker.setAttributes(attributes);

 				

-				// Lastly, add the breakpoint manager

 				addToBreakpointManager();				

 			}

 

@@ -106,15 +105,20 @@
 	}

 	

 	/**

-	 * Sets the <code>CAUGHT</code>, <code>UNCAUGHT</code>, <code>CHECKED</code> and 

-	 * <code>TYPE_HANDLE</code> attributes of the given exception breakpoint.

+	 * Sets the exception type on which this breakpoint is installed and whether

+	 * or not that exception is a checked exception.

 	 */

-	public void configureExceptionBreakpoint(boolean checked, IType exception) throws CoreException {

+	protected void setTypeAndChecked(IType exception, boolean checked) throws CoreException {

 		String handle = exception.getHandleIdentifier();

 		Object[] values= new Object[]{new Boolean(checked), handle};

 		ensureMarker().setAttributes(fgExceptionBreakpointAttributes, values);

 	}

-			

+	

+	/**

+	 * Sets the default values for whether this breakpoint will

+	 * suspend execution when the associated exception is thrown

+	 * and caught or not caught..

+	 */

 	public void setDefaultCaughtAndUncaught() throws CoreException {

 		Object[] values= new Object[]{Boolean.TRUE, Boolean.TRUE};

 		String[] attributes= new String[]{CAUGHT, UNCAUGHT};

@@ -122,52 +126,45 @@
 	}

 	

 	/**

-	 * @see JavaBreakpoint#installIn(JDIDebugTarget)

+	 * @see JavaBreakpoint#addToTarget(JDIDebugTarget)

 	 */

 	public void addToTarget(JDIDebugTarget target) throws CoreException {

 		

 		IType exceptionType = getType();

 		if (exceptionType == null) {

-//			internalError(ERROR_BREAKPOINT_NO_TYPE);

 			return;

 		}

-		String exceptionName = exceptionType.getFullyQualifiedName();

 		String referenceName = getReferenceTypeName();

-		if (referenceName == null) {

-//			internalError(ERROR_BREAKPOINT_NO_TYPE);

+		if (referenceName.equals("")) {

 			return;

 		}

 

 		// listen to class loads

 		registerRequest(target.createClassPrepareRequest(referenceName), target);

-		

-		if (isCaught() || isUncaught()) {			

-			List classes= target.jdiClassesByName(exceptionName);

-			if (!classes.isEmpty()) {

-				Iterator iter = classes.iterator();

-				while (iter.hasNext()) {

-					ReferenceType exClass = (ReferenceType)iter.next();				

-					createRequest(target, exClass);

-				}

+					

+		List classes= target.jdiClassesByName(referenceName);

+		if (!classes.isEmpty()) {

+			Iterator iter = classes.iterator();

+			while (iter.hasNext()) {

+				ReferenceType exClass = (ReferenceType)iter.next();				

+				createRequest(target, exClass);

 			}

 		}	

 	}

 	

-	protected ExceptionRequest newRequest(JDIDebugTarget target, ReferenceType type) throws CoreException {

+	/**

+	 * Creates a request in the given target to suspend when the given exception

+	 * type is thrown. The request is returned installed, configured, and enabled

+	 * as appropriate for this breakpoint.

+	 */

+	protected EventRequest newRequest(JDIDebugTarget target, ReferenceType type) throws CoreException {

 		if (!isCaught() && !isUncaught()) {

 			return null;

 		}

 			ExceptionRequest request= null;

 			try {

 				request= target.getEventRequestManager().createExceptionRequest(type, isCaught(), isUncaught());

-				request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);

-				request.putProperty(JAVA_BREAKPOINT_PROPERTY, this);

-				int hitCount= getHitCount();

-				if (hitCount > 0) {

-					request.addCountFilter(hitCount);

-					request.putProperty(HIT_COUNT, new Integer(hitCount));

-					request.putProperty(EXPIRED, Boolean.FALSE);

-				}

+				configureRequest(request);

 			} catch (VMDisconnectedException e) {

 				if (target.isTerminated() || target.isDisconnected()) {

 					return null;

@@ -177,15 +174,9 @@
 			} catch (RuntimeException e) {

 				JDIDebugPlugin.logError(e);

 				return null;

-			}

-			request.setEnabled(isEnabled());	

+			}	

 			return request;

 	}

-	

-	protected void createRequest(JDIDebugTarget target, ReferenceType type)  throws CoreException {

-			ExceptionRequest request= newRequest(target, type);

-			registerRequest(request, target);

-	}

 

 	/**

 	 * Enable this exception breakpoint.

@@ -269,37 +260,6 @@
 		return request;

 	}	

 	

-	protected EventRequest updateCaughtState(EventRequest req, JDIDebugTarget target) throws CoreException  {

-		if(!(req instanceof ExceptionRequest)) {

-			return req;

-		}

-		ExceptionRequest request= (ExceptionRequest)req;

-		

-		if (request.notifyCaught() != isCaught() || request.notifyUncaught() != isUncaught()) {

-			request= createUpdatedExceptionRequest(target, (ExceptionRequest)request);

-		}

-		return request;

-	}

-	

-	protected ExceptionRequest createUpdatedExceptionRequest(JDIDebugTarget target, ExceptionRequest request) throws CoreException{

-		try {

-			// delete old request

-			//on JDK you cannot delete (disable) an event request that has hit its count filter

-			if (!isExpired(request)) {

-				target.getEventRequestManager().deleteEventRequest(request); // disable & remove

-			}

-			ReferenceType exClass = ((ExceptionRequest)request).exception();				

-			request = newRequest(target, exClass);

-		} catch (VMDisconnectedException e) {

-			if (target.isTerminated() || target.isDisconnected()) {

-				return request;

-			}

-			JDIDebugPlugin.logError(e);

-		} catch (RuntimeException e) {

-			JDIDebugPlugin.logError(e);

-		}

-		return request;

-	}

 	/**

 	 * @see JavaBreakpoint#updateRequest(EventRequest, JDIDebugTarget)

 	 */

@@ -312,5 +272,40 @@
 			request = newRequest;

 		}

 	}

+	

+	/**

+	 * Return a request that will suspend execution when a caught and/or uncaught

+	 * exception is thrown as is appropriate for the current state of this breakpoint.

+	 */

+	protected EventRequest updateCaughtState(EventRequest req, JDIDebugTarget target) throws CoreException  {

+		if(!(req instanceof ExceptionRequest)) {

+			return req;

+		}

+		ExceptionRequest request= (ExceptionRequest) req;

+		if (request.notifyCaught() != isCaught() || request.notifyUncaught() != isUncaught()) {

+			request= createUpdatedExceptionRequest(target, (ExceptionRequest)request);

+		}

+		return request;

+	}

+	

+	/**

+	 * Create a request that reflects the current state of this breakpoint.

+	 * The new request will be installed in the same type as the given

+	 * request.

+	 */

+	protected ExceptionRequest createUpdatedExceptionRequest(JDIDebugTarget target, ExceptionRequest request) throws CoreException{

+		try {

+			ReferenceType exClass = ((ExceptionRequest)request).exception();				

+			request = (ExceptionRequest) newRequest(target, exClass);

+		} catch (VMDisconnectedException e) {

+			if (target.isTerminated() || target.isDisconnected()) {

+				return request;

+			}

+			JDIDebugPlugin.logError(e);

+		} catch (RuntimeException e) {

+			JDIDebugPlugin.logError(e);

+		}

+		return request;

+	}	

 }

 

diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaLineBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaLineBreakpoint.java
index 61276e6..da8ebe0 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaLineBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaLineBreakpoint.java
@@ -1,5 +1,10 @@
 package org.eclipse.jdt.internal.debug.core;

 

+/*

+ * (c) Copyright IBM Corp. 2000, 2001.

+ * All Rights Reserved.

+ */

+ 

 import java.util.Iterator;

 import java.util.List;

 import java.util.Map;

@@ -8,6 +13,7 @@
 import org.eclipse.core.resources.IResource;

 import org.eclipse.core.resources.IWorkspaceRunnable;

 import org.eclipse.core.runtime.CoreException;

+import org.eclipse.debug.core.IDebugConstants;

 import org.eclipse.core.runtime.IProgressMonitor;

 import org.eclipse.debug.core.DebugException;

 import org.eclipse.jdt.core.IClassFile;

@@ -17,6 +23,7 @@
 import org.eclipse.jdt.core.IType;

 import org.eclipse.jdt.core.JavaCore;

 import org.eclipse.jdt.core.JavaModelException;

+import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;

 

 import com.sun.jdi.AbsentInformationException;

 import com.sun.jdi.ClassNotPreparedException;

@@ -25,16 +32,24 @@
 import com.sun.jdi.NativeMethodException;

 import com.sun.jdi.ReferenceType;

 import com.sun.jdi.VMDisconnectedException;

+import com.sun.jdi.request.EventRequest;

+import com.sun.jdi.request.BreakpointRequest;

 

-public class JavaLineBreakpoint extends AbstractJavaLineBreakpoint {

+public class JavaLineBreakpoint extends JavaBreakpoint implements IJavaLineBreakpoint {

 

 	private static final String JAVA_LINE_BREAKPOINT = "org.eclipse.jdt.debug.javaLineBreakpointMarker"; //$NON-NLS-1$

-	

+	// Marker label String keys

+	private static final String LINE= "line"; //$NON-NLS-1$

+	private static final String HITCOUNT= "hitCount"; //$NON-NLS-1$	

 	/**

 	 * Sets of attributes used to configure a line breakpoint

 	 */

 	protected static final String[] fgTypeAndHitCountAttributes= new String[]{TYPE_HANDLE, HIT_COUNT, EXPIRED};	

-	

+	/**

+	 * Sets of attributes used to configure a line breakpoint

+	 */

+	protected static final String[] fgLineBreakpointAttributes= new String[]{IDebugConstants.ENABLED, IMarker.LINE_NUMBER, IMarker.CHAR_START, IMarker.CHAR_END};

+		

 	public JavaLineBreakpoint() {

 	}

 	

@@ -42,7 +57,7 @@
 		this(type, lineNumber, charStart, charEnd, hitCount, JAVA_LINE_BREAKPOINT);

 	}

 

-	public JavaLineBreakpoint(final IType type, final int lineNumber, final int charStart, final int charEnd, final int hitCount, final String markerType) throws DebugException {

+	protected JavaLineBreakpoint(final IType type, final int lineNumber, final int charStart, final int charEnd, final int hitCount, final String markerType) throws DebugException {

 		IWorkspaceRunnable wr= new IWorkspaceRunnable() {

 			public void run(IProgressMonitor monitor) throws CoreException {

 				IResource resource= getResource(type);

@@ -66,9 +81,29 @@
 			}

 		};

 		run(wr);

-	}	

+	}

 	

 	/**

+	 * @see ILineBreakpoint

+	 */

+	public int getLineNumber() throws CoreException {

+		return ensureMarker().getAttribute(IMarker.LINE_NUMBER, -1);

+	}

+

+	/**

+	 * @see ILineBreakpoint

+	 */

+	public int getCharStart() throws CoreException {

+		return ensureMarker().getAttribute(IMarker.CHAR_START, -1);

+	}

+

+	/**

+	 * @see ILineBreakpoint

+	 */

+	public int getCharEnd() throws CoreException {

+		return ensureMarker().getAttribute(IMarker.CHAR_END, -1);

+	}	

+	/**

 	 * Returns the type of marker associated with java line breakpoints

 	 */

 	public static String getMarkerType() {

@@ -93,7 +128,7 @@
 	 */

 	protected void addToTarget(JDIDebugTarget target) throws CoreException {

 		String referenceTypeName= getReferenceTypeName();

-		if (referenceTypeName == null) {

+		if (referenceTypeName.equals("")) {

 			return;

 		}

 		

@@ -112,6 +147,43 @@
 	}

 	

 	/**

+	 * @see JavaBreakpoint#newRequest(JDIDebugTarget, ReferenceType)

+	 */

+	protected EventRequest newRequest(JDIDebugTarget target, ReferenceType type) throws CoreException {

+		Location location= null;

+		int lineNumber= getLineNumber();			

+		location= determineLocation(lineNumber, type);

+		if (location == null) {

+			// could be an inner type not yet loaded, or line information not available

+			return null;

+		}

+		

+		EventRequest request = createLineBreakpointRequest(location, target);	

+		return request;		

+	}	

+

+	/**

+	 * Creates, installs, and returns a line breakpoint request at

+	 * the given location for this breakpoint.

+	 */

+	protected BreakpointRequest createLineBreakpointRequest(Location location, JDIDebugTarget target) throws CoreException {

+		BreakpointRequest request = null;

+		try {

+			request= target.getEventRequestManager().createBreakpointRequest(location);

+			configureRequest(request);

+		} catch (VMDisconnectedException e) {

+			if (target.isDisconnected() || target.isTerminated()) {			

+				return null;

+			} 

+			JDIDebugPlugin.logError(e);

+		} catch (RuntimeException e) {

+			JDIDebugPlugin.logError(e);

+			return null;

+		}

+		return request;

+	}

+		

+	/**

 	 * Returns a location for the line number in the given type, or any of its

 	 * nested types. Returns <code>null</code> if a location cannot be determined.

 	 */

@@ -160,8 +232,47 @@
 	}

 	

 	/**

-	 * Sets the <code>TYPE_HANDLE</code> attribute of the given breakpoint, associated

-	 * with the given IType.

+	 * Update the hit count of an <code>EventRequest</code>. Return a new request with

+	 * the appropriate settings.

+	 */

+	protected EventRequest updateHitCount(EventRequest request, JDIDebugTarget target) throws CoreException {		

+		

+		// if the hit count has changed, or the request has expired and is being re-enabled,

+		// create a new request

+		if (hasHitCountChanged(request) || (isExpired(request) && isEnabled())) {

+			try {

+				Location location = ((BreakpointRequest) request).location();			

+				request = createLineBreakpointRequest(location, target);

+			} catch (VMDisconnectedException e) {

+				if (target.isDisconnected() || target.isTerminated()) {

+					return request;

+				}

+				JDIDebugPlugin.logError(e);

+			} catch (RuntimeException e) {

+				JDIDebugPlugin.logError(e);

+			}

+		}

+		return request;

+	}

+	

+	/**

+	 * Set standard attributes of a line breakpoint.

+	 * The standard attributes are:

+	 * <ol>

+	 * <li>IDebugConstants.MODEL_IDENTIFIER</li>

+	 * <li>IDebugConstants.ENABLED</li>

+	 * <li>IMarker.LINE_NUMBER</li>

+	 * <li>IMarker.CHAR_START</li>

+	 * <li>IMarker.CHAR_END</li>

+	 * </ol>	

+	 */	

+	public void setLineBreakpointAttributes(String modelIdentifier, boolean enabled, int lineNumber, int charStart, int charEnd) throws CoreException {

+		Object[] values= new Object[]{new Boolean(true), new Integer(lineNumber), new Integer(charStart), new Integer(charEnd)};

+		ensureMarker().setAttributes(fgLineBreakpointAttributes, values);			

+	}		

+	

+	/**

+	 * Sets the type in which this breakpoint is installed.

 	 *

 	 * If <code>hitCount > 0</code>, sets the <code>HIT_COUNT</code> attribute of the given breakpoint,

 	 * and resets the <code>EXPIRED</code> attribute to false (since, if

@@ -177,6 +288,64 @@
 		ensureMarker().setAttributes(fgTypeAndHitCountAttributes, values);

 	}

 

+	/**

+	 * @see IJavaLineBreakpoint#getMember()

+	 */

+	public IMember getMember() throws CoreException {

+		int start = getCharStart();

+		int end = getCharEnd();

+		IType type = getType();

+		IMember member = null;

+		if ((type != null) && (end >= start) && (start >= 0)) {

+			try {

+				member= binSearch(type, start, end);

+			} catch (CoreException ce) {

+				JDIDebugPlugin.logError(ce);

+			}

+		}

+		if (member == null) {

+			member= type;

+		}

+		return member;

+	}

+	

+	/**

+	 * Searches the given source range of the container for a member that is

+	 * not the same as the given type.

+	 */

+	protected IMember binSearch(IType type, int start, int end) throws JavaModelException {

+		IJavaElement je = getElementAt(type, start);

+		if (je != null && !je.equals(type)) {

+			return (IMember)je;

+		}

+		if (end > start) {

+			je = getElementAt(type, end);

+			if (je != null && !je.equals(type)) {

+				return (IMember)je;

+			}

+			int mid = ((end - start) / 2) + start;

+			if (mid > start) {

+				je = binSearch(type, start + 1, mid);

+				if (je == null) {

+					je = binSearch(type, mid + 1, end - 1);

+				}

+				return (IMember)je;

+			}

+		}

+		return null;

+	}	

+	

+	/**

+	 * Returns the element at the given position in the given type

+	 */

+	protected IJavaElement getElementAt(IType type, int pos) throws JavaModelException {

+		if (type.isBinary()) {

+			return type.getClassFile().getElementAt(pos);

+		} else {

+			return type.getCompilationUnit().getElementAt(pos);

+		}

+	}

+

 }

 

 

diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaPatternBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaPatternBreakpoint.java
index 2353e48..30352e2 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaPatternBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaPatternBreakpoint.java
@@ -1,19 +1,27 @@
 package org.eclipse.jdt.internal.debug.core;
 
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+ 
 import java.text.MessageFormat;
 import java.util.Iterator;
 import java.util.List;
 
+import org.eclipse.jdt.debug.core.IJavaPatternBreakpoint;
+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.core.runtime.CoreException;
 import org.eclipse.debug.core.DebugException;
-import org.eclipse.jdt.debug.core.IJavaPatternBreakpoint;
+import com.sun.jdi.AbsentInformationException;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.request.EventRequest;
 
-import com.sun.jdi.*;
-
-public class JavaPatternBreakpoint extends AbstractJavaLineBreakpoint implements IJavaPatternBreakpoint {
+public class JavaPatternBreakpoint extends JavaLineBreakpoint implements IJavaPatternBreakpoint {
 
 	private static final String PATTERN_BREAKPOINT = "org.eclipse.jdt.debug.patternBreakpointMarker"; //$NON-NLS-1$
 	
@@ -49,35 +57,18 @@
 	}
 	
 	/**
-	 * Creates the event requests to:<ul>
-	 * <li>Listen to class loads related to the breakpoint</li>
-	 * <li>Respond to the breakpoint being hti</li>
-	 * </ul>
+	 * @see JavaBreakpoint#createRequest(JDIDebugTarget, ReferenceType)
 	 */
-	protected void addToTarget(JDIDebugTarget target) throws CoreException {
-		
-		String referenceTypeName= getReferenceTypeName();
-		
-		// create request to listen to class loads
-		registerRequest(target.createClassPrepareRequest(referenceTypeName), target);
-		
-		// create breakpoint requests for each class currently loaded
-		List classes= target.getVM().allClasses();
-		if (classes != null) {
-			Iterator iter = classes.iterator();
-			String typeName= null;
-			String sourceName= null;
-			ReferenceType type= null;
-			while (iter.hasNext()) {
-				type= (ReferenceType) iter.next();
-				typeName= type.name();
-				if (typeName != null && typeName.startsWith(referenceTypeName)) {
-					createRequest(target, type);
-				}
-			}
-		}
+	protected void createRequest(JDIDebugTarget target, ReferenceType type) throws CoreException {
+		String typeName= type.name();
+		if (typeName != null && typeName.startsWith(getReferenceTypeName())) {
+			super.createRequest(target, type);
+		}		
 	}
 	
+	/**
+	 * @see JavaBreakpoint#getReferenceTypeName()
+	 */
 	protected String getReferenceTypeName() {
 		String name= "";
 		try {
@@ -92,34 +83,32 @@
 	 * Create a breakpoint request if the source name
 	 * debug attribute matches the resource name.
 	 */
-	protected void createRequest(JDIDebugTarget target, ReferenceType type) throws CoreException {
+	protected EventRequest newRequest(JDIDebugTarget target, ReferenceType type) throws CoreException {
 		String sourceName = null;
 		try {
 			sourceName = type.sourceName();
 		} catch (AbsentInformationException e) {
 			// do nothing - cannot install pattern breakpoint without source name debug attribtue
-			return;
+			return null;
 		} catch (RuntimeException e) {
 			target.targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.getString("JavaPatternBreakpoint.exception_source_name"),new String[] {e.toString(), type.name()}) ,e); //$NON-NLS-1$
-			return;
+			return null;
 		}
 		
 		// if the debug attribute matches the resource name, install a breakpoint
 		if (ensureMarker().getResource().getName().equalsIgnoreCase(sourceName)) {
-			super.createRequest(target, type);
+			return super.newRequest(target, type);
 		}
-		
+		return null;
 	}
 	
 	/**
-	 * Sets the <code>PATTERN</code> attribute of the given breakpoint.
-	 * If <code>hitCount > 0</code>, sets the <code>HIT_COUNT</code> attribute of the given breakpoint,
-	 * and resets the <code>EXPIRED</code> attribute to false (since, if
-	 * the hit count is changed, the breakpoint should no longer be expired).
+	 * Sets the class name pattern in which this breakpoint will install itself.
+	 * If <code>hitCount > 0</code>, sets the hit count of the given breakpoint.
 	 */
 	protected void setPatternAndHitCount(String pattern, int hitCount) throws CoreException {
 		if (hitCount == 0) {
-			setPattern(pattern);
+			ensureMarker().setAttribute(PATTERN, pattern);
 			return;
 		}
 		Object[] values= new Object[]{pattern, new Integer(hitCount), Boolean.FALSE};
@@ -127,14 +116,7 @@
 	}
 	
 	/**
-	 * Sets the <code>PATTERN</code> attribute of this breakpoint.
-	 */
-	public void setPattern(String pattern) throws CoreException {
-		ensureMarker().setAttribute(PATTERN, pattern);
-	}
-	
-	/**
-	 * Returns the <code>PATTERN</code> attribute of this breakpoint
+	 * @see IJavaPatternBreakpoint#getPattern()
 	 */
 	public String getPattern() throws CoreException {
 		return (String) ensureMarker().getAttribute(PATTERN);		
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaRunToLineBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaRunToLineBreakpoint.java
index 0db48c7..c752bf6 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaRunToLineBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaRunToLineBreakpoint.java
@@ -1,5 +1,10 @@
 package org.eclipse.jdt.internal.debug.core;

 

+/*

+ * (c) Copyright IBM Corp. 2000, 2001.

+ * All Rights Reserved.

+ */

+ 

 import org.eclipse.core.resources.IMarker;

 import org.eclipse.debug.core.DebugException;

 import org.eclipse.jdt.core.IType;

@@ -26,9 +31,9 @@
 	 *   numbers are 1 based, associated with the compilation unit in which

 	 *   the type is defined

 	 * @param charStart the first character index associated with the breakpoint,

-	 *   or -1 if unspecified

+	 *   or -1 if unknown

  	 * @param charEnd the last character index associated with the breakpoint,

-	 *   or -1 if unspecified

+	 *   or -1 if unknown

 	 * @return a run-to-line breakpoint

 	 * @exception DebugException if unable to create the breakpoint marker due

 	 *  to a lower level exception.

diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaWatchpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaWatchpoint.java
index 3661d72..94be1ac 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaWatchpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JavaWatchpoint.java
@@ -1,5 +1,10 @@
 package org.eclipse.jdt.internal.debug.core;

 

+/*

+ * (c) Copyright IBM Corp. 2000, 2001.

+ * All Rights Reserved.

+ */

+ 

 import java.util.HashMap;

 import java.util.Map;

 

@@ -8,8 +13,12 @@
 import org.eclipse.core.resources.IWorkspaceRunnable;

 import org.eclipse.core.runtime.CoreException;

 import org.eclipse.core.runtime.IProgressMonitor;

+import org.eclipse.core.runtime.IStatus;

+import org.eclipse.core.runtime.Status;

 import org.eclipse.debug.core.DebugException;

 import org.eclipse.debug.core.model.IDebugTarget;

+import org.eclipse.debug.core.IDebugStatusConstants;

+import org.eclipse.debug.core.DebugPlugin;

 import org.eclipse.jdt.core.ICompilationUnit;

 import org.eclipse.jdt.core.IField;

 import org.eclipse.jdt.core.IJavaElement;

@@ -92,10 +101,7 @@
 					resource = field.getJavaProject().getProject();

 				}

 				

-				if (fMarker == null) {

-					// Only create a marker if one is not already assigned

-					fMarker= resource.createMarker(JAVA_WATCHPOINT);

-				}

+				fMarker= resource.createMarker(JAVA_WATCHPOINT);

 				

 				// configure the standard attributes

 				setStandardAttributes(field);

@@ -122,12 +128,15 @@
 	}

 

 	/**

-	 * A single watchpoint can create multiple requests. This method provides control over this

-	 * property for explicitly choosing which requests (access, modification, or both) to 

-	 * potentially add.

+	 * @see JavaBreakpoint#createRequest(JDIDebugTarget, ReferenceType)

+	 * 

+	 * Creates and installs an access and modification watchpoint request

+	 * in the given reference type, configuring the requests as appropriate

+	 * for this watchpoint. The requests are then enabled based on whether

+	 * this watchpoint is an access watchpoint, modification watchpoint, or

+	 * both. Finally, the requests are registered with the given target.

 	 */	

 	protected void createRequest(JDIDebugTarget target, ReferenceType type) throws CoreException {

-				

 		IField javaField= getField();

 		Field field= null;

 		

@@ -156,30 +165,62 @@
 	/**

 	 * Returns whether the given virtual machine supports modification watchpoints

 	 */

-	public boolean modificationSupportedBy(VirtualMachine vm) {

+	protected boolean modificationSupportedBy(VirtualMachine vm) {

 		return vm.canWatchFieldModification();

 	}

 	

 	/**

 	 * Returns whether the given virtual machine supports access watchpoints

 	 */

-	public boolean accessSupportedBy(VirtualMachine vm) {

+	protected boolean accessSupportedBy(VirtualMachine vm) {

 		return vm.canWatchFieldAccess();

 	}

 	

 	/**

-	 * This watchpoint is not supported for some reason. Alert the user.

+	 * Either access or modification watchpoints are not supported. Throw an appropriate exception.

+	 * 

+	 * @param message the message that states that access or modification watchpoints

+	 *  are not supported

 	 */

-	protected void notSupported(String message) {

+	protected void notSupported(String message) throws DebugException {

+		throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getDefault().getDescriptor().getUniqueIdentifier(), 

+			IDebugStatusConstants.NOT_SUPPORTED, message, null)); //$NON-NLS-1$		

 	}

 	

 	/**

 	 * Create an access watchpoint for the given breakpoint and associated field

 	 */

 	protected AccessWatchpointRequest createAccessWatchpoint(JDIDebugTarget target, Field field) throws CoreException {

-		AccessWatchpointRequest request= null;

+		return (AccessWatchpointRequest) createWatchpoint(target, field, true);

+	}

+	

+	/**

+	 * Create a modification watchpoint for the given breakpoint and associated field

+	 */

+	protected ModificationWatchpointRequest createModificationWatchpoint(JDIDebugTarget target, Field field) throws CoreException {

+		return (ModificationWatchpointRequest) createWatchpoint(target, field, false);		

+	}	

+	

+	/**

+	 * Create a watchpoint for the given breakpoint and associated field.

+	 * 

+	 * @param target the target in which the request will be installed

+	 * @param field the field on which the request will be set

+	 * @param access <code>true</code> if an access watchpoint will be 

+	 *  created. <code>false</code> if a modification watchpoint will

+	 *  be created.

+	 * 

+	 * @return an WatchpointRequest (AccessWatchpointRequest if access is

+	 *  <code>true</code>; ModificationWatchpointRequest if access is <code>false</code>).

+	 */

+	protected WatchpointRequest createWatchpoint(JDIDebugTarget target, Field field, boolean access) throws CoreException {

+		WatchpointRequest request= null;

 			try {

-				request= target.getEventRequestManager().createAccessWatchpointRequest(field);

+				if (access) {

+					request= target.getEventRequestManager().createAccessWatchpointRequest(field);

+				} else {

+					request= target.getEventRequestManager().createModificationWatchpointRequest(field);

+				}

 				configureRequest(request);

 			} catch (VMDisconnectedException e) {

 				if (target.isTerminated() || target.isDisconnected()) {

@@ -192,44 +233,17 @@
 				return null;

 			}

 		return request;

-	}	

-		

-	/**

-	 * Create a modification watchpoint for the given breakpoint and associated field

-	 */

-	protected ModificationWatchpointRequest createModificationWatchpoint(JDIDebugTarget target, Field field) throws CoreException {

-		ModificationWatchpointRequest request= null;

-		try {

-			request= target.getEventRequestManager().createModificationWatchpointRequest(field);

-			configureRequest(request);

-		} catch (VMDisconnectedException e) {

-			if (target.isTerminated() || target.isDisconnected()) {

-				return null;

-			}

-			target.internalError(e);

-			return null;

-		} catch (RuntimeException e) {

-			target.internalError(e);

-			return null;

-		}

-		return request;			

 	}

 

 	/**

-	 * Update the hit count of an <code>EventRequest</code>. Return a new request with

-	 * the appropriate settings.

+	 * @see JavaBreakpoint#updateHitCount(EventRequest, JDIDebugTarget)

 	 */

 	protected EventRequest updateHitCount(EventRequest request, JDIDebugTarget target) throws CoreException {		

 		

 		// if the hit count has changed, or the request has expired and is being re-enabled,

 		// create a new request

 		if (hasHitCountChanged(request) || (isExpired(request) && this.isEnabled())) {

-			try {

-				// delete old request

-				//on JDK you cannot delete (disable) an event request that has hit its count filter

-				if (!isExpired(request)) {

-					target.getEventRequestManager().deleteEventRequest(request); // disable & remove

-				}		

+			try {	

 				Field field= ((WatchpointRequest) request).field();

 				if (request instanceof AccessWatchpointRequest) {

 					request= createAccessWatchpoint(target, field);

@@ -250,7 +264,7 @@
 	}

 

 	/**

-	 * Enable this watchpoint.

+	 * @see IBreakpoint#setEnabled(boolean)

 	 * 

 	 * If the watchpoint is not watching access or modification,

 	 * set the default values. If this isn't done, the resulting

@@ -318,32 +332,25 @@
 	 * <li>modification = <code>true</code>

 	 * <ul>

 	 */

-	private void setDefaultAccessAndModification() throws CoreException {

+	protected void setDefaultAccessAndModification() throws CoreException {

 		Object[] values= new Object[]{Boolean.FALSE, Boolean.TRUE};

 		String[] attributes= new String[]{ACCESS, MODIFICATION};

 		ensureMarker().setAttributes(attributes, values);

 	}

 

 	/**

-	 * Sets the <code>FIELD_HANDLE</code> attribute of the given breakpoint, associated

-	 * with the given IField.

+	 * Sets the field on which this watchpoint is installed

 	 */

-	public void setField(IField field) throws CoreException {

+	protected void setField(IField field) throws CoreException {

 		String handle = field.getHandleIdentifier();

-		setFieldHandleIdentifier(handle);

-	}

-	

-	/**

-	 * Sets the <code>FIELD_HANDLE</code> attribute of the given breakpoint.

-	 */

-	public void setFieldHandleIdentifier(String handle) throws CoreException {

 		ensureMarker().setAttribute(FIELD_HANDLE, handle);

 	}

 	

 	/**

-	 * Set standard attributes of a watchpoint

+	 * Set standard attributes of a watchpoint based on the

+	 * given field

 	 */

-	public void setStandardAttributes(IField field) throws CoreException {

+	protected void setStandardAttributes(IField field) throws CoreException {

 		// find the source range if available

 		int start = -1;

 		int stop = -1;

@@ -356,9 +363,10 @@
 	}		

 

 	/**

-	 * Sets the <code>AUTO_DISABLED</code> attribute of this watchpoint.

+	 * Sets the whether this watchpoint has been automatically disabled

+	 * (because modification and access were both set <code>false</code>).

 	 */

-	private void setAutoDisabled(boolean autoDisabled) throws CoreException {

+	protected void setAutoDisabled(boolean autoDisabled) throws CoreException {

 		ensureMarker().setAttribute(AUTO_DISABLED, autoDisabled);

 	}

 

@@ -383,65 +391,13 @@
 	 * @see IJavaWatchpoint#getField()

 	 */

 	public IField getField() throws CoreException {

-		String handle= getFieldHandleIdentifier();

+		String handle= (String) ensureMarker().getAttribute(FIELD_HANDLE);;

 		if (handle != null && handle != "") { //$NON-NLS-1$

 			return (IField)JavaCore.create(handle);

 		}

 		return null;

-	}		

-		

-	/**

-	 * Returns the <code>FIELD_HANDLE</code> attribute of this watchpoint.

-	 */

-	public String getFieldHandleIdentifier() throws CoreException {

-		return (String) ensureMarker().getAttribute(FIELD_HANDLE);

 	}

 	

-	/*

-	public String getFormattedThreadText(String threadName, String typeName, boolean systemThread) {

-		String fieldName= getField().getElementName();

-		if (fLastEventType == ACCESS_EVENT) {

-			if (systemThread) {

-				return getFormattedString(ACCESS_SYS, new String[] {threadName, fieldName, typeName});

-			} else {

-				return getFormattedString(ACCESS_USR, new String[] {threadName, fieldName, typeName});

-			}

-		} else if (fLastEventType == MODIFICATION_EVENT) {

-			// modification

-			if (systemThread) {

-				return getFormattedString(MODIFICATION_SYS, new String[] {threadName, fieldName, typeName});

-			} else {

-				return getFormattedString(MODIFICATION_USR, new String[] {threadName, fieldName, typeName});

-			}

-		}

-		return "";	

-	}

-	

-	public String getMarkerText(boolean qualified, String memberString) {

-		String lineInfo= super.getMarkerText(qualified, memberString);

-

-		String state= null;

-		boolean access= isAccess();

-		boolean modification= isModification();

-		if (access && modification) {

-			state= BOTH;

-		} else if (access) {

-			state= ACCESS;

-		} else if (modification) {

-			state= MODIFICATION;

-		}		

-		String label= null;

-		if (state == null) {

-			label= lineInfo;

-		} else {

-			String format= DebugJavaUtils.getResourceString(FORMAT);

-			state= DebugJavaUtils.getResourceString(state);

-			label= MessageFormat.format(format, new Object[] {state, lineInfo});

-		}

-		return label;	

-	}

-	*/

-	

 	/**

 	 * Store the type of the event, then handle it as specified in

 	 * the superclass. This is useful for correctly generating the

@@ -461,9 +417,7 @@
 	

 	

 	/**

-	 * Update the enabled state of the given request, which is associated

-	 * with this breakpoint. Set the enabled state of the request

-	 * to the enabled state of this breakpoint.

+	 * @see JavaBreakpoint#updateEnabledState(EventRequest)

 	 */

 	protected void updateEnabledState(EventRequest request) throws CoreException  {

 		boolean enabled = isEnabled();

@@ -490,7 +444,11 @@
 			}

 		}

 	}

-		

+	

+	/**

+	 * Set the enabled state of the given request to the given

+	 * value

+	 */

 	protected void internalUpdateEnabeldState(EventRequest request, boolean enabled) {

 		// change the enabled state

 		try {

@@ -504,7 +462,10 @@
 			JDIDebugPlugin.logError(e);

 		}

 	}

-		

+	

+	/**

+	 * @see IJavaWatchpoint#isAccessSuspend(IDebugTarget)

+	 */

 	public boolean isAccessSuspend(IDebugTarget target) {

 		Integer lastEventType= (Integer) fLastEventTypes.get(target);

 		if (lastEventType == null) {