Search in sources :

Example 1 with MoveHandlerDelegate

use of com.intellij.refactoring.move.MoveHandlerDelegate in project intellij-community by JetBrains.

the class MoveInnerToUpperOrMembersHandler method doMove.

public void doMove(final Project project, final PsiElement[] elements, final PsiElement targetContainer, final MoveCallback callback) {
    SelectInnerOrMembersRefactoringDialog dialog = new SelectInnerOrMembersRefactoringDialog((PsiClass) elements[0], project);
    if (!dialog.showAndGet()) {
        return;
    }
    MoveHandlerDelegate delegate = dialog.getRefactoringHandler();
    if (delegate != null) {
        delegate.doMove(project, elements, targetContainer, callback);
    }
}
Also used : MoveHandlerDelegate(com.intellij.refactoring.move.MoveHandlerDelegate)

Example 2 with MoveHandlerDelegate

use of com.intellij.refactoring.move.MoveHandlerDelegate in project intellij-community by JetBrains.

the class MoveInnerToUpperOrMembersHandler method tryToMove.

public boolean tryToMove(final PsiElement element, final Project project, final DataContext dataContext, final PsiReference reference, final Editor editor) {
    if (isStaticInnerClass(element) && !JavaMoveClassesOrPackagesHandler.isReferenceInAnonymousClass(reference)) {
        FeatureUsageTracker.getInstance().triggerFeatureUsed("refactoring.move.moveInner");
        final PsiElement targetContainer = LangDataKeys.TARGET_PSI_ELEMENT.getData(dataContext);
        PsiClass aClass = (PsiClass) element;
        SelectInnerOrMembersRefactoringDialog dialog = new SelectInnerOrMembersRefactoringDialog(aClass, project);
        if (dialog.showAndGet()) {
            final MoveHandlerDelegate moveHandlerDelegate = dialog.getRefactoringHandler();
            if (moveHandlerDelegate != null) {
                moveHandlerDelegate.doMove(project, new PsiElement[] { aClass }, targetContainer, null);
            }
        }
        return true;
    }
    return false;
}
Also used : MoveHandlerDelegate(com.intellij.refactoring.move.MoveHandlerDelegate) PsiClass(com.intellij.psi.PsiClass) PsiElement(com.intellij.psi.PsiElement)

Aggregations

MoveHandlerDelegate (com.intellij.refactoring.move.MoveHandlerDelegate)2 PsiClass (com.intellij.psi.PsiClass)1 PsiElement (com.intellij.psi.PsiElement)1