1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06:01 +02:00

Adjustment to 218194. There was a concern that there might be IBreakpointListeners out there that are interested in the INSTALL_COUNT attribute, since that attribute was defined in a public interface. This new solution is a hybrid between the original logic and the initial fix to 218194. We don't use the INSTALL_COUNT attribute to maintain the install count, but we update it when it changes. I've updated the documentation for the attribute.

This commit is contained in:
John Cortell 2008-02-14 22:33:38 +00:00
parent 30fa8e597b
commit 8bc24567af
2 changed files with 27 additions and 22 deletions

View file

@ -26,13 +26,22 @@ import org.eclipse.debug.core.model.IBreakpoint;
public interface ICBreakpoint extends IBreakpoint { public interface ICBreakpoint extends IBreakpoint {
/** /**
* Breakpoint attribute that we use merely as a way to force the marker to * Breakpoint attribute storing the number of debug targets a breakpoint is
* refresh. When a CDT internal, but not persisted, state of the breakpoint * installed in (value
* changes in a way that calls for the marker to refresh, we simply store a * <code>"org.eclipse.cdt.debug.core.installCount"</code>). This
* timestamp (Long.toString(Date.getTime())) into this setting. The platform * attribute is an <code>int</code>.
* responds to all marker attrib changes with a marker refresh. *
* Note: this attribute is used only for notifying listeners
* (IBreakpointListener) of a change in the install count. The attribute is
* not used by the CDT breakpoint object to manage the install count, since
* it is a transient property of a breakpoint, and marker attributes are
* persisted. In other words, it's conceivable that upon breakpoint manager
* initialization, a breakpoint is reconstructed with this attribute being
* >0. That doesn't mean the breakpoint is installed (at workbench launch
* time, there are no installed breakpoints). At that time, the attribute
* means absolutely nothing.
*/ */
public static final String FORCE_UPDATE = "org.eclipse.cdt.debug.core.forceupdate"; //$NON-NLS-1$ public static final String INSTALL_COUNT = "org.eclipse.cdt.debug.core.installCount"; //$NON-NLS-1$
/** /**
* Breakpoint attribute storing the conditional expression associated with * Breakpoint attribute storing the conditional expression associated with

View file

@ -12,7 +12,6 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -50,7 +49,9 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
private Map fExtensions = new HashMap(1); private Map fExtensions = new HashMap(1);
/** /**
* The number of debug targets the breakpoint is installed in. * The number of debug targets the breakpoint is installed in. We don't use
* the INSTALL_COUNT attribute to manage this property (see bugzilla 218194)
*
*/ */
private int fInstallCount = 0; private int fInstallCount = 0;
@ -227,11 +228,9 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
public synchronized int incrementInstallCount() throws CoreException { public synchronized int incrementInstallCount() throws CoreException {
++fInstallCount; ++fInstallCount;
// handle the crossing into the installed state; we decorate // cause the marker to update; will ultimately result in a blue checkmark
// an installed marker with a blue checkmark // when install count > 0
if (fInstallCount == 1) { setAttribute(INSTALL_COUNT, fInstallCount);
setAttribute(FORCE_UPDATE, Long.toString((new Date()).getTime())); // force a refresh of the marker through a dummy attribute
}
return fInstallCount; return fInstallCount;
} }
@ -250,11 +249,9 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
public synchronized int decrementInstallCount() throws CoreException { public synchronized int decrementInstallCount() throws CoreException {
fInstallCount--; fInstallCount--;
// handle the crossing into the uninstalled state; we decorate // cause the marker to update; will ultimately remove blue checkmark
// an installed marker with a blue checkmark // when install count == 0
if (fInstallCount == 0) { setAttribute(INSTALL_COUNT, fInstallCount);
setAttribute(FORCE_UPDATE, Long.toString((new Date()).getTime())); // force a refresh of the marker through a dummy attribute
}
return fInstallCount; return fInstallCount;
} }
@ -263,10 +260,9 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#resetInstallCount() * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#resetInstallCount()
*/ */
public synchronized void resetInstallCount() throws CoreException { public synchronized void resetInstallCount() throws CoreException {
int previous = fInstallCount; if (fInstallCount != 0) {
fInstallCount = 0; fInstallCount = 0;
if (previous != 0) { setAttribute(INSTALL_COUNT, fInstallCount);
setAttribute(FORCE_UPDATE, Long.toString((new Date()).getTime())); // force a refresh of the marker through a dummy attribute
} }
} }