コード例 #1
0
 private static boolean isLiteral(PsiElement element) {
   if (element == null) return false;
   final ASTNode astNode = element.getNode();
   if (astNode == null) {
     return false;
   }
   final IElementType elementType = astNode.getElementType();
   final ParserDefinition parserDefinition =
       LanguageParserDefinitions.INSTANCE.forLanguage(element.getLanguage());
   if (parserDefinition != null) {
     final TokenSet literals = parserDefinition.getStringLiteralElements();
     return literals.contains(elementType);
   }
   return false;
 }
コード例 #2
0
 private static boolean isStringLiteral(PsiElement element, ParserDefinition definition) {
   return PlatformPatterns.psiElement()
       .withElementType(definition.getStringLiteralElements())
       .accepts(element);
 }