Examples of PsiReference


Examples of com.intellij.psi.PsiReference

                        String uri = str.substring(textRange.getStartOffset(), textRange.getEndOffset());
                        int start = textRange.getStartOffset();
                        int len = textRange.getLength();

                        if (widgetfile != null) {
                            PsiReference ref = new FileReference(widgetfile, uri, element,
                                    new TextRange(start, start + len), project, protectedPathDir, protectedPathDir);
                            return new PsiReference[]{ref};
                        }
                        return PsiReference.EMPTY_ARRAY;
                    }
View Full Code Here

Examples of com.intellij.psi.PsiReference

                    }

                    if (file != null) {

                        if (appDir != null) {
                            PsiReference ref = new FileReference(file, uri, element,
                                    textRange, YiiPsiReferenceProvider.project, protectedVirtual, appDir);
                            return new PsiReference[]{ref};
                        }
                    }
                }
View Full Code Here

Examples of com.intellij.psi.PsiReference

                                }
                                VirtualFile appDir = baseDir.findFileByRelativePath(viewPath);
                                VirtualFile protectedPathDir = (!protectedPath.equals("")) ?
                                        baseDir.findFileByRelativePath(protectedPath) : null;
                                if (appDir != null) {
                                    PsiReference ref = new ViewsReference(controllerName, uri, element,
                                            new TextRange(start, start + len), project, protectedPathDir, appDir);
                                    return new PsiReference[]{ref};
                                }
                            }
                            return PsiReference.EMPTY_ARRAY;
View Full Code Here

Examples of com.intellij.psi.PsiReference

    if (!hasNonAttributeRefs) {
      CommonRefactoringUtil.showErrorHint(project, editor, "Rule is referenced only in attributes", "Inline Rule", null);
      return;
    }
    if (!CommonRefactoringUtil.checkReadOnlyStatus(project, rule)) return;
    PsiReference reference = editor != null ? TargetElementUtilBase.findReference(editor, editor.getCaretModel().getOffset()) : null;
    if (reference != null && !rule.equals(reference.resolve())) {
      reference = null;
    }

    InlineRuleDialog dialog = new InlineRuleDialog(project, rule, reference);
    dialog.show();
View Full Code Here

Examples of com.intellij.psi.PsiReference

      final int line = myFixture.getEditor().getDocument().getLineNumber(caretOffset);
      final int column = caretOffset - myFixture.getEditor().getDocument().getLineStartOffset(line);
      final String fileNameAndPosition = myFixture.getFile().getName() + ":" + (line + 1) + ":" + (column + 1);

      final PsiReference reference = TargetElementUtilBase.findReference(myFixture.getEditor(), caretOffset);
      assertNotNull("No reference in " + fileNameAndPosition, reference);

      final PsiElement resolve = reference.resolve();
      final String actualElementPosition = getPresentableElementPosition(resolve);
      assertEquals("Incorrect resolve for element in " + fileNameAndPosition, expectedResult, actualElementPosition);
    }
  }
View Full Code Here

Examples of com.intellij.psi.PsiReference

  private void doTest(String name,
                      ResolveTarget resolveTarget,
                      Object expectedResolveTarget) {
    final OgnlVariableExpression expression = parse("#" + name);

    final PsiReference reference = expression.getReference();
    assertNotNull(reference);
    assertEquals(name, reference.getCanonicalText());

    final PsiElement resolveElement = reference.resolve();
    switch (resolveTarget) {
      case NULL:
        assertNull(resolveElement);
        break;
      case ELEMENT:
View Full Code Here

Examples of com.intellij.psi.PsiReference

    final ItemPresentation presentation = expression.getPresentation();
    assertNotNull(presentation);
    assertEquals("exp", presentation.getPresentableText());
    assertNull(expression.getType());

    final PsiReference reference = expression.getReference();
    assertNotNull(reference);
    assertEquals("exp", reference.getCanonicalText());
    assertEquals(expression.getNavigationElement(), reference.resolve());
  }
View Full Code Here

Examples of com.intellij.psi.PsiReference

    assertEquals(expression.getNavigationElement(), reference.resolve());
  }

  public void testNestedReference() {
    final OgnlReferenceExpression expression = parse("exp.sub");
    final PsiReference reference = expression.getReference();
    assertNotNull(reference);
    assertEquals("exp.sub", reference.getCanonicalText());
    assertEquals(expression.getNavigationElement(), reference.resolve());
  }
View Full Code Here

Examples of com.intellij.psi.PsiReference

    assertEquals(expression.getNavigationElement(), reference.resolve());
  }

  public void testStaticFieldReference() {
    final OgnlReferenceExpression expression = parse("@some@thing");
    final PsiReference reference = expression.getReference();
    assertNotNull(reference);
    assertEquals("@some@thing", reference.getCanonicalText());
  }
View Full Code Here

Examples of com.intellij.psi.PsiReference

    assertEquals("@some@thing", reference.getCanonicalText());
  }

  public void testQualifiedClassNameStaticFieldReference() {
    final OgnlReferenceExpression expression = parse("@a.b.some@thing");
    final PsiReference reference = expression.getReference();
    assertNotNull(reference);
    assertEquals("@a.b.some@thing", reference.getCanonicalText());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.