Package com.e1c.langtool.v8.dt.ql
Class QlUtil
java.lang.Object
com.e1c.langtool.v8.dt.ql.QlUtil
The QL utility functions.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcleanUpQueryCache(QuerySchema object) Clean up query cache than may holds reference to the query schema objects.static voidcollectComments(org.eclipse.emf.ecore.EObject object, CollectingContext context, Set<Integer> processedNode, org.eclipse.core.runtime.IProgressMonitor monitor) Collect comments.static voidcollectComments(org.eclipse.emf.ecore.EObject object, CollectingContext context, org.eclipse.core.runtime.IProgressMonitor monitor) Collect comments.static StringformatForStringLiteralContent(String content) Format string forStringLiteralExpressioncontent.static @NonNull StringgetActualQueryText(@NonNull String content) Gets the actual query text without leading package separator or QL keywordUNIONorUNION ALL.static @NonNull String[]getActualQueryText(@NonNull String[] lines) Gets the actual query text without leading package separator or QL keywordUNIONorUNION ALL.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.static FeatureKeygetCommentFeatureKey(ITranslationFeatureKeyProvider provider, org.eclipse.emf.ecore.EObject owner, String text) Gets the comment feature key.getCommentLines(List<org.eclipse.xtext.nodemodel.INode> nodes) Gets string content of the comment lines.static StringgetCommentText(List<org.eclipse.xtext.nodemodel.ILeafNode> comments) Gets the comment text.static StringgetStringLiteralContent(StringLiteralExpression literal, boolean trimContent) Gets the string ofStringLiteralExpressioncontent.static booleanisCommentNode(org.eclipse.xtext.nodemodel.ILeafNode leafNode) ChecksILeafNodeis comment node in Ql grammarstatic booleanisQueryText(@Nullable String content) Check if string content is Query text.
-
Field Details
-
QUERY_PACKAGE_SEPARATOR
- See Also:
-
QUOTE
- See Also:
-
STRING_LINE_SEPARATOR
- See Also:
-
COMMENT_START_TAG
- See Also:
-
QL_DCS_FILE_EXT
- See Also:
-
QL_FILE_EXT
- See Also:
-
QUERY_UNION
- See Also:
-
QUERY_UNION_RU
- See Also:
-
QUERY_UNION_ALL
- See Also:
-
QUERY_UNION_ALL_RU
- See Also:
-
-
Method Details
-
isQueryText
Check if string content is Query text.- Parameters:
content- the string content, can benull- Returns:
- true, if the content is query text
-
getActualQueryText
Gets the actual query text without leading package separator or QL keywordUNIONorUNION ALL. Note! That the source content will be split into lines by\nseparator and then back joined with\ndelimiter.- Parameters:
content- the content, cannot benull.- Returns:
- the actual query text, cannot return
null.
-
getActualQueryText
Gets the actual query text without leading package separator or QL keywordUNIONorUNION ALL.- Parameters:
content- the content, cannot benull.- Returns:
- the actual query text, cannot return
null.
-
cleanUpQueryCache
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 benull.
-
getStringLiteralContent
Gets the string ofStringLiteralExpressioncontent.- Parameters:
literal- the literaltrimContent- 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
Format string forStringLiteralExpressioncontent.- 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) ChecksILeafNodeis comment node in Ql grammar- Parameters:
leafNode- checking node, cannot benull- Returns:
trueif node is Ql comment node,falseotherwise
-
getCommentText
Gets the comment text.- Parameters:
comments- the comments- Returns:
- the comment text
-
getCommentLines
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 providerowner- the ownertext- 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 objectcontext- the contextmonitor- 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 objectcontext- the contextprocessedNode- the processed nodemonitor- the monitor
-