mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-268397: [refactor this] enable 'make static' refactoring on class declarations
GitOrigin-RevId: 0ab9f8b753d0a51a828a03efb96aa435207627be
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6fec7a3fcf
commit
fa2a15b820
@@ -85,7 +85,7 @@ public class MakeStaticHandler implements RefactoringActionHandler, ContextAware
|
||||
@Override
|
||||
public boolean isAvailableForQuickList(@NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext dataContext) {
|
||||
PsiElement element = BaseRefactoringAction.getElementAtCaret(editor, file);
|
||||
return RefactoringActionContextUtil.getJavaMethodHeader(element) != null;
|
||||
return RefactoringActionContextUtil.getJavaMethodHeader(element) != null || RefactoringActionContextUtil.isJavaClassHeader(element);
|
||||
}
|
||||
|
||||
public static void invoke(final PsiTypeParameterListOwner member) {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
public class Test {
|
||||
static class Inner<caret> {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
public class Test {
|
||||
int x = 42;
|
||||
class Inner<caret> {
|
||||
void test(){
|
||||
System.out.println(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -155,10 +155,18 @@ class RefactorThisTest: LightJavaCodeInsightTestCase() {
|
||||
assertFalse(doActionExists<WrapReturnValueAction>())
|
||||
}
|
||||
|
||||
fun testMakeStatic() {
|
||||
fun testMakeStaticOnMethodDeclaration() {
|
||||
assertTrue(doActionExists<MakeStaticAction>())
|
||||
}
|
||||
|
||||
fun testMakeStaticOnClassDeclaration() {
|
||||
assertTrue(doActionExists<MakeStaticAction>())
|
||||
}
|
||||
|
||||
fun testMakeStaticFilteredOnStaticClass() {
|
||||
assertFalse(doActionExists<MakeStaticAction>())
|
||||
}
|
||||
|
||||
fun testMakeStaticFiltered() {
|
||||
assertFalse(doActionExists<MakeStaticAction>())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user