mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +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:
parent
30fa8e597b
commit
8bc24567af
2 changed files with 27 additions and 22 deletions
|
@ -26,13 +26,22 @@ import org.eclipse.debug.core.model.IBreakpoint;
|
|||
public interface ICBreakpoint extends IBreakpoint {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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>.
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -12,7 +12,6 @@ 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;
|
||||
|
@ -50,7 +49,9 @@ 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.
|
||||
* 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;
|
||||
|
||||
|
@ -227,11 +228,9 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
|
|||
public synchronized int incrementInstallCount() throws CoreException {
|
||||
++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
|
||||
}
|
||||
// cause the marker to update; will ultimately result in a blue checkmark
|
||||
// when install count > 0
|
||||
setAttribute(INSTALL_COUNT, fInstallCount);
|
||||
|
||||
return fInstallCount;
|
||||
}
|
||||
|
@ -250,11 +249,9 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
|
|||
public synchronized int decrementInstallCount() throws CoreException {
|
||||
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
|
||||
}
|
||||
// cause the marker to update; will ultimately remove blue checkmark
|
||||
// when install count == 0
|
||||
setAttribute(INSTALL_COUNT, 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()
|
||||
*/
|
||||
public synchronized void resetInstallCount() throws CoreException {
|
||||
int previous = fInstallCount;
|
||||
if (fInstallCount != 0) {
|
||||
fInstallCount = 0;
|
||||
if (previous != 0) {
|
||||
setAttribute(FORCE_UPDATE, Long.toString((new Date()).getTime())); // force a refresh of the marker through a dummy attribute
|
||||
setAttribute(INSTALL_COUNT, fInstallCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue