Java 类com.intellij.psi.codeStyle.ReferenceAdjuster 实例源码

项目:consulo-java    文件:JavaCodeStyleManagerImpl.java   
@NotNull
@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 & INCOMPLETE_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;
    }
}
项目:consulo-java    文件:JavaCodeStyleManagerImpl.java   
@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);
        }
    }
}
项目:consulo-java    文件:JavaCodeStyleManagerImpl.java   
@NotNull
@Override
public PsiElement qualifyClassReferences(@NotNull PsiElement element)
{
    final ReferenceAdjuster adjuster = ReferenceAdjuster.Extension.getReferenceAdjuster(element.getLanguage());
    if(adjuster != null)
    {
        final ASTNode reference = adjuster.process(element.getNode(), false, false, true, true);
        return SourceTreeToPsiMap.treeToPsiNotNull(reference);
    }
    return element;
}