Class QlUtil

java.lang.Object
com.e1c.langtool.v8.dt.ql.QlUtil

public final class QlUtil extends Object
The QL utility functions.
  • Field Details

  • Method Details

    • isQueryText

      public static boolean isQueryText(@Nullable String content)
      Check if string content is Query text.
      Parameters:
      content - the string content, can be null
      Returns:
      true, if the content is query text
    • getActualQueryText

      public static @NonNull String getActualQueryText(@NonNull String content)
      Gets the actual query text without leading package separator or QL keyword UNION or UNION ALL. Note! That the source content will be split into lines by \n separator and then back joined with \n delimiter.
      Parameters:
      content - the content, cannot be null.
      Returns:
      the actual query text, cannot return null.
    • getActualQueryText

      public static @NonNull String[] getActualQueryText(@NonNull String[] lines)
      Gets the actual query text without leading package separator or QL keyword UNION or UNION ALL.
      Parameters:
      content - the content, cannot be null.
      Returns:
      the actual query text, cannot return null.
    • cleanUpQueryCache

      public static void cleanUpQueryCache(QuerySchema object)
      Clean up query cache than may holds reference to the query schema objects. This method also cleans any cache for nested query schemas.
      Parameters:
      object - the query schema object, cannot be null.
    • getStringLiteralContent

      public static String getStringLiteralContent(StringLiteralExpression literal, boolean trimContent)
      Gets the string of StringLiteralExpression content.
      Parameters:
      literal - the literal
      trimContent - the trim content
      Returns:
      the string of literal content with removed quotes from both sides and conveted double-qoutes to sinle quotes, never returns null.
    • formatForStringLiteralContent

      public static String formatForStringLiteralContent(String content)
      Format string for StringLiteralExpression content.
      Parameters:
      content - the content
      Returns:
      the formated string with quotes on both sides and converted qouts to double qoutes.
    • isCommentNode

      public static boolean isCommentNode(org.eclipse.xtext.nodemodel.ILeafNode leafNode)
      Checks ILeafNode is comment node in Ql grammar
      Parameters:
      leafNode - checking node, cannot be null
      Returns:
      true if node is Ql comment node, false otherwise
    • getCommentText

      public static String getCommentText(List<org.eclipse.xtext.nodemodel.ILeafNode> comments)
      Gets the comment text.
      Parameters:
      comments - the comments
      Returns:
      the comment text
    • getCommentLines

      public static List<String> getCommentLines(List<org.eclipse.xtext.nodemodel.INode> nodes)
      Gets string content of the comment lines.
      Parameters:
      nodes - the adjacent nodes
      Returns:
      the comment lines
    • getCommentBlock

      public static List<org.eclipse.xtext.nodemodel.ILeafNode> getCommentBlock(org.eclipse.xtext.nodemodel.ILeafNode node)
      Collects all comment lines that are not separated from the incoming comment by a non-comment line.
      Parameters:
      node - the node of an incoming comment that is part of an entire block of comments. It can be the first line of the comment, the last, or any line between the first and the last.
      Returns:
      the nodes of all comment lines that are not separated from the incoming comment by a non-comment line.
    • getCommentFeatureKey

      public static FeatureKey getCommentFeatureKey(ITranslationFeatureKeyProvider provider, org.eclipse.emf.ecore.EObject owner, String text)
      Gets the comment feature key.
      Parameters:
      provider - the provider
      owner - the owner
      text - the text
      Returns:
      the comment feature key
    • collectComments

      public static void collectComments(org.eclipse.emf.ecore.EObject object, CollectingContext context, org.eclipse.core.runtime.IProgressMonitor monitor)
      Collect comments.
      Parameters:
      object - the object
      context - the context
      monitor - the monitor
    • collectComments

      public static void collectComments(org.eclipse.emf.ecore.EObject object, CollectingContext context, Set<Integer> processedNode, org.eclipse.core.runtime.IProgressMonitor monitor)
      Collect comments.
      Parameters:
      object - the object
      context - the context
      processedNode - the processed node
      monitor - the monitor