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


Java ResolveResult.EMPTY_ARRAY屬性代碼示例

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


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

示例1: multiResolve

@NotNull
@Override
public ResolveResult[] multiResolve(final boolean incompleteCode) {
    final PsiFile originalFile = getElement().getContainingFile();

    final Collection<ImpexMacroDeclaration> macroDeclarations =
        PsiTreeUtil.findChildrenOfType(
            originalFile,
            ImpexMacroDeclaration.class
        );

    if (!macroDeclarations.isEmpty()) {
        final ArrayList<PsiElement> references = ContainerUtil.newArrayList();
        for (final ImpexMacroDeclaration declaration : macroDeclarations) {
            if (getElement().textMatches(declaration.getFirstChild())) {
                references.add(declaration.getFirstChild());
            }
        }
        return PsiElementResolveResult.createResults(references);
    }
    return ResolveResult.EMPTY_ARRAY;
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:22,代碼來源:ImpexMacrosReferenceBase.java

示例2: multiResolve

@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
  final String name = getName();
  if (name == null) return ResolveResult.EMPTY_ARRAY;
  ArrayList<LuaResolveResult> candidates = new ArrayList<LuaResolveResult>();

  final PsiElement owner = LuaDocCommentUtil.findDocOwner(this);
  if (owner instanceof LuaFunctionDefinition) {
    final LuaFunctionDefinition method = (LuaFunctionDefinition)owner;
    final LuaParameter[] parameters = method.getParameters().getLuaParameters();

    for (LuaParameter parameter : parameters) {
      if (name.equals(parameter.getName())) {
        candidates.add(new LuaResolveResultImpl(parameter, true));
      }
    }
    return candidates.toArray(new ResolveResult[candidates.size()]);
  }

  return ResolveResult.EMPTY_ARRAY;
}
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:21,代碼來源:LuaDocParameterReferenceImpl.java

示例3: doResolve

@Override
public ResolveResult[] doResolve() {
    if (myReferencedName == null) return ResolveResult.EMPTY_ARRAY;

    if (EmberJSAsExpression.isAsControllerRef(myRef, myRef.getParent())) {
        final JSNamedElementProxy resolve = EmberIndexUtil.resolve(myParent.getProject(), EmberControllerIndex.INDEX_ID, myReferencedName);
        if (resolve != null) {
            return new JSResolveResult[]{new JSResolveResult(resolve)};
        }
    } else {
        final Collection<JSNamedElement> localVariables = getItemsByName(myReferencedName, myRef);
        if (!localVariables.isEmpty()) {
            return ContainerUtil.map2Array(localVariables, JSResolveResult.class, new Function<JSNamedElement, JSResolveResult>() {
                @Override
                public JSResolveResult fun(JSNamedElement item) {
                    return new JSResolveResult(item);
                }
            });
        }
    }
    return super.doResolve();
}
 
開發者ID:kristianmandrup,項目名稱:emberjs-plugin,代碼行數:22,代碼來源:EmberJSReferenceExpressionResolver.java

示例4: toCandidateInfoArray

@NotNull
public static ResolveResult[] toCandidateInfoArray(@Nullable List<? extends PsiElement> elements) {
  if (elements == null) {
    return ResolveResult.EMPTY_ARRAY;
  }
  elements = ContainerUtil.filter(elements, (Condition<PsiElement>) Objects::nonNull);
  final ResolveResult[] result = new ResolveResult[elements.size()];
  for (int i = 0, size = elements.size(); i < size; i++) {
    result[i] = new PsiElementResolveResult(elements.get(i));
  }
  return result;
}
 
開發者ID:ant-druha,項目名稱:AppleScript-IDEA,代碼行數:12,代碼來源:AppleScriptResolveUtil.java

示例5: multiResolve

@NotNull
@Override
public ResolveResult[] multiResolve(final boolean incompleteCode) {
    final TSMetaModel meta = getTypeSystemMeta();
    final String featureName = getElement().getText();
    final Optional<TSMetaClass> metaClass = findItemTypeReference()
        .map(PsiElement::getText)
        .map(meta::findMetaClassByName);

    if (!metaClass.isPresent()) {
        return ResolveResult.EMPTY_ARRAY;
    }

    final List<ResolveResult> result = metaClass.get()
                                                .findPropertiesByName(featureName, true)
                                                .stream()
                                                .map(TSMetaProperty::retrieveDom)
                                                .filter(Objects::nonNull)
                                                .map(AttributeResolveResult::new)
                                                .collect(Collectors.toCollection(LinkedList::new));

    metaClass.get().findReferenceEndsByRole(featureName, true)
             .stream()
             .map(TSMetaReference.ReferenceEnd::retrieveDom)
             .filter(Objects::nonNull)
             .map(RelationElementResolveResult::new)
             .collect(Collectors.toCollection(() -> result));

    return result.toArray(new ResolveResult[result.size()]);
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:30,代碼來源:TypeSystemAttributeReference.java

示例6: multiResolve

@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
    final String name = getName();
    if (name == null) return ResolveResult.EMPTY_ARRAY;
    ArrayList<LuaResolveResult> candidates = new ArrayList<LuaResolveResult>();

    final PsiElement owner = LuaDocCommentUtil.findDocOwner(this);
    if (owner instanceof LuaTableConstructor) {
        LuaExpression[] inits = ((LuaTableConstructor) owner).getInitializers();

        for (LuaExpression expr : inits) {
            if (expr instanceof LuaKeyValueInitializer) {

                final LuaExpression key = ((LuaKeyValueInitializer) expr).getFieldKey();
                if (key instanceof LuaFieldIdentifier) {
                    final LuaFieldIdentifier fieldKey = (LuaFieldIdentifier) key;
                    if (fieldKey.getName().equals(getName())) candidates.add(new LuaResolveResultImpl(fieldKey,
                            true));
                }
            }
        }

        return candidates.toArray(new ResolveResult[candidates.size()]);
    }

    return ResolveResult.EMPTY_ARRAY;
}
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:27,代碼來源:LuaDocFieldReferenceImpl.java

示例7: multiResolve

@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
  ResolveResult[] results = super.multiResolve(incompleteCode);
  if (results.length == 0) {
    PsiFile file = myElement.getContainingFile();
    if (file instanceof IpnbPyFragment) {
      final IpnbFilePanel panel = ((IpnbPyFragment)file).getFilePanel();
      final List<IpnbEditablePanel> panels = panel.getIpnbPanels();

      final String referencedName = myElement.getReferencedName();
      if (referencedName == null) return ResolveResult.EMPTY_ARRAY;

      for (IpnbEditablePanel editablePanel : panels) {
        if (!(editablePanel instanceof IpnbCodePanel)) continue;
        final Editor editor = ((IpnbCodePanel)editablePanel).getEditor();
        final IpnbPyFragment psiFile = (IpnbPyFragment)PsiDocumentManager.getInstance(myElement.getProject()).getPsiFile(editor.getDocument());
        if (psiFile == null) continue;
        ResolveProcessor processor = new ResolveProcessor(referencedName);

        PyResolveUtil.scopeCrawlUp(processor, psiFile, referencedName, psiFile);
        final List<RatedResolveResult> resultList = getResultsFromProcessor(referencedName, processor, psiFile, psiFile);
        if (resultList.size() > 0) {
          List<RatedResolveResult> ret = RatedResolveResult.sorted(resultList);
          return ret.toArray(new RatedResolveResult[ret.size()]);
        }
      }
    }
  }
  return results;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:31,代碼來源:IpnbPyReference.java

示例8: multiResolve

@Override
@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
  final RngGrammar scope = getScope();
  if (scope == null) {
    return ResolveResult.EMPTY_ARRAY;
  }

  final Set<Define> set = DefinitionResolver.resolve(scope, myValue.getValue());
  if (set == null || set.size() == 0) return ResolveResult.EMPTY_ARRAY;

  return ContainerUtil.map2Array(set, ResolveResult.class, this);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:DefinitionReference.java

示例9: getVariants

