Examples of ICompositeNode


Examples of org.eclipse.xtext.nodemodel.ICompositeNode

    return comment != null ? comment : "";
  }

  private String findComment(EObject o) {
    String returnValue = null;
    ICompositeNode node = getNode(o);
    if (node == null) {
      return null;
    }
    // get the last multiple-line comment before a non hidden leaf node
    for (INode currentNode : node.getAsTreeIterable()) {
      if (!nodes.isHiddenLeafNode(currentNode)) {
        continue;
      }
      if (!nodes.isMultipleLineComment(currentNode)) {
        continue;
View Full Code Here

Examples of org.eclipse.xtext.nodemodel.ICompositeNode

  @Inject private INodes nodes;

  private final Cache<String, Pattern> patternCache = newBuilder().maximumSize(20).build(new PatternCacheLoader());

  Pair<INode, Matcher> matchingCommentNode(EObject target, String... patternsToMatch) {
    ICompositeNode node = getNode(target);
    for (INode currentNode : node.getAsTreeIterable()) {
      if (!nodes.isHiddenLeafNode(currentNode) || !nodes.isComment(currentNode)) {
        continue;
      }
      String rawComment = ((ILeafNode) currentNode).getText();
      if (isEmpty(rawComment)) {
View Full Code Here

Examples of org.eclipse.xtext.nodemodel.ICompositeNode

    }else if(obj instanceof StringLiteral){
      //in particular for folding, the significant region would otherwise be a
      //potential type of language keyword
      return getSignificantTextRegion(obj, XturtlePackage.Literals.LITERAL__VALUE,-1);
    } else if(obj instanceof BlankObjects || obj instanceof BlankCollection){
      ICompositeNode node = NodeModelUtils.findActualNodeFor(obj);
      return new TextRegion(node.getOffset(), 1);
    }
    return super.getSignificantTextRegion(obj);
  }
View Full Code Here

Examples of org.eclipse.xtext.nodemodel.ICompositeNode

      EObject crossLinkedEObject = eObjectAtOffsetHelper.resolveCrossReferencedElementAt(resource, offset);
      if (crossLinkedEObject != null) {
        if (crossLinkedEObject.eIsProxy()) {
          EObject o = eObjectAtOffsetHelper.resolveContainedElementAt(resource, offset);
          if (o != null) {
            ICompositeNode node = NodeModelUtils.getNode(o);
            IRegion region = new Region(node.getOffset(),node.getLength());
            if (TextUtilities.overlaps(region, new Region(offset, 0)))
              return Tuples.create(o, region);
          }
        }
      }
View Full Code Here

Examples of org.eclipse.xtext.nodemodel.ICompositeNode

  }
 
  protected Object internalEvaluate(final XExpression expression, final IEvaluationContext context, final CancelIndicator indicator) {
    Object _xblockexpression = null;
    {
      ICompositeNode _findActualNodeFor = NodeModelUtils.findActualNodeFor(expression);
      int _startLine = 0;
      if (_findActualNodeFor!=null) {
        _startLine=_findActualNodeFor.getStartLine();
      }
      final int line = _startLine;
      if (((line - 1) == this.stopAtLine)) {
        throw new StopLineReachedException();
      }
View Full Code Here

Examples of org.eclipse.xtext.nodemodel.ICompositeNode

  public String findTask(final XtextResource res, final int offset) {
    if ((offset < 0)) {
      return null;
    }
    IParseResult _parseResult = res.getParseResult();
    ICompositeNode _rootNode = _parseResult.getRootNode();
    final ILeafNode start = NodeModelUtils.findLeafNodeAtOffset(_rootNode, offset);
    boolean _isHidden = start.isHidden();
    if (_isHidden) {
      IParseResult _parseResult_1 = res.getParseResult();
      ICompositeNode _rootNode_1 = _parseResult_1.getRootNode();
      Iterable<ILeafNode> _leafNodes = _rootNode_1.getLeafNodes();
      final List<ILeafNode> list = IterableExtensions.<ILeafNode>toList(_leafNodes);
      final int index = list.indexOf(start);
      IntegerRange _upTo = new IntegerRange(index, 0);
      final Function1<Integer, Boolean> _function = new Function1<Integer, Boolean>() {
        public Boolean apply(final Integer it) {
View Full Code Here

Examples of org.eclipse.xtext.nodemodel.ICompositeNode

  public void doProvideHighlightingFor(final XtextResource resource, final IHighlightedPositionAcceptor acceptor) {
    super.doProvideHighlightingFor(resource, acceptor);
    acceptor.addPosition(0, 4, TemplateHighlightingConfiguration.TEXT);
    acceptor.addPosition(4, 1, TemplateHighlightingConfiguration.ESCAPE);
    IParseResult _parseResult = resource.getParseResult();
    ICompositeNode _rootNode = _parseResult.getRootNode();
    Iterable<ILeafNode> _leafNodes = _rootNode.getLeafNodes();
    for (final ILeafNode leafNode : _leafNodes) {
      boolean _isText = this.isText(leafNode);
      if (_isText) {
        int _offset = leafNode.getOffset();
        acceptor.addPosition(_offset, 1, TemplateHighlightingConfiguration.ESCAPE);
View Full Code Here

Examples of org.eclipse.xtext.nodemodel.ICompositeNode

    StringConcatenation _builder = new StringConcatenation();
    RequestType _requestType = route.getRequestType();
    String _name = _requestType.getName();
    _builder.append(_name, "");
    URL _url = route.getUrl();
    ICompositeNode _node = NodeModelUtils.getNode(_url);
    String _text = _node.getText();
    _builder.append(_text, "");
    return _builder.toString();
  }
View Full Code Here

Examples of org.eclipse.xtext.nodemodel.ICompositeNode

          @Override
          protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
            _builder.append(Pattern.class, "");
            _builder.append(".compile(\"");
            URL _url = route.getUrl();
            ICompositeNode _node = NodeModelUtils.getNode(_url);
            String _text = _node.getText();
            String _trim = _text.trim();
            URL _url_1 = route.getUrl();
            EList<Variable> _variables = _url_1.getVariables();
            String _regExPattern = RouteJvmModelInferrer.this.getRegExPattern(_trim, _variables);
            _builder.append(_regExPattern, "");
View Full Code Here

Examples of org.eclipse.xtext.nodemodel.ICompositeNode

import de.sebastianbenz.task.tagging.Region;

public class Contents {

  public static int offset(Content content) {
    ICompositeNode node = NodeModelUtils.getNode(content);
    return node.getOffset() + content.getIntend().length();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.