Java Code Examples for org.eclipse.xtext.formatting2.IHiddenRegionFormatting#setSpace()

The following examples show how to use org.eclipse.xtext.formatting2.IHiddenRegionFormatting#setSpace() . 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: RichStringFormatter.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void setSpace(final IFormattableDocument doc, final int offset, final int length, final String space) {
  IHiddenRegionFormatting _createHiddenRegionFormatting = doc.getFormatter().createHiddenRegionFormatting();
  final Procedure1<IHiddenRegionFormatting> _function = (IHiddenRegionFormatting it) -> {
    it.setSpace(space);
  };
  final IHiddenRegionFormatting fmt = ObjectExtensions.<IHiddenRegionFormatting>operator_doubleArrow(_createHiddenRegionFormatting, _function);
  AbstractFormatter2 _formatter = doc.getFormatter();
  ITextRegionAccess _textRegionAccess = this._iTextRegionExtensions.getTextRegionAccess();
  TextSegment _textSegment = new TextSegment(_textRegionAccess, offset, length);
  final ITextReplacer replacer = _formatter.createWhitespaceReplacer(_textSegment, fmt);
  doc.addReplacer(replacer);
}
 
Example 2
Source File: RichStringFormatter.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void _suppressLineWraps(final IHiddenRegionFormatting it) {
  String _space = it.getSpace();
  boolean _tripleEquals = (_space == null);
  if (_tripleEquals) {
    it.setSpace(" ");
  }
  it.setNewLinesMin(null);
  it.setNewLinesDefault(null);
  it.setNewLinesMax(null);
  it.setAutowrap(null);
}