Java Code Examples for com.intellij.lang.ASTNode.getTreeParent()

The following are Jave code examples for showing how to use getTreeParent() of the com.intellij.lang.ASTNode class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: AppleScript-IDEA   File: AppleScriptSpacingProcessor.java   Source Code and License Vote up 6 votes
private void _init(@Nullable final ASTNode child) {
  if (child == null) return;

  ASTNode treePrev = child.getTreePrev();
  while (treePrev != null && isWhiteSpace(treePrev)) {
    treePrev = treePrev.getTreePrev();
  }

  if (treePrev == null) {
    _init(child.getTreeParent());
  } else {
    myChild2 = child;
    myType2 = myChild2.getElementType();

    myChild1 = treePrev;
    myType1 = myChild1.getElementType();
    final CompositeElement parent = (CompositeElement) treePrev.getTreeParent();
    myParent = SourceTreeToPsiMap.treeElementToPsi(parent);
  }
}
 
Example 2
Project: intellij-csv-validator   File: CsvFormatHelper.java   Source Code and License Vote up 5 votes
public static ASTNode getRoot(ASTNode node) {
    ASTNode parent;
    while ((parent = node.getTreeParent()) != null) {
        node = parent;
    }
    return node;
}