Ejemplo n.º 1
0
 @Override
 public void shortenClassReferences(@NotNull PsiElement element, int startOffset, int endOffset)
     throws IncorrectOperationException {
   CheckUtil.checkWritable(element);
   if (SourceTreeToPsiMap.hasTreeElement(element)) {
     final ReferenceAdjuster adjuster =
         ReferenceAdjuster.Extension.getReferenceAdjuster(element.getLanguage());
     if (adjuster != null) {
       adjuster.processRange(element.getNode(), startOffset, endOffset, myProject);
     }
   }
 }
Ejemplo n.º 2
0
  @Override
  public PsiElement shortenClassReferences(@NotNull PsiElement element, int flags)
      throws IncorrectOperationException {
    CheckUtil.checkWritable(element);
    if (!SourceTreeToPsiMap.hasTreeElement(element)) return element;

    final boolean addImports = (flags & DO_NOT_ADD_IMPORTS) == 0;
    final boolean incompleteCode = (flags & UNCOMPLETE_CODE) != 0;

    final ReferenceAdjuster adjuster =
        ReferenceAdjuster.Extension.getReferenceAdjuster(element.getLanguage());
    if (adjuster != null) {
      final ASTNode reference =
          adjuster.process(element.getNode(), addImports, incompleteCode, myProject);
      return SourceTreeToPsiMap.treeToPsiNotNull(reference);
    } else {
      return element;
    }
  }