mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-22 08:25:25 +02:00
[291548] DMContext.toString() not handling multi-parent scenario well
This commit is contained in:
parent
cdf996fee1
commit
e61498f16f
1 changed files with 16 additions and 2 deletions
|
@ -87,10 +87,24 @@ abstract public class AbstractDMContext extends PlatformObject
|
||||||
return getSessionId().hashCode() + parentsHash;
|
return getSessionId().hashCode() + parentsHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a stringified representation of our parent context. If we have
|
||||||
|
* more than one parent, the parents are separated by commas, and
|
||||||
|
* the entire collection is wrapped with parenthesis:
|
||||||
|
* "(p1,p2,...,pn)"
|
||||||
|
*/
|
||||||
protected String baseToString() {
|
protected String baseToString() {
|
||||||
StringBuffer retVal = new StringBuffer();
|
StringBuilder retVal = new StringBuilder();
|
||||||
for (IDMContext parent : fParents) {
|
for (IDMContext parent : fParents) {
|
||||||
retVal.append(parent);
|
retVal.append(parent);
|
||||||
|
retVal.append(',');
|
||||||
|
}
|
||||||
|
if (retVal.length() > 0) {
|
||||||
|
retVal.deleteCharAt(retVal.length() - 1); // remove trailing comma
|
||||||
|
}
|
||||||
|
if (fParents.length > 1) {
|
||||||
|
retVal.insert(0, '(');
|
||||||
|
retVal.insert(retVal.length(), ')');
|
||||||
}
|
}
|
||||||
return retVal.toString();
|
return retVal.toString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue