From 61511b27edd7decc5a0ee7043e3e7e67ae1f517e Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Wed, 13 Mar 2019 11:52:12 +0300 Subject: [PATCH] [groovy] proper family name for Create Parameter and Method from usage fixes --- .../plugins/groovy/GroovyBundle.properties | 5 ++-- .../intentions/CreateMethodFromUsageFix.java | 8 ++++++- .../CreateParameterFromUsageFix.java | 24 ++++--------------- .../intentions/GrCreateFromUsageBaseFix.java | 9 ------- 4 files changed, 15 insertions(+), 31 deletions(-) diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyBundle.properties b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyBundle.properties index a865c1762805..57e634e0a377 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyBundle.properties +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyBundle.properties @@ -207,12 +207,14 @@ add.dynamic.property=Add Dynamic Property ''{0}'' duplicate.element.in.the.map=Duplicate element ''{0}'' in the map dynamic.tool.window.id=Dynamic Members -create.from.usage.family.name=Create From Usage create.field.from.usage.family.name=Create field from usage create.field.from.usage=Create field ''{0}'' +create.method.from.usage.family.name=Create method from usage create.method.from.usage=Create method ''{0}'' create.variable.from.usage.family.name=Create variable from usage create.variable.from.usage=Create Variable ''{0}'' +create.parameter.from.usage.family.name=Create parameter from usage +create.parameter.from.usage=Create parameter ''{0}'' add.dynamic.element=Add dynamic element add.dynamic.method=Add Dynamic Method dynamic.type=Type @@ -288,7 +290,6 @@ ellipsis.type.is.not.allowed.here=Ellipsis type is not allowed here method.0.is.too.complex.too.analyze=Method ''{0}'' is too complex to analyze.\nTypes of local variables are not inferred. closure.is.too.complex.to.analyze=Closure is complex to analyze.\nTypes of local variables are not inferred. 0.is.deprecated=''{0}'' is deprecated -create.parameter.from.usage=Create parameter ''{0}'' wrong.number.of.type.arguments=Wrong number of type arguments\: {0}; required\: {1} type.argument.0.is.not.in.its.bound.should.extend.1=Type parameter ''{0}'' is not in its bound; should extend ''{1}'' catch.statement.parameter.type.should.be.a.subclass.of.throwable=Catch statement parameter type should be a subclass of Throwable diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateMethodFromUsageFix.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateMethodFromUsageFix.java index c40adee85860..ababffbb294c 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateMethodFromUsageFix.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateMethodFromUsageFix.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.annotator.intentions; import com.intellij.codeInsight.generation.OverrideImplementUtil; @@ -33,6 +33,12 @@ public class CreateMethodFromUsageFix extends GrCreateFromUsageBaseFix implement super(refExpression); } + @NotNull + @Override + public String getFamilyName() { + return GroovyBundle.message("create.method.from.usage.family.name"); + } + @Override @NotNull public String getText() { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateParameterFromUsageFix.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateParameterFromUsageFix.java index 3d80c3c21274..37d43f6b0893 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateParameterFromUsageFix.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateParameterFromUsageFix.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.annotator.intentions; import com.intellij.ide.util.SuperMethodWarningUtil; @@ -60,14 +46,14 @@ public class CreateParameterFromUsageFix extends Intention implements MethodOrCl @NotNull @Override - public String getText() { - return GroovyBundle.message("create.parameter.from.usage", myName); + public String getFamilyName() { + return GroovyBundle.message("create.parameter.from.usage.family.name"); } @NotNull @Override - public String getFamilyName() { - return GroovyBundle.message("create.from.usage.family.name"); + public String getText() { + return GroovyBundle.message("create.parameter.from.usage", myName); } @Override diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/GrCreateFromUsageBaseFix.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/GrCreateFromUsageBaseFix.java index 5ce0da1f7d36..43297f0f3cfb 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/GrCreateFromUsageBaseFix.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/GrCreateFromUsageBaseFix.java @@ -12,12 +12,9 @@ import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.psi.*; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; -import org.jetbrains.plugins.groovy.GroovyBundle; import org.jetbrains.plugins.groovy.intentions.base.Intention; import org.jetbrains.plugins.groovy.intentions.base.PsiElementPredicate; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression; -import org.jetbrains.plugins.groovy.lang.psi.util.GrStaticChecker; -import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil; import javax.swing.*; import java.util.ArrayList; @@ -34,12 +31,6 @@ public abstract class GrCreateFromUsageBaseFix extends Intention { myRefExpression = SmartPointerManager.getInstance(refExpression.getProject()).createSmartPsiElementPointer(refExpression); } - @Override - @NotNull - public String getFamilyName() { - return GroovyBundle.message("create.from.usage.family.name"); - } - protected GrReferenceExpression getRefExpr() { return myRefExpression.getElement(); }