Exemplo n.º 1
0
 protected void moveUp(
     ICompositeNode node, ICompositeNode previousNode, IModificationContext context)
     throws BadLocationException {
   IXtextDocument document = context.getXtextDocument();
   String text = node.getText() + previousNode.getText();
   text = text.trim();
   remove(document, node);
   document.replace(previousNode.getOffset(), previousNode.getLength(), text);
 }
Exemplo n.º 2
0
 public String serialize(final EObject obj) {
   ICompositeNode _node = NodeModelUtils.getNode(obj);
   String _text = null;
   if (_node != null) {
     _text = _node.getText();
   }
   return _text;
 }
Exemplo n.º 3
0
 protected String serialize(final EObject obj) {
   final ICompositeNode node = NodeModelUtils.getNode(obj);
   boolean _equals = Objects.equal(node, null);
   if (_equals) {
     return "";
   }
   return node.getText();
 }
 public void assertNonSmoking(final CharSequence input) throws Exception {
   final String string = input.toString();
   final XtendFile file = this.file(string, false);
   boolean _notEquals = (!Objects.equal(file, null));
   if (_notEquals) {
     Resource _eResource = file.eResource();
     final XtextResource resource = ((XtextResource) _eResource);
     IParseResult _parseResult = resource.getParseResult();
     final ICompositeNode rootNode = _parseResult.getRootNode();
     ReplaceRegion region = null;
     BidiTreeIterable<INode> _asTreeIterable = rootNode.getAsTreeIterable();
     for (final INode node : _asTreeIterable) {
       {
         final int offset = node.getTotalOffset();
         final int length = node.getTotalLength();
         boolean _notEquals_1 = (length != 0);
         if (_notEquals_1) {
           boolean _or = false;
           boolean _or_1 = false;
           boolean _equals = Objects.equal(region, null);
           if (_equals) {
             _or_1 = true;
           } else {
             int _offset = region.getOffset();
             boolean _notEquals_2 = (_offset != offset);
             _or_1 = (_equals || _notEquals_2);
           }
           if (_or_1) {
             _or = true;
           } else {
             int _length = region.getLength();
             boolean _notEquals_3 = (_length != length);
             _or = (_or_1 || _notEquals_3);
           }
           if (_or) {
             ReplaceRegion _replaceRegion = new ReplaceRegion(offset, length, "");
             region = _replaceRegion;
             String _text = rootNode.getText();
             StringBuilder _stringBuilder = new StringBuilder(_text);
             final StringBuilder builder = _stringBuilder;
             region.applyTo(builder);
             String _string = builder.toString();
             this.processFile(_string);
           }
         }
       }
     }
   }
 }