Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Cortell2008-02-07 16:33:35 +0000
committerJohn Cortell2008-02-07 16:33:35 +0000
commit21b8ccf0a5f107bbf3ad62ded0927d24bec8057d (patch)
tree1f5651472faa2b88645bf1d468d42f3abf5a7aa0
parent8565f9f346d8c391ab3063e4ff7f337ce7d097b5 (diff)
downloadorg.eclipse.cdt-21b8ccf0a5f107bbf3ad62ded0927d24bec8057d.tar.gz
org.eclipse.cdt-21b8ccf0a5f107bbf3ad62ded0927d24bec8057d.tar.xz
org.eclipse.cdt-21b8ccf0a5f107bbf3ad62ded0927d24bec8057d.zip
Bugzilla 218194. Fix how install count is associated with a breakpoint.
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java17
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java10
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java52
3 files changed, 42 insertions, 37 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java
index 750dfc92f90..06f628f1993 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java
@@ -269,21 +269,6 @@ public class CDebugCorePlugin extends Plugin {
return dbgCfg;
}
- protected void resetBreakpointsInstallCount() {
- IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = bm.getBreakpoints( getUniqueIdentifier() );
- for( int i = 0; i < breakpoints.length; ++i ) {
- if ( breakpoints[i] instanceof CBreakpoint ) {
- try {
- ((CBreakpoint)breakpoints[i]).resetInstallCount();
- }
- catch( CoreException e ) {
- log( e.getStatus() );
- }
- }
- }
- }
-
protected SessionManager getSessionManager() {
return fSessionManager;
}
@@ -347,7 +332,6 @@ public class CDebugCorePlugin extends Plugin {
super.start( context );
initializeCommonSourceLookupDirector();
createBreakpointListenersList();
- resetBreakpointsInstallCount();
setSessionManager( new SessionManager() );
}
@@ -357,7 +341,6 @@ public class CDebugCorePlugin extends Plugin {
public void stop( BundleContext context ) throws Exception {
setSessionManager( null );
disposeBreakpointListenersList();
- resetBreakpointsInstallCount();
disposeCommonSourceLookupDirector();
disposeDebugConfigurations();
super.stop( context );
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java
index 115bac421ff..044a1b1e425 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java
@@ -26,11 +26,13 @@ import org.eclipse.debug.core.model.IBreakpoint;
public interface ICBreakpoint extends IBreakpoint {
/**
- * Breakpoint attribute storing the number of debug targets a breakpoint is
- * installed in (value <code>"org.eclipse.cdt.debug.core.installCount"</code>).
- * This attribute is an <code>int</code>.
+ * Breakpoint attribute that we use merely as a way to force the marker to
+ * refresh. When a CDT internal, but not persisted, state of the breakpoint
+ * changes in a way that calls for the marker to refresh, we simply store a
+ * timestamp (Long.toString(Date.getTime())) into this setting. The platform
+ * responds to all marker attrib changes with a marker refresh.
*/
- public static final String INSTALL_COUNT = "org.eclipse.cdt.debug.core.installCount"; //$NON-NLS-1$
+ public static final String FORCE_UPDATE = "org.eclipse.cdt.debug.core.forceupdate"; //$NON-NLS-1$
/**
* Breakpoint attribute storing the conditional expression associated with
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java
index b05821f0870..663dce41f3b 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java
@@ -12,6 +12,7 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -48,6 +49,11 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
*/
private Map fExtensions = new HashMap(1);
+ /**
+ * The number of debug targets the breakpoint is installed in.
+ */
+ private int fInstallCount = 0;
+
/**
* Constructor for CBreakpoint.
*/
@@ -107,7 +113,7 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
* @see org.eclipse.cdt.debug.core.ICBreakpoint#isInstalled()
*/
public boolean isInstalled() throws CoreException {
- return ensureMarker().getAttribute( INSTALL_COUNT, 0 ) > 0;
+ return fInstallCount > 0;
}
/*
@@ -216,19 +222,18 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
abstract protected String getMarkerMessage() throws CoreException;
/* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#resetInstallCount()
- */
- public synchronized void resetInstallCount() throws CoreException {
- setAttribute( INSTALL_COUNT, 0 );
- }
-
- /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#incrementInstallCount()
*/
public synchronized int incrementInstallCount() throws CoreException {
- int count = getInstallCount();
- setAttribute( INSTALL_COUNT, ++count );
- return count;
+ ++fInstallCount;
+
+ // handle the crossing into the installed state; we decorate
+ // an installed marker with a blue checkmark
+ if (fInstallCount == 1) {
+ setAttribute(FORCE_UPDATE, Long.toString((new Date()).getTime())); // force a refresh of the marker through a dummy attribute
+ }
+
+ return fInstallCount;
}
/**
@@ -236,20 +241,35 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
* 0 if the attribute is not set.
*/
public int getInstallCount() throws CoreException {
- return ensureMarker().getAttribute( INSTALL_COUNT, 0 );
+ return fInstallCount;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#decrementInstallCount()
*/
public synchronized int decrementInstallCount() throws CoreException {
- int count = getInstallCount();
- if ( count > 0 ) {
- setAttribute( INSTALL_COUNT, --count );
+ fInstallCount--;
+
+ // handle the crossing into the uninstalled state; we decorate
+ // an installed marker with a blue checkmark
+ if (fInstallCount == 0) {
+ setAttribute(FORCE_UPDATE, Long.toString((new Date()).getTime())); // force a refresh of the marker through a dummy attribute
}
- return count;
+
+ return fInstallCount;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#resetInstallCount()
+ */
+ public synchronized void resetInstallCount() throws CoreException {
+ int previous = fInstallCount;
+ fInstallCount = 0;
+ if (previous != 0) {
+ setAttribute(FORCE_UPDATE, Long.toString((new Date()).getTime())); // force a refresh of the marker through a dummy attribute
+ }
+ }
+
/*
* (non-Javadoc)
*

Back to the top