@Override
@NotNull
public Object[] getVariants() {
  final RngGrammar scope = getScope();
  if (scope == null) {
    return ResolveResult.EMPTY_ARRAY;
  }

  final Map<String, Set<Define>> map = DefinitionResolver.getAllVariants(scope);
  if (map == null || map.size() == 0) return ArrayUtil.EMPTY_OBJECT_ARRAY;

  return ContainerUtil.mapNotNull(map.values(), new Function<Set<Define>, Object>() {
    @Override
    public Object fun(Set<Define> defines) {
      final Define define = defines.iterator().next();
      if (defines.size() == 0) {
        return null;
      } else {
        final PsiElement element = define.getPsiElement();
        if (element != null) {
          final PsiPresentableMetaData data = (PsiPresentableMetaData)((PsiMetaOwner)element).getMetaData();
          if (data != null) {
            return LookupValueFactory.createLookupValue(data.getName(), data.getIcon());
          } else {
            return define.getName();
          }
        } else {
          return define.getName();
        }
      }
    }
  }).toArray();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:33,代碼來源:DefinitionReference.java

示例10: resolveInner

@Override
protected ResolveResult[] resolveInner(boolean incompleteCode, PsiFile containingFile) {
  File containingDirectory = ((BuildFile) containingFile).getFile().getParentFile();
  if (containingDirectory == null) {
    return ResolveResult.EMPTY_ARRAY;
  }
  List<String> includes = resolveListContents(element.getIncludes());
  List<String> excludes = resolveListContents(element.getExcludes());
  boolean directoriesExcluded = element.areDirectoriesExcluded();
  if (includes.isEmpty()) {
    return ResolveResult.EMPTY_ARRAY;
  }
  Project project = element.getProject();
  try {
    List<File> files =
        UnixGlob.forPath(containingDirectory)
            .addPatterns(includes)
            .addExcludes(excludes)
            .setExcludeDirectories(directoriesExcluded)
            .setDirectoryFilter(directoryFilter(project, containingDirectory.getPath()))
            .glob();

    List<ResolveResult> results = Lists.newArrayListWithCapacity(files.size());
    for (File file : files) {
      PsiFileSystemItem psiFile = BuildReferenceManager.getInstance(project).resolveFile(file);
      if (psiFile != null) {
        results.add(new PsiElementResolveResult(psiFile));
      }
    }
    return results.toArray(ResolveResult.EMPTY_ARRAY);

  } catch (Exception e) {
    return ResolveResult.EMPTY_ARRAY;
  }
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:35,代碼來源:GlobReference.java

示例11: multiResolve

@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
	final PsiElement resolve = resolve();
	if(resolve != null) {
		return new ResolveResult[] { new PsiElementResolveResult(resolve) };
	}
	return ResolveResult.EMPTY_ARRAY;
}
 
開發者ID:jimkyndemeyer,項目名稱:js-graphql-intellij-plugin,代碼行數:9,代碼來源:JSGraphQLEndpointImportFileReferencePsiElement.java

示例12: multiResolve

@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
  final RngGrammar scope = getScope();
  if (scope == null) {
    return ResolveResult.EMPTY_ARRAY;
  }

  final Set<Define> set = DefinitionResolver.resolve(scope, myValue.getValue());
  if (set == null || set.size() == 0) return ResolveResult.EMPTY_ARRAY;

  return ContainerUtil.map2Array(set, ResolveResult.class, this);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:12,代碼來源:DefinitionReference.java

示例13: getVariants

@NotNull
public Object[] getVariants() {
  final RngGrammar scope = getScope();
  if (scope == null) {
    return ResolveResult.EMPTY_ARRAY;
  }

  final Map<String, Set<Define>> map = DefinitionResolver.getAllVariants(scope);
  if (map == null || map.size() == 0) return ArrayUtil.EMPTY_OBJECT_ARRAY;

  return ContainerUtil.mapNotNull(map.values(), new Function<Set<Define>, Object>() {
    public Object fun(Set<Define> defines) {
      final Define define = defines.iterator().next();
      if (defines.size() == 0) {
        return null;
      } else {
        final PsiElement element = define.getPsiElement();
        if (element != null) {
          final PsiPresentableMetaData data = (PsiPresentableMetaData)((PsiMetaOwner)element).getMetaData();
          if (data != null) {
            return LookupValueFactory.createLookupValue(data.getName(), data.getIcon());
          } else {
            return define.getName();
          }
        } else {
          return define.getName();
        }
      }
    }
  }).toArray();
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:31,代碼來源:DefinitionReference.java

示例14: multiResolve

@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
  final PsiElement parent = getParent();
  if (parent instanceof GrConstructorInvocation) {
    return ((GrConstructorInvocation)parent).multiResolve(incompleteCode);
  }
  return ResolveResult.EMPTY_ARRAY;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:8,代碼來源:GrThisSuperReferenceExpressionBase.java

示例15: resolve

@NotNull
@Override
public ResolveResult[] resolve(@NotNull GrThisSuperReferenceExpressionBase ref, boolean incompleteCode) {
  final PsiElement resolved = ref.resolveInner();
  if (resolved == null) return ResolveResult.EMPTY_ARRAY;
  return new GroovyResolveResult[]{new GroovyResolveResultImpl(resolved, true)};
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:7,代碼來源:GrThisSuperReferenceExpressionBase.java


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