本文整理汇总了Java中com.intellij.patterns.PsiJavaPatterns类的典型用法代码示例。如果您正苦于以下问题:Java PsiJavaPatterns类的具体用法?Java PsiJavaPatterns怎么用?Java PsiJavaPatterns使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PsiJavaPatterns类属于com.intellij.patterns包,在下文中一共展示了PsiJavaPatterns类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: recursionFilter
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
@Nullable
static ElementFilter recursionFilter(PsiElement element) {
if (PsiJavaPatterns.psiElement().afterLeaf(PsiKeyword.RETURN).inside(PsiReturnStatement.class).accepts(element)) {
return new ExcludeDeclaredFilter(ElementClassFilter.METHOD);
}
if (PsiJavaPatterns.psiElement().inside(
StandardPatterns.or(
PsiJavaPatterns.psiElement(PsiAssignmentExpression.class),
PsiJavaPatterns.psiElement(PsiVariable.class))).
andNot(PsiJavaPatterns.psiElement().afterLeaf(".")).accepts(element)) {
return new AndFilter(new ExcludeSillyAssignment(),
new ExcludeDeclaredFilter(new ClassFilter(PsiVariable.class)));
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RecursionWeigher.java
示例2: registerReferenceProviders
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
public void registerReferenceProviders(final PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(literalExpression(), new PropertiesReferenceProvider(true));
registrar.registerReferenceProvider(literalExpression().withParent(
psiNameValuePair().withName(AnnotationUtil.PROPERTY_KEY_RESOURCE_BUNDLE_PARAMETER)),
new ResourceBundleReferenceProvider());
registrar.registerReferenceProvider(PsiJavaPatterns.psiElement(PropertyValueImpl.class), new PsiReferenceProvider() {
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
String text = element.getText();
String[] words = text.split("\\s");
if (words.length != 1) return PsiReference.EMPTY_ARRAY;
return CLASS_REFERENCE_PROVIDER.getReferencesByString(words[0], element, 0);
}
});
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:PropertiesReferenceContributor.java
示例3: fillCompletionVariants
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
@Override
public void fillCompletionVariants(@NotNull final CompletionParameters parameters, @NotNull final CompletionResultSet result) {
PsiElement position = parameters.getPosition();
if (PsiJavaPatterns.psiElement(JavaDocTokenType.DOC_COMMENT_DATA).accepts(position)) {
final PsiParameter param = getDocTagParam(position.getParent());
if (param != null) {
suggestSimilarParameterDescriptions(result, position, param);
}
return;
}
super.fillCompletionVariants(parameters, result);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:JavaDocCompletionContributor.java
示例4: fun
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
@Override
@Nullable
public ExpectedTypeInfo[] fun(final CompletionLocation location) {
if (PsiJavaPatterns.psiElement().beforeLeaf(PsiJavaPatterns.psiElement().withText("."))
.accepts(location.getCompletionParameters().getPosition())) {
return ExpectedTypeInfo.EMPTY_ARRAY;
}
return JavaSmartCompletionContributor.getExpectedTypes(location.getCompletionParameters());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JavaCompletionUtil.java
示例5: addJavaSorting
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
public static CompletionResultSet addJavaSorting(final CompletionParameters parameters, CompletionResultSet result) {
final PsiElement position = parameters.getPosition();
final ExpectedTypeInfo[] expectedTypes = PsiJavaPatterns.psiElement().beforeLeaf(PsiJavaPatterns.psiElement().withText(".")).accepts(position) ? ExpectedTypeInfo.EMPTY_ARRAY : JavaSmartCompletionContributor.getExpectedTypes(parameters);
final CompletionType type = parameters.getCompletionType();
final boolean smart = type == CompletionType.SMART;
final boolean afterNew = JavaSmartCompletionContributor.AFTER_NEW.accepts(position);
List<LookupElementWeigher> afterProximity = new ArrayList<LookupElementWeigher>();
afterProximity.add(new PreferContainingSameWords(expectedTypes));
afterProximity.add(new PreferShorter(expectedTypes));
CompletionSorter sorter = CompletionSorter.defaultSorter(parameters, result.getPrefixMatcher());
if (!smart && afterNew) {
sorter = sorter.weighBefore("liftShorter", new PreferExpected(true, expectedTypes));
} else if (PsiTreeUtil.getParentOfType(position, PsiReferenceList.class) == null) {
sorter = ((CompletionSorterImpl)sorter).withClassifier("liftShorterClasses", true, new LiftShorterClasses(position));
}
if (smart) {
sorter = sorter.weighAfter("priority", new PreferDefaultTypeWeigher(expectedTypes, parameters));
}
List<LookupElementWeigher> afterPrefix = ContainerUtil.newArrayList();
afterPrefix.add(new PreferByKindWeigher(type, position));
if (!smart) {
ContainerUtil.addIfNotNull(afterPrefix, preferStatics(position, expectedTypes));
if (!afterNew) {
afterPrefix.add(new PreferExpected(false, expectedTypes));
}
}
ContainerUtil.addIfNotNull(afterPrefix, recursion(parameters, expectedTypes));
Collections.addAll(afterPrefix, new PreferSimilarlyEnding(expectedTypes),
new PreferNonGeneric(), new PreferAccessible(position), new PreferSimple());
sorter = sorter.weighAfter("prefix", afterPrefix.toArray(new LookupElementWeigher[afterPrefix.size()]));
sorter = sorter.weighAfter("proximity", afterProximity.toArray(new LookupElementWeigher[afterProximity.size()]));
return result.withRelevanceSorter(sorter);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:JavaCompletionSorting.java
示例6: getElementPattern
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
private static PsiJavaElementPattern.Capture<PsiLiteralExpression> getElementPattern(String annotationParamName) {
return PsiJavaPatterns.literalExpression().
annotationParam(annotationParamName, PsiJavaPatterns.psiAnnotation().with(new PatternCondition<PsiAnnotation>("isTestNGAnnotation") {
@Override
public boolean accepts(@NotNull PsiAnnotation annotation, ProcessingContext context) {
return TestNGUtil.isTestNGAnnotation(annotation);
}
}));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:TestNGReferenceContributor.java
示例7: isPossibleClosureParameter
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
private static boolean isPossibleClosureParameter(GrReferenceExpression ref) {
return PsiJavaPatterns.psiElement().afterLeaf(CLOSURE_LBRACE).accepts(ref) ||
PsiJavaPatterns.psiElement().afterLeaf(
PsiJavaPatterns.psiElement().afterLeaf(",").withParent(
PsiJavaPatterns.psiElement(GrVariable.class).withParent(
PsiJavaPatterns.psiElement(GrVariableDeclaration.class).afterLeaf(CLOSURE_LBRACE)))).accepts(ref) ||
GroovyCompletionUtil.isInPossibleClosureParameter(ref);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GroovyCompletionConfidence.java
示例8: shouldFocusLookup
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
@NotNull
@Override
public ThreeState shouldFocusLookup(@NotNull CompletionParameters parameters) {
final PsiElement position = parameters.getPosition();
PsiFile file = position.getContainingFile();
if (file instanceof GroovyFile && GroovyScriptUtil.getScriptType((GroovyFile)file) != GroovyScriptUtil.DEFAULT_TYPE) {
return ThreeState.NO;
}
if (position.getParent() instanceof GrReferenceElement &&
PsiJavaPatterns.psiElement().afterLeaf(PsiJavaPatterns.psiElement().withText("(").withParent(GrForStatement.class)).accepts(position)) {
return ThreeState.NO;
}
if (position.getParent() instanceof GrReferenceExpression) {
final GrReferenceExpression ref = (GrReferenceExpression)position.getParent();
final GrExpression qualifier = ref.getQualifierExpression();
if (qualifier == null) {
if (isPossibleClosureParameter(ref)) return ThreeState.NO;
if (parameters.getOriginalFile().getUserData(GROOVY_SHELL_FILE) == Boolean.TRUE) {
return ThreeState.NO;
}
GrExpression runtimeQualifier = PsiImplUtil.getRuntimeQualifier(ref);
if (runtimeQualifier != null && runtimeQualifier.getType() == null) {
return ThreeState.NO;
}
return ThreeState.YES;
}
if (qualifier.getType() == null) {
return ThreeState.NO;
}
return ThreeState.YES;
}
return ThreeState.UNSURE;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:GroovyCompletionConfidence.java
示例9: shouldSkipAutopopup
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
@NotNull
@Override
public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {
if (CodeInsightSettings.getInstance().SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS && psiFile.getUserData(GROOVY_SHELL_FILE) == Boolean.TRUE) {
return ThreeState.YES;
}
if (com.intellij.psi.impl.PsiImplUtil.isLeafElementOfType(contextElement, TokenSets.STRING_LITERALS)) {
@SuppressWarnings("ConstantConditions")
PsiElement parent = contextElement.getParent();
if (parent != null) {
for (PsiReference reference : parent.getReferences()) {
if (!reference.isSoft() && reference.getRangeInElement().shiftRight(parent.getTextOffset()).containsOffset(offset)) {
return ThreeState.NO;
}
}
}
return ThreeState.YES;
}
if (PsiJavaPatterns.psiElement().afterLeaf("def").accepts(contextElement)) {
return ThreeState.YES;
}
return ThreeState.UNSURE;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:GroovyCompletionConfidence.java
示例10: fillCompletionVariants
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
@Override
public void fillCompletionVariants(final CompletionParameters parameters, final CompletionResultSet result) {
PsiElement position = parameters.getPosition();
if (PsiJavaPatterns.psiElement(JavaDocTokenType.DOC_COMMENT_DATA).accepts(position)) {
final PsiParameter param = getDocTagParam(position.getParent());
if (param != null) {
suggestSimilarParameterDescriptions(result, position, param);
}
return;
}
super.fillCompletionVariants(parameters, result);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:JavaDocCompletionContributor.java
示例11: addJavaSorting
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
public static CompletionResultSet addJavaSorting(final CompletionParameters parameters, CompletionResultSet result) {
final PsiElement position = parameters.getPosition();
final ExpectedTypeInfo[] expectedTypes = PsiJavaPatterns.psiElement().beforeLeaf(PsiJavaPatterns.psiElement().withText(".")).accepts(position) ? ExpectedTypeInfo.EMPTY_ARRAY : JavaSmartCompletionContributor.getExpectedTypes(parameters);
final CompletionType type = parameters.getCompletionType();
final boolean smart = type == CompletionType.SMART;
final boolean afterNew = JavaSmartCompletionContributor.AFTER_NEW.accepts(position);
List<LookupElementWeigher> afterProximity = new ArrayList<LookupElementWeigher>();
afterProximity.add(new PreferContainingSameWords(expectedTypes));
if (smart) {
afterProximity.add(new PreferFieldsAndGetters());
}
afterProximity.add(new PreferShorter(expectedTypes));
CompletionSorter sorter = CompletionSorter.defaultSorter(parameters, result.getPrefixMatcher());
if (!smart && afterNew) {
sorter = sorter.weighBefore("liftShorter", new PreferExpected(true, expectedTypes));
} else if (PsiTreeUtil.getParentOfType(position, PsiReferenceList.class) == null) {
sorter = ((CompletionSorterImpl)sorter).withClassifier("liftShorterClasses", true, new LiftShorterClasses(position));
}
if (smart) {
sorter = sorter.weighAfter("priority", new PreferDefaultTypeWeigher(expectedTypes, parameters));
}
List<LookupElementWeigher> afterPrefix = ContainerUtil.newArrayList();
if (!smart) {
ContainerUtil.addIfNotNull(afterPrefix, preferStatics(position, expectedTypes));
}
ContainerUtil.addIfNotNull(afterPrefix, recursion(parameters, expectedTypes));
if (!smart && !afterNew) {
afterPrefix.add(new PreferExpected(false, expectedTypes));
}
Collections.addAll(afterPrefix, new PreferByKindWeigher(type, position), new PreferSimilarlyEnding(expectedTypes),
new PreferNonGeneric(), new PreferAccessible(position), new PreferSimple(),
new PreferEnumConstants(parameters));
sorter = sorter.weighAfter("prefix", afterPrefix.toArray(new LookupElementWeigher[afterPrefix.size()]));
sorter = sorter.weighAfter("proximity", afterProximity.toArray(new LookupElementWeigher[afterProximity.size()]));
return result.withRelevanceSorter(sorter);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:41,代码来源:JavaCompletionSorting.java
示例12: isInsideDecodeOrGetColorMethod
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
public static boolean isInsideDecodeOrGetColorMethod(PsiElement element) {
if (element instanceof PsiJavaToken && ((PsiJavaToken)element).getTokenType() == JavaTokenType.STRING_LITERAL) {
element = element.getParent();
}
return PsiJavaPatterns.psiExpression().methodCallParameter(0, DECODE_METHOD).accepts(element) ||
PsiJavaPatterns.psiExpression().methodCallParameter(0, GET_COLOR_METHOD).accepts(element);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:ColorChooserIntentionAction.java
示例13: fillCompletionVariants
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
@Override
public void fillCompletionVariants(@NotNull final CompletionParameters parameters, @NotNull final CompletionResultSet result)
{
PsiElement position = parameters.getPosition();
if(PsiJavaPatterns.psiElement(JavaDocTokenType.DOC_COMMENT_DATA).accepts(position))
{
final PsiParameter param = getDocTagParam(position.getParent());
if(param != null)
{
suggestSimilarParameterDescriptions(result, position, param);
}
suggestLinkWrappingVariants(parameters, result.withPrefixMatcher(CompletionUtil.findJavaIdentifierPrefix(parameters)), position);
if(!result.getPrefixMatcher().getPrefix().isEmpty())
{
for(String keyword : ContainerUtil.ar("null", "true", "false"))
{
String tagText = "{@code " + keyword + "}";
result.addElement(LookupElementBuilder.create(keyword).withPresentableText(tagText).withInsertHandler((context, item) -> context.getDocument().replaceString(context
.getStartOffset(), context.getTailOffset(), tagText)));
}
}
return;
}
super.fillCompletionVariants(parameters, result);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:30,代码来源:JavaDocCompletionContributor.java
示例14: recursionFilter
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
@Nullable
static ElementFilter recursionFilter(PsiElement element)
{
if(PsiJavaPatterns.psiElement().afterLeaf(PsiKeyword.RETURN).inside(PsiReturnStatement.class).accepts(element))
{
return new ExcludeDeclaredFilter(ElementClassFilter.METHOD);
}
if(PsiJavaPatterns.psiElement().inside(StandardPatterns.or(PsiJavaPatterns.psiElement(PsiAssignmentExpression.class), PsiJavaPatterns.psiElement(PsiVariable.class))).
andNot(PsiJavaPatterns.psiElement().afterLeaf(".")).accepts(element))
{
return new AndFilter(new ExcludeSillyAssignment(), new ExcludeDeclaredFilter(new ClassFilter(PsiVariable.class)));
}
return null;
}
开发者ID:consulo,项目名称:consulo-java,代码行数:16,代码来源:RecursionWeigher.java
示例15: fun
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
@Override
@Nullable
public ExpectedTypeInfo[] fun(final CompletionLocation location)
{
if(PsiJavaPatterns.psiElement().beforeLeaf(PsiJavaPatterns.psiElement().withText(".")).accepts(location.getCompletionParameters().getPosition()))
{
return ExpectedTypeInfo.EMPTY_ARRAY;
}
return JavaSmartCompletionContributor.getExpectedTypes(location.getCompletionParameters());
}
开发者ID:consulo,项目名称:consulo-java,代码行数:12,代码来源:JavaCompletionUtil.java
示例16: acceptChar
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
@Override
public Result acceptChar(char c, final int prefixLength, final Lookup lookup) {
if (!lookup.getPsiFile().getLanguage().isKindOf(JavaLanguage.INSTANCE)) {
return null;
}
LookupElement item = lookup.getCurrentItem();
if (item == null) return null;
final Object o = item.getObject();
if (c == '!') {
if (o instanceof PsiVariable) {
if (PsiType.BOOLEAN.isAssignableFrom(((PsiVariable)o).getType())) return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
}
if (o instanceof PsiMethod) {
final PsiType type = ((PsiMethod)o).getReturnType();
if (type != null && PsiType.BOOLEAN.isAssignableFrom(type)) return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
}
if (o instanceof PsiKeyword && ((PsiKeyword)o).textMatches(PsiKeyword.INSTANCEOF)) {
return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
}
return null;
}
if (c == '.' && isWithinLiteral(lookup)) return Result.ADD_TO_PREFIX;
if (c == ':') {
PsiFile file = lookup.getPsiFile();
PsiDocumentManager.getInstance(file.getProject()).commitDocument(lookup.getEditor().getDocument());
PsiElement leaf = file.findElementAt(lookup.getEditor().getCaretModel().getOffset() - 1);
if (PsiUtil.getLanguageLevel(file).isAtLeast(LanguageLevel.JDK_1_8)) {
PsiStatement statement = PsiTreeUtil.getParentOfType(leaf, PsiStatement.class);
if (statement == null ||
statement.getTextRange().getStartOffset() != leaf.getTextRange().getStartOffset()) { // not typing a statement label
return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
}
}
if (PsiTreeUtil.getParentOfType(leaf, PsiSwitchLabelStatement.class) != null ||
PsiTreeUtil.getParentOfType(leaf, PsiConditionalExpression.class) != null) {
return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
}
return Result.HIDE_LOOKUP;
}
if (c == '[' || c == ']' || c == ')' || c == '>') return CharFilter.Result.SELECT_ITEM_AND_FINISH_LOOKUP;
if (c == '<' && o instanceof PsiClass) return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
if (c == '(') {
if (o instanceof PsiClass) {
if (PsiJavaPatterns.psiElement().afterLeaf(PsiKeyword.NEW).accepts(lookup.getPsiElement())) {
return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
}
return Result.HIDE_LOOKUP;
}
if (o instanceof PsiType) {
return Result.HIDE_LOOKUP;
}
}
if ((c == ',' || c == '=') && o instanceof PsiVariable) {
int lookupStart = lookup.getLookupStart();
String name = ((PsiVariable)o).getName();
if (lookupStart >= 0 && name != null && name.equals(lookup.itemPattern(item))) {
return Result.HIDE_LOOKUP;
}
}
if (c == '#' && PsiTreeUtil.getParentOfType(lookup.getPsiElement(), PsiDocComment.class) != null) {
if (o instanceof PsiClass) {
return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
}
}
if (c == '(' && PsiKeyword.RETURN.equals(item.getLookupString())) {
return Result.HIDE_LOOKUP;
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:77,代码来源:JavaCharFilter.java
示例17: getPatternClasses
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
@NotNull
public Class[] getPatternClasses() {
return new Class[] { PsiJavaPatterns.class };
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:JavaLanguageInjectionSupport.java
示例18: acceptChar
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
@Override
@Nullable
public Result acceptChar(char c, int prefixLength, Lookup lookup) {
final PsiFile psiFile = lookup.getPsiFile();
if (psiFile != null && !psiFile.getViewProvider().getLanguages().contains(GroovyLanguage.INSTANCE)) return null;
LookupElement item = lookup.getCurrentItem();
if (item == null) return null;
if (Character.isJavaIdentifierPart(c) || c == '\'') {
return Result.ADD_TO_PREFIX;
}
int caret = lookup.getEditor().getCaretModel().getOffset();
if (c == '.' && prefixLength == 0 && !lookup.isSelectionTouched() && caret > 0 &&
lookup.getEditor().getDocument().getCharsSequence().charAt(caret - 1) == '.') {
return Result.HIDE_LOOKUP;
}
if (c == ':') {
PsiFile file = lookup.getPsiFile();
PsiDocumentManager.getInstance(file.getProject()).commitDocument(lookup.getEditor().getDocument());
PsiElement element = file.findElementAt(Math.max(caret - 1, 0));
if (PsiJavaPatterns.psiElement().withParent(
PsiJavaPatterns.psiElement(GrReferenceExpression.class).withParent(
StandardPatterns.or(PsiJavaPatterns.psiElement(GrCaseLabel.class),
PsiJavaPatterns.psiElement(GrConditionalExpression.class)))).accepts(element)) {
return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
}
if (item.getObject() instanceof NamedArgumentDescriptor &&
(MapArgumentCompletionProvider.IN_ARGUMENT_LIST_OF_CALL.accepts(element) ||
MapArgumentCompletionProvider.IN_LABEL.accepts(element))) {
return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
}
return Result.HIDE_LOOKUP;
}
if (c == '[' || c == ']' || c == ')' || c == '>') return CharFilter.Result.SELECT_ITEM_AND_FINISH_LOOKUP;
if (c == '<' && item.getObject() instanceof PsiClass) return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
if (c == '(' && PsiKeyword.RETURN.equals(item.getLookupString())) {
return Result.HIDE_LOOKUP;
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:GroovyReferenceCharFilter.java
示例19: register
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
public static void register(CompletionContributor contributor) {
final GroovyDocCompletionProvider provider = new GroovyDocCompletionProvider();
contributor.extend(CompletionType.BASIC, PsiJavaPatterns.psiElement().inside(GrDocTagValueToken.class), provider);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:GroovyDocCompletionProvider.java
示例20: isAfterForParameter
import com.intellij.patterns.PsiJavaPatterns; //导入依赖的package包/类
private static boolean isAfterForParameter(PsiElement position) {
ElementPattern<PsiElement> forParameter =
PsiJavaPatterns.psiElement().withParents(GrParameter.class, GrTraditionalForClause.class, GrForStatement.class);
return PsiJavaPatterns.psiElement().withParent(GrReferenceExpression.class).afterLeaf(forParameter).accepts(position) ||
forParameter.accepts(position) && PsiJavaPatterns.psiElement().afterLeaf(PsiJavaPatterns.psiElement(GroovyTokenTypes.mIDENT)).accepts(position);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:GroovyCompletionData.java
注:本文中的com.intellij.patterns.PsiJavaPatterns类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论