Class CustomNodeModelUtils


  • public final class CustomNodeModelUtils
    extends Object
    Class contains util methods of NodeModelUtils with higher performance
    • Method Detail

      • findLeafNodeAtOffset

        public static org.eclipse.xtext.nodemodel.ILeafNode findLeafNodeAtOffset​(org.eclipse.xtext.nodemodel.INode node,
                                                                                 int leafNodeOffset)
        Find the leaf node at the given offset. May return null if the given offset is not valid for the node (sub-)tree. A node matches the leafNodeOffset if it fulfills the following condition:
          node.totalOffset <= leafNodeOffset &&
          node.totalEndOffset > leafNodeOffset
         
        This implementation is faster than original NodeModelUtils.findLeafNodeAtOffset(INode, int) for big node model
        Parameters:
        node - the container node. May not be null.
        leafNodeOffset - the offset that is covered by the searched node
        Returns:
        the leaf node at the given offset or null if node was not found
      • findLeafNodeAtOffsetStartFromBack

        public static org.eclipse.xtext.nodemodel.ILeafNode findLeafNodeAtOffsetStartFromBack​(org.eclipse.xtext.nodemodel.INode node,
                                                                                              int leafNodeOffset)
        Find the leaf node at the given offset, the search will be started from the last lead node child of node. May return null if the given offset is not valid for the node (sub-)tree. A node matches the leafNodeOffset if it fulfills the following condition:
          node.totalOffset <= leafNodeOffset &&
          node.totalEndOffset > leafNodeOffset
         
        This implementation is faster than original NodeModelUtils.findLeafNodeAtOffset(INode, int) for big node model
        Parameters:
        node - the container node. May not be null.
        leafNodeOffset - the offset that is covered by the searched node
        Returns:
        the leaf node at the given offset or null if node was not found