本文整理匯總了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);
}
});
}
示例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);
}
}
}
}
}