mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 04:45:38 +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:
parent
159c91c678
commit
b2dd37899a
2 changed files with 22 additions and 10 deletions
|
@ -35,6 +35,8 @@ import org.eclipse.core.runtime.PlatformObject;
|
||||||
abstract public class AbstractDMContext extends PlatformObject
|
abstract public class AbstractDMContext extends PlatformObject
|
||||||
implements IDMContext
|
implements IDMContext
|
||||||
{
|
{
|
||||||
|
public static final IDMContext[] EMPTY_PARENTS_ARRAY = new IDMContext[0];
|
||||||
|
|
||||||
private final String fSessionId;
|
private final String fSessionId;
|
||||||
private final IDMContext[] fParents;
|
private final IDMContext[] fParents;
|
||||||
|
|
||||||
|
@ -70,9 +72,10 @@ abstract public class AbstractDMContext extends PlatformObject
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean areParentsEqual(IDMContext[] otherParents) {
|
private boolean areParentsEqual(IDMContext[] otherParents) {
|
||||||
if ( !(fParents.length == otherParents.length) ) return false;
|
IDMContext[] parents = getParents();
|
||||||
for (int i = 0; i < fParents.length; i++) {
|
if ( !(parents.length == otherParents.length) ) return false;
|
||||||
if (!fParents[i].equals(otherParents[i])) {
|
for (int i = 0; i < parents.length; i++) {
|
||||||
|
if (!parents[i].equals(otherParents[i])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,14 +98,14 @@ abstract public class AbstractDMContext extends PlatformObject
|
||||||
*/
|
*/
|
||||||
protected String baseToString() {
|
protected String baseToString() {
|
||||||
StringBuilder retVal = new StringBuilder();
|
StringBuilder retVal = new StringBuilder();
|
||||||
for (IDMContext parent : fParents) {
|
for (IDMContext parent : getParents()) {
|
||||||
retVal.append(parent);
|
retVal.append(parent);
|
||||||
retVal.append(',');
|
retVal.append(',');
|
||||||
}
|
}
|
||||||
if (retVal.length() > 0) {
|
if (retVal.length() > 0) {
|
||||||
retVal.deleteCharAt(retVal.length() - 1); // remove trailing comma
|
retVal.deleteCharAt(retVal.length() - 1); // remove trailing comma
|
||||||
}
|
}
|
||||||
if (fParents.length > 1) {
|
if (getParents().length > 1) {
|
||||||
retVal.insert(0, '(');
|
retVal.insert(0, '(');
|
||||||
retVal.insert(retVal.length(), ')');
|
retVal.insert(retVal.length(), ')');
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,6 @@ public interface IFormattedValues extends IDsfService {
|
||||||
* DMC that represents a value with specific format. The format ID can be
|
* DMC that represents a value with specific format. The format ID can be
|
||||||
* persisted and used for comparison.
|
* persisted and used for comparison.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static class FormattedValueDMContext extends AbstractDMContext
|
public static class FormattedValueDMContext extends AbstractDMContext
|
||||||
{
|
{
|
||||||
private final String fFormatID;
|
private final String fFormatID;
|
||||||
|
@ -81,16 +80,26 @@ public interface IFormattedValues extends IDsfService {
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public FormattedValueDMContext(IDsfService service, IDMContext parent, String formatId) {
|
public FormattedValueDMContext(IDsfService service, IDMContext parentValue, String formatId) {
|
||||||
super(service, new IDMContext[] { parent });
|
super(service, new IDMContext[] { parentValue });
|
||||||
fFormatID = formatId;
|
fFormatID = formatId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FormattedValueDMContext(String sessionId, IDMContext parent, String formatId) {
|
public FormattedValueDMContext(String sessionId, IDMContext parentValue, String formatId) {
|
||||||
super(sessionId, new IDMContext[] { parent });
|
super(sessionId, new IDMContext[] { parentValue });
|
||||||
fFormatID = formatId;
|
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() {
|
public String getFormatID() {
|
||||||
return fFormatID;
|
return fFormatID;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue