org.eclipse.xtext.formatting2.debug.TextRegionAccessToString Java Examples

The following examples show how to use org.eclipse.xtext.formatting2.debug.TextRegionAccessToString. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RegionAccessBuilderTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
private void operator_tripleEquals(final CharSequence file, final CharSequence expectation) {
  try {
    final String exp = expectation.toString();
    final Root obj = this.parseHelper.parse(file);
    this.validationTestHelper.assertNoErrors(obj);
    final ITextRegionAccess access1 = this.createFromNodeModel(obj);
    final ITextRegionAccess access2 = this.serializer.serializeToRegions(obj);
    this.assertToStringDoesNotCrash(access1);
    this.assertToStringDoesNotCrash(access2);
    this.assertLinesAreConsistent(access1);
    this.assertLinesAreConsistent(access2);
    TextRegionAccessToString _cfg = this.cfg(new TextRegionAccessToString().withRegionAccess(access1));
    final String tra1 = (_cfg + "\n");
    TextRegionAccessToString _cfg_1 = this.cfg(new TextRegionAccessToString().withRegionAccess(access2));
    final String tra2 = (_cfg_1 + "\n");
    Assert.assertEquals(Strings.toPlatformLineSeparator(exp), Strings.toPlatformLineSeparator(tra1));
    Assert.assertEquals(Strings.toPlatformLineSeparator(exp), Strings.toPlatformLineSeparator(tra2));
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example #2
Source File: StringBasedTextRegionAccessDiffBuilder.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String toString() {
	try {
		StringBasedTextRegionAccessDiff regions = create();
		return new TextRegionAccessToString().withRegionAccess(regions).toString();
	} catch (Throwable t) {
		return t.getMessage() + "\n" + Throwables.getStackTraceAsString(t);
	}
}
 
Example #3
Source File: RegionAccessTestHelper.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public void operator_tripleEquals(ITextRegionAccess access, CharSequence expectation) {
	if (access instanceof ITextRegionAccessDiff) {
		assertDiffs((ITextRegionAccessDiff) access);
	}
	String tra1 = cfg(new TextRegionAccessToString().withRegionAccess(access)) + "\n";
	Assert.assertEquals(Strings.toPlatformLineSeparator(expectation), Strings.toPlatformLineSeparator(tra1));
}
 
Example #4
Source File: FormatterTester.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
protected String toString(ITextRegionAccess nmRegions) {
	return new TextRegionAccessToString().withRegionAccess(nmRegions).hideColumnExplanation() + "\n";
}
 
Example #5
Source File: FormatterTester.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected String toString(ITextRegionAccess nmRegions) {
	return new TextRegionAccessToString().withRegionAccess(nmRegions).hideColumnExplanation() + "\n";
}
 
Example #6
Source File: AbstractRegionAccess.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public String toString() {
	return new TextRegionAccessToString().withRegionAccess(this).toString();
}
 
Example #7
Source File: StringRegion.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public String toString() {
	return new TextRegionAccessToString().withOrigin(this).hightlightOrigin().toString();
}
 
Example #8
Source File: NodeRegion.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public String toString() {
	return new TextRegionAccessToString().withOrigin(this).hightlightOrigin().toString();
}
 
Example #9
Source File: AbstractHiddenRegion.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public String toString() {
	return new TextRegionAccessToString().withOrigin(this).hightlightOrigin().toString();
}
 
Example #10
Source File: ChangeSerializerTestHelper.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void operator_tripleEquals(ITextRegionAccess actual, CharSequence expected) {
	String actualString = new TextRegionAccessToString().withRegionAccess(actual).hideColumnExplanation()
			.toString();
	Assert.assertEquals(Strings.toPlatformLineSeparator(expected).trim(),
			Strings.toPlatformLineSeparator(actualString).trim());
}
 
Example #11
Source File: ImportTestHelper.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void operator_tripleEquals(ITextRegionAccess actual, CharSequence expected) {
	String actualString = new TextRegionAccessToString().withRegionAccess(actual).hideColumnExplanation()
			.toString();
	Assert.assertEquals(expected.toString().trim(), actualString.trim());
}
 
Example #12
Source File: FormatterTestHelper.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
protected String toString(ITextRegionAccess nmRegions) {
	return new TextRegionAccessToString().withRegionAccess(nmRegions).hideColumnExplanation() + "\n";
}
 
Example #13
Source File: RegionAccessTestHelper.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
private TextRegionAccessToString cfg(TextRegionAccessToString toStr) {
	return toStr.hideColumnExplanation().withTextWidth(10);
}
 
Example #14
Source File: RegionAccessBuilderTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
private TextRegionAccessToString cfg(final TextRegionAccessToString toStr) {
  return toStr.hideColumnExplanation().withTextWidth(10);
}