mock filetype manager if no application allows running lexer suites.
[fedora-idea.git] / refactoring / impl / com / intellij / refactoring / actions / PullUpAction.java
blob8e62086d6b85304645f8e121a2f403cae3e605e0
2 package com.intellij.refactoring.actions;
4 import com.intellij.openapi.actionSystem.DataContext;
5 import com.intellij.psi.PsiClass;
6 import com.intellij.psi.PsiElement;
7 import com.intellij.refactoring.RefactoringActionHandler;
8 import com.intellij.refactoring.memberPullUp.PullUpHandler;
10 public class PullUpAction extends BaseRefactoringAction {
11 public boolean isAvailableInEditorOnly() {
12 return false;
15 public boolean isEnabledOnElements(PsiElement[] elements) {
17 if (elements.length == 1) {
18 return elements[0] instanceof PsiClass || elements[0] instanceof PsiField || elements[0] instanceof PsiMethod;
20 else if (elements.length > 1){
21 for (int idx = 0; idx < elements.length; idx++) {
22 PsiElement element = elements[idx];
23 if (!(element instanceof PsiField || element instanceof PsiMethod)) return false;
25 return true;
27 return false;
29 // todo: multiple selection etc
30 return elements.length == 1 && elements[0] instanceof PsiClass;
33 public RefactoringActionHandler getHandler(DataContext dataContext) {
34 return new PullUpHandler();