IDEA-120480 (Invalid set of actions on enum's constants.)

This commit is contained in:
Bas Leijdekkers
2014-02-13 16:54:20 +01:00
parent 7a166170d5
commit b7025f719f
7 changed files with 66 additions and 2 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -35,7 +35,7 @@ class ModifierPredicate implements PsiElementPredicate {
@Override
public boolean satisfiedBy(PsiElement element) {
final PsiElement parent = element.getParent();
if (!(parent instanceof PsiClass || parent instanceof PsiField || parent instanceof PsiMethod)) {
if (!(parent instanceof PsiClass || parent instanceof PsiField || parent instanceof PsiMethod) || parent instanceof PsiEnumConstant) {
return false;
}
if (element instanceof PsiDocComment || element instanceof PsiCodeBlock) {
@@ -0,0 +1,4 @@
class Method {
<caret>void m() {}
}
@@ -0,0 +1,4 @@
class Method {
private void m() {}
}
@@ -0,0 +1,5 @@
package com.siyeh.ipp.modifiers.make_public;
class<caret> MyClass {
}
@@ -0,0 +1,5 @@
package com.siyeh.ipp.modifiers.make_public;
enum MyEnum {
A, B<caret>, C
}
@@ -0,0 +1,6 @@
package com.siyeh.ipp.modifiers.make_public;
public interface MyInterface {
void <caret>m();
}
@@ -0,0 +1,40 @@
/*
* Copyright 2000-2014 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.siyeh.ipp.modifiers;
import com.siyeh.IntentionPowerPackBundle;
import com.siyeh.ipp.IPPTestCase;
/**
* @author Bas Leijdekkers
*/
public class MakePrivateIntentionTest extends IPPTestCase {
public void testMyEnum() { assertIntentionNotAvailable(); }
public void testMyClass() { assertIntentionNotAvailable(); }
public void testMyInterface() { assertIntentionNotAvailable(); }
public void testMethod() { doTest(); }
@Override
protected String getRelativePath() {
return "modifiers/make_public";
}
@Override
protected String getIntentionName() {
return IntentionPowerPackBundle.message("make.private.intention.name");
}
}