当前位置: 首页>>代码示例>>Java>>正文


Java Tokenizer类代码示例

本文整理汇总了Java中com.intellij.spellchecker.tokenizer.Tokenizer的典型用法代码示例。如果您正苦于以下问题:Java Tokenizer类的具体用法?Java Tokenizer怎么用?Java Tokenizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Tokenizer类属于com.intellij.spellchecker.tokenizer包,在下文中一共展示了Tokenizer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
  if (element instanceof PsiMethod) {
    return myMethodNameTokenizer;
  }
  if (element instanceof PsiDocComment) {
    return myDocCommentTokenizer;
  }
  if (element instanceof PsiLiteralExpression) {
    if (SuppressManager.isSuppressedInspectionName((PsiLiteralExpression)element)) {
      return EMPTY_TOKENIZER;
    }
    return myLiteralExpressionTokenizer;
  }
  if (element instanceof PsiNamedElement) {
    return myNamedElementTokenizer;
  }

  return super.getTokenizer(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:JavaSpellcheckingStrategy.java

示例2: getTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
  // Only allow print and println strings to be tokenized. We don't want to flag
  // strings in Gradle files that are not under the user's control: names of
  // dependencies, names of plugins, names of class path elements, etc. Turns
  // out there are a lot of different forms of these, so rather than trying to
  // blacklist all the types of strings we don't want to spell check, instead we
  // simply whitelist "print" and "println":
  if (TokenSets.STRING_LITERAL_SET.contains(element.getNode().getElementType()) &&
      !isPrint(element)) {
    // If this element references some external name, such as a dependency or an
    // application package, there is no point in flagging it since the user can't
    // change it
    return EMPTY_TOKENIZER;
  }

  return super.getTokenizer(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AndroidGradleSpellcheckingStrategy.java

示例3: getTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
  if (TokenSets.STRING_LITERAL_SET.contains(element.getNode().getElementType())) {
    return myStringTokenizer;
  }
  if (element instanceof GrNamedElement) {
    final PsiElement name = ((GrNamedElement)element).getNameIdentifierGroovy();
    if (TokenSets.STRING_LITERAL_SET.contains(name.getNode().getElementType())) {
      return EMPTY_TOKENIZER;
    }
  }
  if (element instanceof PsiDocComment) return myDocCommentTokenizer;
  //if (element instanceof GrLiteralImpl && ((GrLiteralImpl)element).isStringLiteral()) return myStringTokenizer;
  return super.getTokenizer(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GroovySpellcheckingStrategy.java

示例4: getTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
    if (element instanceof PsiWhiteSpace) {
        return EMPTY_TOKENIZER;
    }
    if (element instanceof PsiNameIdentifierOwner) {
        return new PsiIdentifierOwnerTokenizer();
    }
    if (element.getParent() instanceof PsiNameIdentifierOwner) {
        return EMPTY_TOKENIZER;
    }
    if (element.getNode().getElementType() == JSGraphQLEndpointTokenTypes.IDENTIFIER) {
        return IDENTIFIER_TOKENIZER;
    }
    if (element instanceof PsiComment) {
        if (SuppressionUtil.isSuppressionComment(element)) {
            return EMPTY_TOKENIZER;
        }
        return myCommentTokenizer;
    }
    return EMPTY_TOKENIZER;
}
 
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:24,代码来源:JSGraphQLEndpointSpellcheckingStrategy.java

示例5: getTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {

    if(!(element instanceof StringLiteralExpression)) {
        return super.getTokenizer(element);
    }

    if(!ProjectComponent.isEnabled(element.getProject())) {
        return super.getTokenizer(element);
    }

    Container container = Utils.findContainerForPimpleArrayAccessLiteral((StringLiteralExpression) element);
    if (container == null) {

        container = Utils.findContainerForFirstParameterOfPimpleMethod((StringLiteralExpression) element);
        if (container == null) {
            return super.getTokenizer(element);
        }
    }

    return DUMMY_TOKENIZER;
}
 
开发者ID:Sorien,项目名称:silex-idea-plugin,代码行数:24,代码来源:SpellcheckingStrategy.java

示例6: getTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
  if (element instanceof JsonStringLiteral) {
    return ourStringLiteralTokenizer;
  }
  return super.getTokenizer(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:JsonSpellcheckerStrategy.java

示例7: getTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
  IElementType elementType = element.getNode().getElementType();
  if (elementType == RestTokenTypes.FIELD ||
      elementType == RestTokenTypes.CUSTOM_DIRECTIVE ||
      elementType == RestTokenTypes.REST_DJANGO_INJECTION ||
      elementType == RestTokenTypes.REST_INJECTION) {
    return EMPTY_TOKENIZER;
  }
  if (element instanceof LeafPsiElement && element.getLanguage() == RestLanguage.INSTANCE) {
    return REST_ELEMENT_TOKENIZER;
  }
  return EMPTY_TOKENIZER;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:RestSpellcheckerStrategy.java

示例8: getTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
  if (element instanceof PyStringLiteralExpression) {
    PsiElement parent = element.getParent();
    if (parent instanceof PyBinaryExpression) {
      PyBinaryExpression binaryExpression = (PyBinaryExpression)parent;
      if (element == binaryExpression.getLeftExpression() && binaryExpression.getOperator() == PyTokenTypes.PERC) {
        return myFormatStringTokenizer;
      }
    }
    return myStringLiteralTokenizer;
  }
  return super.getTokenizer(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:PythonSpellcheckerStrategy.java

示例9: getTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
  if (isAttributeValueContext(element)) {
    return getAttributeValueTokenizer(element);
  }

  if (inEnglish(element)) {
    return super.getTokenizer(element);
  }

  return EMPTY_TOKENIZER;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:AndroidXmlSpellcheckingStrategy.java

示例10: getAttributeValueTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
@NotNull
public Tokenizer getAttributeValueTokenizer(PsiElement element) {
  assert element instanceof XmlAttributeValue;

  if (AndroidResourceUtil.isIdDeclaration((XmlAttributeValue)element)) {
    return myAttributeValueRenamingTokenizer;
  }
  final PsiElement parent = element.getParent();

  if (parent instanceof XmlAttribute) {
    final String value = ((XmlAttribute)parent).getValue();

    if (value != null) {
      final GenericAttributeValue domValue = DomManager.getDomManager(
        parent.getProject()).getDomElement((XmlAttribute)parent);

      if (domValue != null) {
        final Converter converter = domValue.getConverter();

        if (converter instanceof ResourceReferenceConverter) {
          return myResourceReferenceTokenizer;
        }
        else if (converter instanceof ConstantFieldConverter) {
          return EMPTY_TOKENIZER;
        }
        else if (converter instanceof ResourceNameConverter || converter instanceof AndroidPackageConverter) {
          return myAttributeValueRenamingTokenizer;
        }
      }
    }
  }
  return super.getTokenizer(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:AndroidXmlSpellcheckingStrategy.java

示例11: getTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
  if (element instanceof PropertyValueImpl) {
    return myPropertyValueTokenizer;
  }
  if (element instanceof PropertyKeyImpl) {
    return myPropertyTokenizer;
  }
  return super.getTokenizer(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PropertiesSpellcheckingStrategy.java

示例12: getTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
    IElementType elementType = element.getNode().getElementType();

    if (elementType instanceof MultiMarkdownTokenType || elementType instanceof MultiMarkdownElementType) {
        if (NO_SPELL_CHECK_SET.contains(elementType)) {
            //logger.info("empty tokenizer for " + element.toString());
            return EMPTY_TOKENIZER;
        }

        // here we can return custom tokenizers if needed
        //logger.info("text tokenizer for " + element.toString());
        if (element instanceof MultiMarkdownNamedElement) {
            //logger.info("identifier tokenizer for " + element.toString());
            return IDENTIFIER_TOKENIZER;
        }

        // this is to prevent two spelling errors for every occurence but these are rename and change to so we'll keep them
        //if (NO_SPELL_LEAF_SET.contains(elementType)) {
        //    return EMPTY_TOKENIZER;
        //}

        return TEXT_TOKENIZER;
    }
    return super.getTokenizer(element);
}
 
开发者ID:vsch,项目名称:idea-multimarkdown,代码行数:28,代码来源:MultiMarkdownSpellcheckingStrategy.java

示例13: getTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
/**
 * Provides {@link #TEXT_TOKENIZER} for {@link LatexText} elements.
 *
 * @param element to check
 * @return {@link #TEXT_TOKENIZER} for {@link LatexText} or {@link #EMPTY_TOKENIZER}.
 */
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
    if (element instanceof LatexText) {
        return TEXT_TOKENIZER;
    }
    return EMPTY_TOKENIZER;
}
 
开发者ID:hsz,项目名称:idea-latex,代码行数:15,代码来源:LatexSpellcheckingStrategy.java

示例14: getTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
  if (element instanceof PropertyValueImpl) {
    return myPropertyValueTokenizer;
  }
  if (element instanceof PropertyImpl) {
    return myPropertyTokenizer;
  }
  return super.getTokenizer(element);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:PropertiesSpellcheckingStrategy.java

示例15: getTokenizer

import com.intellij.spellchecker.tokenizer.Tokenizer; //导入依赖的package包/类
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element)
{
	if(element instanceof PsiNameIdentifierOwner)
	{
		return ourNameTokenizer;
	}
	return super.getTokenizer(element);
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:11,代码来源:CSharpSpellcheckingStrategy.java


注:本文中的com.intellij.spellchecker.tokenizer.Tokenizer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。