diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java b/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java index ebb7ce05b28..21aae5ad114 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java @@ -183,7 +183,7 @@ public class QuickFixes { factories.put(NO_TYPE_ARGUMENTS_ON_RHS_OF_IS_EXPRESSION, AddStarProjectionsFix.createFactoryForIsExpression()); factories.put(WRONG_NUMBER_OF_TYPE_ARGUMENTS, AddStarProjectionsFix.createFactoryForJavaClass()); - factories.put(TYPE_ARGUMENTS_REDUNDANT_IN_SUPER_QUALIFIER, RemoveTypeArgumentsFix.createFactory()); + factories.put(TYPE_ARGUMENTS_REDUNDANT_IN_SUPER_QUALIFIER, RemovePsiElementSimpleFix.createRemoveTypeArgumentsFactory()); JetIntentionActionFactory changeToStarProjectionFactory = ChangeToStarProjectionFix.createFactory(); factories.put(UNCHECKED_CAST, changeToStarProjectionFactory); diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/RemovePsiElementSimpleFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/RemovePsiElementSimpleFix.java index b3fd934f1f9..43388a24bb5 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/RemovePsiElementSimpleFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/RemovePsiElementSimpleFix.java @@ -27,6 +27,7 @@ import org.jetbrains.jet.lang.diagnostics.Diagnostic; import org.jetbrains.jet.lang.psi.JetExpression; import org.jetbrains.jet.lang.psi.JetImportDirective; import org.jetbrains.jet.lang.psi.JetProperty; +import org.jetbrains.jet.lang.psi.JetTypeArgumentList; import org.jetbrains.jet.lexer.JetTokens; import org.jetbrains.jet.plugin.JetBundle; @@ -91,6 +92,18 @@ public class RemovePsiElementSimpleFix extends JetIntentionAction { }; } + public static JetIntentionActionFactory createRemoveTypeArgumentsFactory() { + return new JetIntentionActionFactory() { + @Override + public JetIntentionAction createAction(Diagnostic diagnostic) { + JetTypeArgumentList element = QuickFixUtil.getParentElementOfType(diagnostic, JetTypeArgumentList.class); + if (element == null) return null; + return new RemovePsiElementSimpleFix(element, + JetBundle.message("remove.type.arguments")); + } + }; + } + public static JetIntentionActionFactory createRemoveVariableFactory() { return new JetIntentionActionFactory() { @Override diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveTypeArgumentsFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveTypeArgumentsFix.java deleted file mode 100644 index efd2e979e70..00000000000 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveTypeArgumentsFix.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2010-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 org.jetbrains.jet.plugin.quickfix; - -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.project.Project; -import com.intellij.psi.PsiFile; -import com.intellij.util.IncorrectOperationException; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.lang.diagnostics.Diagnostic; -import org.jetbrains.jet.lang.psi.JetTypeArgumentList; -import org.jetbrains.jet.plugin.JetBundle; - -public class RemoveTypeArgumentsFix extends JetIntentionAction { - private final JetTypeArgumentList typeArgList; - - public RemoveTypeArgumentsFix(@NotNull JetTypeArgumentList element) { - super(element); - typeArgList = element; - } - - @NotNull - @Override - public String getText() { - return JetBundle.message("remove.type.arguments"); - } - - @NotNull - @Override - public String getFamilyName() { - return JetBundle.message("remove.type.arguments"); - } - - @Override - public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { - typeArgList.delete(); - } - - public static JetIntentionActionFactory createFactory() { - return new JetIntentionActionFactory() { - @Override - public JetIntentionAction createAction(Diagnostic diagnostic) { - JetTypeArgumentList element = QuickFixUtil.getParentElementOfType(diagnostic, JetTypeArgumentList.class); - if (element == null) return null; - return new RemoveTypeArgumentsFix(element); - } - }; - } -} \ No newline at end of file