Package com.intellij.util

Examples of com.intellij.util.SmartList


              if (classByKeyword != null) {
                return classByKeyword;
              }

              PhpIndex index = PhpIndex.getInstance(element.getProject());
              List classes = new SmartList(index.getAnyByFQN(PhpLangUtil.toFQN(className)));
              if (classes.size() > 0) {
                return (PhpNamedElement) classes.get(0);
              }
            }
            return null;
          }

          @Nullable
          private PhpNamedElement getOriginalFunction(@NotNull Project project, @NotNull String fqn) {
            if (project == null)
              throw new IllegalArgumentException("Argument 0 for @NotNull parameter of com/jetbrains/php/lang/PhpReferenceContributor$CallbackReferenceProvider.getOriginalFunction must not be null");
            if (fqn == null)
              throw new IllegalArgumentException("Argument 1 for @NotNull parameter of com/jetbrains/php/lang/PhpReferenceContributor$CallbackReferenceProvider.getOriginalFunction must not be null");
            PhpIndex index = PhpIndex.getInstance(project);
            if (StringUtil.isNotEmpty(fqn)) {
              int i = fqn.lastIndexOf('\\');
              String name = i >= 0 ? fqn.substring(i + 1) : fqn;
              String namespace = i >= 0 ? fqn.substring(0, i + 1) : "\\";

              Collection functions = index.getFunctionsByName(name);
              List filteredFunctions = new SmartList(index.filterNamedByNamespace(functions, PhpLangUtil.toFQN(namespace), true));

              if (filteredFunctions.size() > 0) {
                return (PhpNamedElement) filteredFunctions.get(0);
              }
            }
            return null;
          }

          @Nullable
          public Collection<PhpClass> resolveClass(@NotNull PhpIndex index, @NotNull PsiElement element, @Nullable PhpClass callerClass) {
            if (index == null)
              throw new IllegalArgumentException("Argument 0 for @NotNull parameter of com/jetbrains/php/lang/PhpReferenceContributor$CallbackReferenceProvider.resolveClass must not be null");
            if (element == null)
              throw new IllegalArgumentException("Argument 1 for @NotNull parameter of com/jetbrains/php/lang/PhpReferenceContributor$CallbackReferenceProvider.resolveClass must not be null");
            PhpClass referencedClass = PhpCallbackFunctionUtil.getFirstClassByReference(element);
            if (referencedClass != null) {
              return new SmartList(referencedClass);
            }

            String callbackContent = getCallbackContent(element);
            PhpClass classByKeyword = checkClassKeywords(callbackContent, callerClass);
            if (classByKeyword != null) {
              return new SmartList(classByKeyword);
            }

            if (callbackContent == null) {
              PhpExpression classExpression = (element instanceof PhpExpression) ? (PhpExpression) element : (PhpExpression) PhpPsiUtil.getChildByCondition(element, PhpExpression.INSTANCEOF);
View Full Code Here

TOP

Related Classes of com.intellij.util.SmartList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.