diff --git a/idea/src/org/jetbrains/jet/plugin/intentions/SpecifyTypeExplicitlyAction.java b/idea/src/org/jetbrains/jet/plugin/intentions/SpecifyTypeExplicitlyAction.java index 60e7ceaed7d..8c9f857d7e3 100644 --- a/idea/src/org/jetbrains/jet/plugin/intentions/SpecifyTypeExplicitlyAction.java +++ b/idea/src/org/jetbrains/jet/plugin/intentions/SpecifyTypeExplicitlyAction.java @@ -48,16 +48,6 @@ import java.util.Collections; public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction { private JetType targetType; - private boolean disabledForError; - - public SpecifyTypeExplicitlyAction() { - this(true); - } - - public SpecifyTypeExplicitlyAction(boolean disabledForError) { - this.disabledForError = disabledForError; - } - @NotNull @Override public String getFamilyName() { @@ -118,7 +108,7 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction { if (targetType == null || ErrorUtils.isErrorType(targetType)) { return false; } - if (disabledForError) { + if (isDisabledForError()) { for (Diagnostic diagnostic : bindingContext.getDiagnostics()) { if (Errors.PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE == diagnostic.getFactory() && element.getParent() == diagnostic.getPsiElement()) { return false; @@ -128,6 +118,10 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction { return true; } + protected boolean isDisabledForError() { + return true; + } + public static void addTypeAnnotation(Project project, JetProperty property, @NotNull JetType exprType) { if (property.getPropertyTypeRef() != null) return; PsiElement anchor = property.getNameIdentifier(); diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java b/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java index d728a2918c0..0935e9e22db 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java @@ -20,10 +20,8 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import com.intellij.codeInsight.intention.IntentionAction; import org.jetbrains.jet.lang.diagnostics.AbstractDiagnosticFactory; -import org.jetbrains.jet.lang.diagnostics.Errors; import org.jetbrains.jet.lang.psi.JetClass; import org.jetbrains.jet.plugin.codeInsight.ImplementMethodsHandler; -import org.jetbrains.jet.plugin.intentions.SpecifyTypeExplicitlyAction; import java.util.Collection; @@ -136,6 +134,6 @@ public class QuickFixes { actions.put(UNNECESSARY_SAFE_CALL, new ReplaceCallFix(false)); actions.put(UNSAFE_CALL, new ReplaceCallFix(true)); - actions.put(PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE, new SpecifyTypeExplicitlyAction(false)); + actions.put(PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE, new SpecifyTypeExplicitlyFix()); } } \ No newline at end of file diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/SpecifyTypeExplicitlyFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/SpecifyTypeExplicitlyFix.java new file mode 100644 index 00000000000..5a25a81b7f8 --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/SpecifyTypeExplicitlyFix.java @@ -0,0 +1,31 @@ +/* + * Copyright 2010-2012 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 org.jetbrains.jet.plugin.quickfix; + +import org.jetbrains.jet.plugin.intentions.SpecifyTypeExplicitlyAction; + +/** + * @author Evgeny Gerashchenko + * @since 5/3/12 + */ +@SuppressWarnings("IntentionDescriptionNotFoundInspection") +public class SpecifyTypeExplicitlyFix extends SpecifyTypeExplicitlyAction { + @Override + protected boolean isDisabledForError() { + return false; + } +}