Java 类com.intellij.psi.filters.getters.ThisGetter 实例源码

项目:intellij-ce-playground    文件:BasicExpressionCompletionContributor.java   
public static void fillCompletionVariants(JavaSmartCompletionParameters parameters,
                                          final Consumer<LookupElement> result,
                                          PrefixMatcher matcher) {
  final PsiElement element = parameters.getPosition();
  if (JavaKeywordCompletion.isAfterTypeDot(element)) {
    addKeyword(result, element, PsiKeyword.CLASS);
    addKeyword(result, element, PsiKeyword.THIS);

  }

  if (!JavaKeywordCompletion.AFTER_DOT.accepts(element)) {
    if (parameters.getParameters().getInvocationCount() <= 1) {
      new CollectionsUtilityMethodsProvider(parameters.getPosition(),
                                            parameters.getExpectedType(),
                                            parameters.getDefaultType(), result)
        .addCompletions(StringUtil.isNotEmpty(matcher.getPrefix()));
    }
    ClassLiteralGetter.addCompletions(parameters, result, matcher);

    final PsiElement position = parameters.getPosition();
      final PsiType expectedType = parameters.getExpectedType();

      for (final TemplateImpl template : TemplateSettings.getInstance().getTemplates()) {
        if (!template.isDeactivated() && template.getTemplateContext().isEnabled(new SmartCompletionContextType())) {
          result.consume(new SmartCompletionTemplateItem(template, position));
        }
      }

      addKeyword(result, position, PsiKeyword.TRUE);
      addKeyword(result, position, PsiKeyword.FALSE);

      final PsiElement parent = position.getParent();
      if (parent != null && !(parent.getParent() instanceof PsiSwitchLabelStatement)) {
        for (final PsiExpression expression : ThisGetter.getThisExpressionVariants(position)) {
          result.consume(new ExpressionLookupItem(expression));
        }
      }

      processDataflowExpressionTypes(position, expectedType, matcher, result);
  }

}
项目:tools-idea    文件:BasicExpressionCompletionContributor.java   
public static void fillCompletionVariants(JavaSmartCompletionParameters parameters,
                                          final Consumer<LookupElement> result,
                                          PrefixMatcher matcher) {
  final PsiElement element = parameters.getPosition();
  if (JavaCompletionData.isAfterTypeDot(element)) {
    addKeyword(result, element, PsiKeyword.CLASS);
    addKeyword(result, element, PsiKeyword.THIS);

  }

  if (!JavaCompletionData.AFTER_DOT.accepts(element)) {
    if (parameters.getParameters().getInvocationCount() <= 1) {
      new CollectionsUtilityMethodsProvider(parameters.getPosition(),
                                            parameters.getExpectedType(),
                                            parameters.getDefaultType(), result)
        .addCompletions(StringUtil.isNotEmpty(matcher.getPrefix()));
    }
    ClassLiteralGetter.addCompletions(parameters, result, matcher);

    final PsiElement position = parameters.getPosition();
      final PsiType expectedType = parameters.getExpectedType();

      for (final TemplateImpl template : TemplateSettings.getInstance().getTemplates()) {
        if (!template.isDeactivated() && template.getTemplateContext().isEnabled(new SmartCompletionContextType())) {
          result.consume(new SmartCompletionTemplateItem(template, position));
        }
      }

      addKeyword(result, position, PsiKeyword.TRUE);
      addKeyword(result, position, PsiKeyword.FALSE);

      final PsiElement parent = position.getParent();
      if (parent != null && !(parent.getParent() instanceof PsiSwitchLabelStatement)) {
        for (final PsiExpression expression : ThisGetter.getThisExpressionVariants(position)) {
          result.consume(new ExpressionLookupItem(expression));
        }
      }

      processDataflowExpressionTypes(position, expectedType, matcher, result);
  }

}
项目:consulo-java    文件:BasicExpressionCompletionContributor.java   
public static void fillCompletionVariants(JavaSmartCompletionParameters parameters, final Consumer<LookupElement> result, PrefixMatcher matcher)
{
    final PsiElement element = parameters.getPosition();
    if(JavaKeywordCompletion.isAfterTypeDot(element))
    {
        addKeyword(result, element, PsiKeyword.CLASS);
        addKeyword(result, element, PsiKeyword.THIS);

    }

    if(!JavaKeywordCompletion.AFTER_DOT.accepts(element))
    {
        if(parameters.getParameters().getInvocationCount() <= 1)
        {
            new CollectionsUtilityMethodsProvider(parameters.getPosition(), parameters.getExpectedType(), parameters.getDefaultType(), result).addCompletions(StringUtil.isNotEmpty(matcher
                    .getPrefix()));
        }
        ClassLiteralGetter.addCompletions(parameters, result, matcher);

        final PsiElement position = parameters.getPosition();
        final PsiType expectedType = parameters.getExpectedType();

        for(final TemplateImpl template : TemplateSettings.getInstance().getTemplates())
        {
            if(!template.isDeactivated() && template.getTemplateContext().isEnabled(new SmartCompletionContextType()))
            {
                result.consume(new SmartCompletionTemplateItem(template, position));
            }
        }

        addKeyword(result, position, PsiKeyword.TRUE);
        addKeyword(result, position, PsiKeyword.FALSE);

        final PsiElement parent = position.getParent();
        if(parent != null && !(parent.getParent() instanceof PsiSwitchLabelStatement))
        {
            for(final PsiExpression expression : ThisGetter.getThisExpressionVariants(position))
            {
                result.consume(new ExpressionLookupItem(expression));
            }
        }

        processDataflowExpressionTypes(position, expectedType, matcher, result);
    }

}