Search in sources :

Example 6 with PullUpProcessor

use of com.intellij.refactoring.memberPullUp.PullUpProcessor in project intellij-community by JetBrains.

the class GrExtractInterfaceHandler method extractInterface.

public static PsiClass extractInterface(PsiDirectory targetDir, PsiClass aClass, String interfaceName, MemberInfo[] selectedMembers, DocCommentPolicy javaDocPolicy) throws IncorrectOperationException {
    PsiClass anInterface = JavaDirectoryService.getInstance().createInterface(targetDir, interfaceName);
    PsiJavaCodeReferenceElement ref = ExtractSuperClassUtil.createExtendingReference(anInterface, aClass, selectedMembers);
    final PsiReferenceList referenceList = aClass.isInterface() ? aClass.getExtendsList() : aClass.getImplementsList();
    assert referenceList != null;
    referenceList.add(ref);
    PullUpProcessor pullUpHelper = new PullUpProcessor(aClass, anInterface, selectedMembers, javaDocPolicy);
    pullUpHelper.moveMembersToBase();
    return anInterface;
}
Also used : PullUpProcessor(com.intellij.refactoring.memberPullUp.PullUpProcessor)

Aggregations

PullUpProcessor (com.intellij.refactoring.memberPullUp.PullUpProcessor)6 DocCommentPolicy (com.intellij.refactoring.util.DocCommentPolicy)3 MemberInfo (com.intellij.refactoring.util.classMembers.MemberInfo)3 JavaTestUtil (com.intellij.JavaTestUtil)2 com.intellij.psi (com.intellij.psi)2 PullUpConflictsUtil (com.intellij.refactoring.memberPullUp.PullUpConflictsUtil)2 MultiMap (com.intellij.util.containers.MultiMap)2 Arrays (java.util.Arrays)2 NotNull (org.jetbrains.annotations.NotNull)2 Project (com.intellij.openapi.project.Project)1 LanguageLevel (com.intellij.pom.java.LanguageLevel)1 CodeStyleManager (com.intellij.psi.codeStyle.CodeStyleManager)1 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)1 MethodSignature (com.intellij.psi.util.MethodSignature)1 PsiTreeUtil (com.intellij.psi.util.PsiTreeUtil)1 JavaRefactoringListenerManager (com.intellij.refactoring.listeners.JavaRefactoringListenerManager)1 MoveMemberListener (com.intellij.refactoring.listeners.MoveMemberListener)1 UIUtil (com.intellij.util.ui.UIUtil)1 HashSet (java.util.HashSet)1 TreeSet (java.util.TreeSet)1