1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-28 19:35:36 +02:00

Bug 321932 - [update policy] When in manual mode, switching number format should still show value in other formats if value is cached.

This commit is contained in:
Pawel Piech 2010-09-27 23:26:34 +00:00
parent 159c91c678
commit b2dd37899a
2 changed files with 22 additions and 10 deletions

View file

@ -35,6 +35,8 @@ import org.eclipse.core.runtime.PlatformObject;
abstract public class AbstractDMContext extends PlatformObject
implements IDMContext
{
public static final IDMContext[] EMPTY_PARENTS_ARRAY = new IDMContext[0];
private final String fSessionId;
private final IDMContext[] fParents;
@ -70,9 +72,10 @@ abstract public class AbstractDMContext extends PlatformObject
}
private boolean areParentsEqual(IDMContext[] otherParents) {
if ( !(fParents.length == otherParents.length) ) return false;
for (int i = 0; i < fParents.length; i++) {
if (!fParents[i].equals(otherParents[i])) {
IDMContext[] parents = getParents();
if ( !(parents.length == otherParents.length) ) return false;
for (int i = 0; i < parents.length; i++) {
if (!parents[i].equals(otherParents[i])) {
return false;
}
}
@ -95,14 +98,14 @@ abstract public class AbstractDMContext extends PlatformObject
*/
protected String baseToString() {
StringBuilder retVal = new StringBuilder();
for (IDMContext parent : fParents) {
for (IDMContext parent : getParents()) {
retVal.append(parent);
retVal.append(',');
}
if (retVal.length() > 0) {
retVal.deleteCharAt(retVal.length() - 1); // remove trailing comma
}
if (fParents.length > 1) {
if (getParents().length > 1) {
retVal.insert(0, '(');
retVal.insert(retVal.length(), ')');
}

View file

@ -73,7 +73,6 @@ public interface IFormattedValues extends IDsfService {
* DMC that represents a value with specific format. The format ID can be
* persisted and used for comparison.
*/
public static class FormattedValueDMContext extends AbstractDMContext
{
private final String fFormatID;
@ -81,16 +80,26 @@ public interface IFormattedValues extends IDsfService {
/**
* @since 2.0
*/
public FormattedValueDMContext(IDsfService service, IDMContext parent, String formatId) {
super(service, new IDMContext[] { parent });
public FormattedValueDMContext(IDsfService service, IDMContext parentValue, String formatId) {
super(service, new IDMContext[] { parentValue });
fFormatID = formatId;
}
public FormattedValueDMContext(String sessionId, IDMContext parent, String formatId) {
super(sessionId, new IDMContext[] { parent });
public FormattedValueDMContext(String sessionId, IDMContext parentValue, String formatId) {
super(sessionId, new IDMContext[] { parentValue });
fFormatID = formatId;
}
/**
* Returns the parent context which represents the value on which this
* formatted value is based on.
*
* @since 2.2
*/
public IDMContext getParentValueDMContext() {
return getParents()[0];
}
public String getFormatID() {
return fFormatID;
}