Search in sources :

Example 1 with TextRegionsWithTitleToString

use of org.eclipse.xtext.formatting2.debug.TextRegionsWithTitleToString in project xtext-core by eclipse.

the class RegionsOutsideFrameException method getMessage.

@Override
public String getMessage() {
    String regionsStr;
    if (regions.length == 1) {
        regionsStr = "region " + regions[0].getFirst();
    } else {
        List<String> titles = Lists.newArrayList();
        for (Pair<String, ITextSegment> p : regions) titles.add(p.getFirst());
        regionsStr = "regions " + Joiner.on(", ").join(titles);
    }
    StringBuilder builder = new StringBuilder();
    builder.append("The " + regionsStr + " must not be outside " + frameTitle + ".\n");
    TextRegionsWithTitleToString toStr = new TextRegionsWithTitleToString();
    toStr.add(frameTitle, frameRegion);
    for (Pair<String, ITextSegment> p : regions) toStr.add(p.getFirst(), p.getSecond());
    builder.append(toStr);
    return builder.toString();
}
Also used : TextRegionsWithTitleToString(org.eclipse.xtext.formatting2.debug.TextRegionsWithTitleToString) ITextSegment(org.eclipse.xtext.formatting2.regionaccess.ITextSegment) TextRegionsWithTitleToString(org.eclipse.xtext.formatting2.debug.TextRegionsWithTitleToString)

Example 2 with TextRegionsWithTitleToString

use of org.eclipse.xtext.formatting2.debug.TextRegionsWithTitleToString in project xtext-core by eclipse.

the class ConflictingRegionsException method getMessage.

@Override
public String getMessage() {
    StringBuilder builder = new StringBuilder();
    builder.append(super.getMessage() + ".\n");
    TextRegionsWithTitleToString toStr = new TextRegionsWithTitleToString();
    for (RegionTrace trace : traces) toStr.add(trace.getMessage(), trace.getRegion());
    builder.append(toStr);
    return builder.toString();
}
Also used : TextRegionsWithTitleToString(org.eclipse.xtext.formatting2.debug.TextRegionsWithTitleToString)

Aggregations

TextRegionsWithTitleToString (org.eclipse.xtext.formatting2.debug.TextRegionsWithTitleToString)2 ITextSegment (org.eclipse.xtext.formatting2.regionaccess.ITextSegment)1