Package com.intellij.psi

Examples of com.intellij.psi.PsiReference


      for (BnfAttr attr : attrs.getAttrList()) {
        BnfAttrPattern pattern = attr.getAttrPattern();
        if (pattern == null) continue;
        BnfStringLiteralExpression patternExpression = pattern.getLiteralExpression();

        PsiReference ref = BnfStringImpl.matchesElement(patternExpression, target) ? patternExpression.getReference() : null;
        if (ref != null && ref.isReferenceTo(target)) {
          if (!consumer.process(ref)) return;
        }
      }
    }
  }
View Full Code Here


        else if (element instanceof BnfExternalExpression) {
          // do not check external expressions
          return;
        }
        else if (element instanceof BnfRefOrTokenImpl) {
          PsiReference reference = element.getReference();
          Object resolve = reference == null ? null : reference.resolve();
          final String text = element.getText();
          if (resolve == null && !tokens.contains(text) && isTokenTextSuspicious(text)) {
            problemsHolder.registerProblem(element, "'"+text+"' token looks like a reference to a missing rule", new CreateRuleFromTokenFix(text));
          }
        }
View Full Code Here

    protected void assertTest() {
        assertNotNull(def);

        assertCorrectUsageOf(def);
        for (PsiElement element : refSet) {
            PsiReference reference = element.getContainingFile().findReferenceAt(element.getTextOffset());
            assertNotNull(reference);
            PsiElement resolve = reference.resolve();
            assertNotNull(resolve);
            assertEquals(def.getTextOffset(), resolve.getNavigationElement().getTextOffset());
        }
    }
View Full Code Here

    int offset = fileText.indexOf(MARKER);
    assertTrue(offset >= 0);
    fileText = fileText.substring(0, offset) + fileText.substring(offset + MARKER.length());

    myFile = createFile(fileName, fileText);
    PsiReference ref = myFile.findReferenceAt(offset);

    assertNotNull(ref);

    return ref;
  }
View Full Code Here

    if (children1.length == 0) {
      if (!element1.textMatches(element2)) return false;
    }

    PsiReference ref1 = element1.getReference();
    if (ref1 != null) {
      PsiReference ref2 = element2.getReference();
      if (ref2 == null) return false;
      PsiElement resolved1 = ref1.resolve();
      PsiElement resolved2 = ref2.resolve();
      if (!Comparing.equal(resolved1, resolved2)
          && (resolvedElementsComparator == null || resolvedElementsComparator.compare(resolved1, resolved2) != 0)) return false;
    }
    return true;
View Full Code Here

        // so double check the method name before resolve the method
        if(!isMatchingMethodName(methodRef, expectedMethods)) {
            return false;
        }

        PsiReference psiReference = methodRef.getReference();
        if (null == psiReference) {
            return false;
        }

        Method method = getMultiResolvedMethod(psiReference);
View Full Code Here

    }

    @Override
    public void visitElement(PsiElement element) {
      if (element instanceof ErlangQVar) {
        PsiReference reference = element.getReference();
        PsiElement resolve = reference != null ? reference.resolve() : null;
        if (resolve instanceof ErlangNamedElement) {
          myComponentNames.add((ErlangNamedElement) resolve);
        }
        else {
          myComponentNames.add((ErlangNamedElement) element);
View Full Code Here

    return null;
  }

  @NotNull
  private PsiFile getPsiFile() {
    PsiReference reference = myModuleRef != null ? myModuleRef.getReference() : null;
    PsiElement resolve = reference != null ? reference.resolve() : null;
    PsiFile moduleRefContainingFile = resolve != null ? resolve.getContainingFile() : null;
    return moduleRefContainingFile != null ? moduleRefContainingFile : myElement.getContainingFile();
  }
View Full Code Here

        String moduleName = moduleRef.getText();
        ErlangFunctionCallExpression erlFunctionCall = erlGlobalFunctionCall.getFunctionCallExpression();
        String functionName = erlFunctionCall.getName();
        int arity = erlFunctionCall.getArgumentList().getExpressionList().size();
        if (ErlangBifTable.isBif(moduleName, functionName, arity)) {
          PsiReference psiReference = moduleRef.getReference();
          PsiElement tentativeErlangModule = psiReference != null ? psiReference.resolve() : null;
          if (tentativeErlangModule instanceof ErlangModule) {
            VirtualFile virtualFile = getVirtualFile(tentativeErlangModule);
            if (virtualFile != null) {
              return new ErlangSdkFunctionDocProvider(project, functionName, arity, virtualFile);
            }
View Full Code Here

  protected void checkFile(@NotNull ErlangFile file, @NotNull final ProblemsHolder problemsHolder) {
    for (ErlangSpecification spec : file.getSpecifications()) {
      //supported functions without modules only for now
      ErlangFunTypeSigs signature = spec.getSignature();
      if (signature != null) {
        PsiReference reference = signature.getReference();
        if (reference != null && reference.resolve() == null) {
          problemsHolder.registerProblem(spec, "Specification for undefined function '" + signature.getSpecFun().getText() + "'");
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.intellij.psi.PsiReference

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.