當前位置: 首頁>>代碼示例>>Java>>正文


Java CompletionResultSet.runRemainingContributors方法代碼示例

本文整理匯總了Java中com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors方法的典型用法代碼示例。如果您正苦於以下問題:Java CompletionResultSet.runRemainingContributors方法的具體用法?Java CompletionResultSet.runRemainingContributors怎麽用?Java CompletionResultSet.runRemainingContributors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.codeInsight.completion.CompletionResultSet的用法示例。


在下文中一共展示了CompletionResultSet.runRemainingContributors方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: filterPrivateResources

import com.intellij.codeInsight.completion.CompletionResultSet; //導入方法依賴的package包/類
public void filterPrivateResources(@NotNull CompletionParameters parameters,
                                   @NotNull final CompletionResultSet resultSet,
                                   AndroidFacet facet) {
  final ResourceVisibilityLookup lookup = AppResourceRepository.getAppResources(facet, true).getResourceVisibility(facet);
  if (lookup.isEmpty()) {
    return;
  }
  resultSet.runRemainingContributors(parameters, new Consumer<CompletionResult>() {
    @Override
    public void consume(CompletionResult result) {
      final Object obj = result.getLookupElement().getObject();

      if (obj instanceof PsiField) {
        PsiField field = (PsiField)obj;
        PsiClass containingClass = field.getContainingClass();
        if (containingClass != null) {
          PsiClass rClass = containingClass.getContainingClass();
          if (rClass != null && rClass.getName().equals(R_CLASS)) {
            ResourceType type = ResourceType.getEnum(containingClass.getName());
            if (type != null && lookup.isPrivate(type, field.getName())) {
              return;
            }
          }
        }
      }
      resultSet.passResult(result);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:AndroidJavaCompletionContributor.java

示例2: fillCompletionVariants

import com.intellij.codeInsight.completion.CompletionResultSet; //導入方法依賴的package包/類
@Override
public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull final CompletionResultSet resultSet) {
  super.fillCompletionVariants(parameters, resultSet);
  final PsiElement position = parameters.getPosition();
  final AndroidFacet facet = AndroidFacet.getInstance(position);

  if (facet == null) {
    return;
  }

  if (AndroidMavenUtil.isMavenizedModule(facet.getModule())) {
    resultSet.runRemainingContributors(parameters, new Consumer<CompletionResult>() {
      @Override
      public void consume(CompletionResult result) {
        final Object obj = result.getLookupElement().getObject();

        if (obj instanceof PsiClass) {
          final String qName = ((PsiClass)obj).getQualifiedName();

          if (qName != null && !isAllowedInAndroid(qName)) {
            return;
          }
        }
        resultSet.passResult(result);
      }
    });
  }

  // Filter out private resources when completing R.type.name expressions, if any
  if (position.getParent() instanceof PsiReferenceExpression) {
    PsiReferenceExpression ref = (PsiReferenceExpression)position.getParent();
    if (ref.getQualifierExpression() != null &&
        ref.getQualifierExpression() instanceof PsiReferenceExpression) {
      PsiReferenceExpression ref2 = (PsiReferenceExpression)ref.getQualifierExpression();
      if (ref2.getQualifierExpression() instanceof PsiReferenceExpression) {
        PsiReferenceExpression ref3 = (PsiReferenceExpression)ref2.getQualifierExpression();
        if (ref3.getQualifierExpression() == null && R_CLASS.equals(ref3.getReferenceName())) {
          filterPrivateResources(parameters, resultSet, facet);
        }
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:44,代碼來源:AndroidJavaCompletionContributor.java


注:本文中的com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。