mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
IDEA-111715: implements for enum constant without class initializer
This commit is contained in:
@@ -72,7 +72,9 @@ public class ImplementMethodsFix extends LocalQuickFixAndIntentionActionOnPsiEle
|
||||
|
||||
if (editor == null || !FileModificationService.getInstance().prepareFileForWrite(myPsiElement.getContainingFile())) return;
|
||||
if (myPsiElement instanceof PsiEnumConstant) {
|
||||
final MemberChooser<PsiMethodMember> chooser = chooseMethodsToImplement(editor, startElement, ((PsiEnumConstant)myPsiElement).getContainingClass(), true);
|
||||
final boolean hasClassInitializer = ((PsiEnumConstant)myPsiElement).getInitializingClass() != null;
|
||||
final MemberChooser<PsiMethodMember> chooser = chooseMethodsToImplement(editor, startElement,
|
||||
((PsiEnumConstant)myPsiElement).getContainingClass(), hasClassInitializer);
|
||||
if (chooser == null) return;
|
||||
|
||||
final List<PsiMethodMember> selectedElements = chooser.getSelectedElements();
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Implement Methods" "true"
|
||||
enum E {
|
||||
A {
|
||||
public void foo() {
|
||||
|
||||
}
|
||||
};
|
||||
abstract void foo();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Implement Methods" "true"
|
||||
enum E {
|
||||
<caret>A;
|
||||
public abstract void foo();
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight;
|
||||
|
||||
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixAvailabilityTestCase;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
* Date: 10/7/11
|
||||
*/
|
||||
public class ImplementMethodsTest extends LightQuickFixAvailabilityTestCase {
|
||||
public void test() throws Exception {
|
||||
doAllTests();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return "/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user