Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java36
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpoint.java57
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointFactory.java23
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java7
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugConstants.java22
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Breakpoint.java37
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointFactory.java78
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java48
-rw-r--r--org.eclipse.debug.core/plugin.xml8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java2
11 files changed, 60 insertions, 262 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
index 20e5f9e4a..9923a0fad 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
@@ -42,11 +42,6 @@ public class DebugPlugin extends Plugin {
private Launcher[] fLaunchers= new Launcher[0];
/**
- * The collection of breakpoint factory extensions.
- */
- private IBreakpointFactory[] fBreakpointFactories= new IBreakpointFactory[0];
-
- /**
* The singleton breakpoint manager.
*/
private BreakpointManager fBreakpointManager;
@@ -161,33 +156,7 @@ public class DebugPlugin extends Plugin {
for (int i= 0; i < infos.length; i++) {
fLaunchers[i]= new Launcher(infos[i]);
}
- }
-
- /**
- * Returns a collection of breakpoint factory extensions. Breakpoint factory represent
- * and provide access to breakpoint factory extensions.
- *
- * @return an array of breakpoint factory
- * @see org.eclipse.debug.core.IBreakpointFactory
- */
- public IBreakpointFactory[] getBreakpointFactories() {
- return fBreakpointFactories;
- }
-
- /**
- * Loads all breakpoint factory extensions.
- *
- * @exception CoreException if creation of a breakpoint factory extension fails
- */
- protected void loadBreakpointFactories() throws CoreException {
- IPluginDescriptor descriptor= getDescriptor();
- IExtensionPoint extensionPoint= descriptor.getExtensionPoint(IDebugConstants.EXTENSION_POINT_BREAKPOINT_FACTORY);
- IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
- fBreakpointFactories= new IBreakpointFactory[infos.length];
- for (int i= 0; i < infos.length; i++) {
- fBreakpointFactories[i]= new BreakpointFactory(infos[i]);
- }
- }
+ }
/**
* Removes the given listener from the collection of registered debug
@@ -234,8 +203,7 @@ public class DebugPlugin extends Plugin {
public void startup() throws CoreException {
fLaunchManager= new LaunchManager();
fBreakpointManager= new BreakpointManager();
- loadLaunchers();
- loadBreakpointFactories();
+ loadLaunchers();
fBreakpointManager.startup();
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpoint.java
index 6cb25649c..9690b734e 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpoint.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpoint.java
@@ -1,10 +1,7 @@
package org.eclipse.debug.core;
-import java.util.Map;
-
-import org.eclipse.core.resources.*;
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.model.IDebugTarget;
public interface IBreakpoint {
@@ -18,14 +15,7 @@ public interface IBreakpoint {
* </ul>
*/
public void delete() throws CoreException;
-/**
- * Returns whether this marker exists in the workspace. A marker
- * exists if its resource exists and has a marker with the marker's id.
- *
- * @return <code>true</code> if this marker exists, otherwise
- * <code>false</code>
- */
-public boolean exists();
+
/**
* Returns the marker associated with the breakpoint.
*
@@ -41,31 +31,6 @@ public void setMarker(IMarker marker);
*/
public String getModelIdentifier();
/**
- * Returns the id of the marker. The id of a marker is unique
- * relative to the resource with which the marker is associated.
- * Marker ids are not globally unique.
- *
- * @return the id of the marker
- * @see IResource#findMarker
- */
-public long getId();
-/**
- * Returns the resource with which this marker is associated.
- *
- * @return the resource with which this marker is associated
- */
-public IResource getResource();
-/**
- * Returns the type of this breakpoint.
- *
- * @return the type of this marker
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li> This marker does not exist.</li>
- * </ul>
- */
-public String getType() throws CoreException;
-/**
* Returns whether this breakpoint is enabled
*/
public boolean isEnabled() throws CoreException;
@@ -75,24 +40,6 @@ public boolean isEnabled() throws CoreException;
* @param enabled whether this breakpoint should be enabled
*/
public void setEnabled(boolean enabled) throws CoreException;
-/**
- * Install a breakpoint request for this breakpoint in the given target.
- *
- * @param target the debug target into which the request should be added.
- */
-public abstract void addToTarget(IDebugTarget target);
-/**
- * Update the breakpoint request for this breakpoint in the given target.
- *
- * @param target the debug target for which the request should be updated.
- */
-public abstract void changeForTarget(IDebugTarget target);
-/**
- * Remove the breakpoint request for this breakpoint from the given target.
- *
- * @param target the debug target from which the request should be removed.
- */
-public abstract void removeFromTarget(IDebugTarget target);
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointFactory.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointFactory.java
deleted file mode 100644
index 311711536..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointFactory.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.debug.core;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * Creates breakpoints from markers
- */
-public interface IBreakpointFactory {
-
- /**
- * Create a breakpoint for the given marker based on the marker type
- */
- IBreakpoint createBreakpointFor(IMarker marker) throws DebugException;
-
- /**
- * Returns whether this breakpoint factory knows how to create
- * breakpoints for the given marker.
- */
- boolean canCreateBreakpointsFor(IMarker marker) throws CoreException;
-
-}
-
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java
index 80394504b..be82c0776 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java
@@ -58,13 +58,6 @@ public interface IBreakpointManager {
void addBreakpoint(IBreakpoint breakpoint) throws DebugException;
/**
- * Create a breakpoint for the given marker and add it.
- *
- * @return the breakpoint that is created
- */
- IBreakpoint loadMarker(IMarker marker) throws DebugException;
-
- /**
* Returns the breakpoint that is associated with marker or
* <code>null</code> if no such breakpoint exists
*
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugConstants.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugConstants.java
index ffc09ab5d..a5be1a2ac 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugConstants.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugConstants.java
@@ -32,34 +32,34 @@ public interface IDebugConstants {
public static final String EXTENSION_POINT_LAUNCHER= "launchers";
/**
- * Breakpoint factory extension point identifier
- * (value <code>"breakpoint_factories"</code>).
+ * Breakpoint extension point identifier
+ * (value <code>"breakpoints"</code>).
*/
- public static final String EXTENSION_POINT_BREAKPOINT_FACTORY= "breakpoint_factories";
+ public static final String EXTENSION_POINT_BREAKPOINTS= "breakpoints";
/**
- * Root breakpoint marker type
+ * Root breakpoint marker type
* (value <code>"org.eclipse.debug.core.breakpoint"</code>).
*/
- public static final String BREAKPOINT_MARKER = PLUGIN_ID + ".breakpoint";
+ public static final String BREAKPOINT = "breakpointMarker";
/**
- * Line breakpoint marker type.
+ * Line breakpoint type.
* (value <code>"org.eclipse.debug.core.lineBreakpoint"</code>).
*/
- public static final String LINE_BREAKPOINT_MARKER = PLUGIN_ID + ".lineBreakpoint";
+ public static final String LINE_BREAKPOINT = "lineBreakpointMarker";
/**
- * Root breakpoint type
+ * Root breakpoint marker type
* (value <code>"org.eclipse.debug.core.breakpoint"</code>).
*/
- public static final String BREAKPOINT = "breakpoint";
+ public static final String BREAKPOINT_MARKER = PLUGIN_ID + "." + BREAKPOINT;
/**
- * Line breakpoint type.
+ * Line breakpoint marker type.
* (value <code>"org.eclipse.debug.core.lineBreakpoint"</code>).
*/
- public static final String LINE_BREAKPOINT = "lineBreakpoint";
+ public static final String LINE_BREAKPOINT_MARKER = PLUGIN_ID + "." + LINE_BREAKPOINT;
/**
* Debug model identifier breakpoint marker attribute
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Breakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Breakpoint.java
index 9ae325392..9d9d3eba6 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Breakpoint.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Breakpoint.java
@@ -58,12 +58,16 @@ public abstract class Breakpoint implements IBreakpoint {
* A breakpoint is not equal to any other kind of object.
*/
public boolean equals(Object item) {
- if (item instanceof Breakpoint) {
- return getId() == ((IBreakpoint)item).getId();
+ if (item instanceof IBreakpoint) {
+ return getMarker().equals(((IBreakpoint)item).getMarker());
}
return false;
}
+ public int hashCode() {
+ return getMarker().hashCode();
+ }
+
/**
* Configures the given breakpoint's <code>MODEL_IDENTIFIER</code>
* and <code>ENABLED</code> attributes to the given values.
@@ -125,14 +129,6 @@ public abstract class Breakpoint implements IBreakpoint {
}
/**
- * @see IBreakpoint#exists()
- */
- public boolean exists() {
- return fMarker.exists();
- }
-
-
- /**
* @see IBreakpoint#getMarker()
*/
public IMarker getMarker() {
@@ -140,27 +136,6 @@ public abstract class Breakpoint implements IBreakpoint {
}
/**
- * @see IBreakpoint#getId()
- */
- public long getId() {
- return fMarker.getId();
- }
-
- /**
- * @see IBreakpoint#getResource()
- */
- public IResource getResource() {
- return fMarker.getResource();
- }
-
- /**
- * @see IBreakpoint#getType()
- */
- public String getType() throws CoreException {
- return fMarker.getType();
- }
-
- /**
* Returns the model identifier for the given breakpoint.
*/
public String getModelIdentifier() {
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointFactory.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointFactory.java
deleted file mode 100644
index b6de8b2c4..000000000
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointFactory.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.debug.internal.core;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.debug.core.*;
-import org.eclipse.debug.core.model.IBreakpointFactoryDelegate;
-
-public class BreakpointFactory implements IBreakpointFactory {
-
- /**
- * The configuration element that defines this breakpoint factory handle
- */
- protected IConfigurationElement fConfigElement = null;
-
- /**
- * The type of markers that this breakpoint factory creates
- * breakpoints for
- */
- private String fType= null;
-
- /**
- * The underlying breakpoint factory, which is <code>null</code> until the
- * it needs to be instantiated.
- */
- protected IBreakpointFactoryDelegate fDelegate = null;
-
- /**
- * Constructs a handle for a breakpoint factory extension.
- */
- public BreakpointFactory(IConfigurationElement element) {
- fConfigElement = element;
- }
-
- /**
- * Returns the marker type specified in the configuration data.
- */
- public String getMarkerType() {
- if (fType == null) {
- fType= fConfigElement.getAttribute("type");
- }
- return fType;
- }
-
- /**
- * Returns the breakpoint factory for this handle, instantiating it if required.
- */
- public IBreakpointFactoryDelegate getDelegate() {
- if (fDelegate == null) {
- try {
- fDelegate = (IBreakpointFactoryDelegate)fConfigElement.createExecutableExtension("class");
- } catch (CoreException e) {
- //status logged in the #createExecutableExtension code
- }
- }
- return fDelegate;
- }
-
- public boolean canCreateBreakpointsFor(IMarker marker) throws CoreException {
- return (marker.isSubtypeOf(getMarkerType()));
- }
-
- /**
- * @see IBreakpointFactory#createBreakpointFor(IMarker)
- */
- public IBreakpoint createBreakpointFor(IMarker marker) throws DebugException {
- try {
- if (canCreateBreakpointsFor(marker)) {
- return getDelegate().createBreakpointFor(marker);
- }
- } catch (CoreException ce) {
- throw new DebugException(ce.getStatus());
- }
- return null;
- }
-
-}
-
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
index f769d354e..cefc74010 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
@@ -51,6 +51,12 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
protected Vector fBreakpoints;
/**
+ * A table of breakpoint extension points, keyed by
+ * marker type
+ */
+ protected HashMap fBreakpointExtensions;
+
+ /**
* Collection of markers that associates markers to breakpoints
*/
protected HashMap fMarkers;
@@ -70,7 +76,8 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
*/
public BreakpointManager() {
fBreakpoints= new Vector(15);
- fMarkers= new HashMap(15);
+ fMarkers= new HashMap(15);
+ fBreakpointExtensions = new HashMap(15);
}
/**
@@ -82,6 +89,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* @exception CoreException if an error occurrs retreiving breakpoint markers
*/
public void startup() throws CoreException {
+ initBreakpointExtensions();
getWorkspace().addResourceChangeListener(this);
getLaunchManager().addLaunchListener(this);
@@ -92,7 +100,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
for (int i = 0; i < breakpoints.length; i++) {
IMarker marker= breakpoints[i];
try {
- loadMarker(marker);
+ createBreakpoint(marker);
} catch (DebugException e) {
logError(e);
}
@@ -107,6 +115,14 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
getLaunchManager().removeLaunchListener(this);
}
+ protected void initBreakpointExtensions() {
+ IExtensionPoint ep= DebugPlugin.getDefault().getDescriptor().getExtensionPoint(IDebugConstants.EXTENSION_POINT_BREAKPOINTS);
+ IConfigurationElement[] elements = ep.getConfigurationElements();
+ for (int i= 0; i < elements.length; i++) {
+ fBreakpointExtensions.put(elements[i].getAttribute("markerType"), elements[i]);
+ }
+
+ }
/**
* Convenience method to get the launch manager.
@@ -219,24 +235,24 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* @see IBreakpointManager
*/
- public IBreakpoint loadMarker(IMarker marker) throws DebugException {
+ public IBreakpoint createBreakpoint(IMarker marker) throws DebugException {
if (fMarkers.containsKey(marker)) {
return (IBreakpoint) fMarkers.get(marker);
}
IBreakpoint breakpoint= null;
- IBreakpointFactory[] factories= DebugPlugin.getDefault().getBreakpointFactories();
- for (int i=0; i<factories.length; i++) {
- try {
- if (factories[i].canCreateBreakpointsFor(marker)) {
- breakpoint= factories[i].createBreakpointFor(marker);
- addBreakpoint(breakpoint);
- break;
- }
- } catch (CoreException ce) {
- throw new DebugException(ce.getStatus());
+ try {
+ IConfigurationElement config = (IConfigurationElement)fBreakpointExtensions.get(marker.getType());
+ if (config == null) {
+ // error
+ return null;
}
+ IBreakpoint bp = (IBreakpoint)config.createExecutableExtension("class");
+ bp.setMarker(marker);
+ addBreakpoint(bp);
+ return bp;
+ } catch (CoreException e) {
+ throw new DebugException(e.getStatus());
}
- return breakpoint;
}
/**
@@ -294,7 +310,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
Enumeration breakpoints= fBreakpoints.elements();
while (breakpoints.hasMoreElements()) {
IBreakpoint breakpoint= (IBreakpoint) breakpoints.nextElement();
- IResource markerResource= breakpoint.getResource();
+ IResource markerResource= breakpoint.getMarker().getResource();
if (project.getFullPath().isPrefixOf(markerResource.getFullPath())) {
try {
removeBreakpoint(breakpoint, false);
@@ -316,7 +332,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
if (markers != null) {
for (int i= 0; i < markers.length; i++) {
try {
- loadMarker(markers[i]);
+ createBreakpoint(markers[i]);
} catch (DebugException e) {
logError(e);
}
diff --git a/org.eclipse.debug.core/plugin.xml b/org.eclipse.debug.core/plugin.xml
index 1a534f44d..bfcfe448d 100644
--- a/org.eclipse.debug.core/plugin.xml
+++ b/org.eclipse.debug.core/plugin.xml
@@ -21,11 +21,11 @@
<!-- Extension points -->
<extension-point id="launchers" name="Launcher"/>
-<extension-point id="breakpoint_factories" name="BreakpointFactory"/>
+<extension-point id="breakpoints" name="Breakpoint"/>
<!-- Extensions -->
<extension
- id="breakpoint"
+ id="breakpointMarker"
point="org.eclipse.core.resources.markers">
<super
type="org.eclipse.core.resources.marker">
@@ -41,10 +41,10 @@
</attribute>
</extension>
<extension
- id="lineBreakpoint"
+ id="lineBreakpointMarker"
point="org.eclipse.core.resources.markers">
<super
- type="org.eclipse.debug.core.breakpoint">
+ type="org.eclipse.debug.core.breakpointMarker">
</super>
<super
type="org.eclipse.core.resources.textmarker">
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java
index fc24db299..dda9c26f0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java
@@ -41,7 +41,7 @@ public class BreakpointsContentProvider extends BasicContentProvider implements
* @see IBreakpointListener
*/
public void breakpointAdded(final IBreakpoint breakpoint) {
- if (breakpoint.exists()) {
+ if (breakpoint.getMarker().exists()) {
asyncExec(new Runnable() {
public void run() {
if (!isDisposed()) {
@@ -69,7 +69,7 @@ public class BreakpointsContentProvider extends BasicContentProvider implements
* @see IBreakpointListener
*/
public void breakpointChanged(final IBreakpoint breakpoint, IMarkerDelta delta) {
- if (breakpoint.exists()) {
+ if (breakpoint.getMarker().exists()) {
asyncExec(new Runnable() {
public void run() {
if (!isDisposed()) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
index b8a31faf5..12fb3ab50 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
@@ -229,7 +229,7 @@ public class DelegatingModelPresentation implements IDebugModelPresentation {
try {
IMarker marker= (IMarker) element;
IBreakpoint breakpoint= DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
- if (breakpoint.exists()) {
+ if (breakpoint != null && marker.exists()) {
if (breakpoint.isEnabled()) {
return DebugPluginImages.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
} else {

Back to the top