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

The following examples show how to use org.eclipse.xtext.formatting2.debug.TextRegionAccessToString. These examples are extracted from open source projects. 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
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
@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 Project: xtext-core   Source File: RegionAccessTestHelper.java    License: 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 Project: xtext-extras   Source File: FormatterTester.java    License: 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 Project: xtext-eclipse   Source File: FormatterTester.java    License: 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 Project: xtext-core   Source File: AbstractRegionAccess.java    License: Eclipse Public License 2.0 4 votes vote down vote up
@Override
public String toString() {
	return new TextRegionAccessToString().withRegionAccess(this).toString();
}
 
Example 7
Source Project: xtext-core   Source File: StringRegion.java    License: 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 Project: xtext-core   Source File: NodeRegion.java    License: 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 Project: xtext-core   Source File: AbstractHiddenRegion.java    License: Eclipse Public License 2.0 4 votes vote down vote up
@Override
public String toString() {
	return new TextRegionAccessToString().withOrigin(this).hightlightOrigin().toString();
}
 
Example 10
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 Project: xtext-core   Source File: ImportTestHelper.java    License: 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 Project: xtext-core   Source File: FormatterTestHelper.java    License: 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 Project: xtext-core   Source File: RegionAccessTestHelper.java    License: Eclipse Public License 2.0 4 votes vote down vote up
private TextRegionAccessToString cfg(TextRegionAccessToString toStr) {
	return toStr.hideColumnExplanation().withTextWidth(10);
}
 
Example 14
private TextRegionAccessToString cfg(final TextRegionAccessToString toStr) {
  return toStr.hideColumnExplanation().withTextWidth(10);
}