diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/types/MakeMethodDefaultIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/types/MakeMethodDefaultIntention.java index c1a68b4c11e2..a37ff7a31970 100644 --- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/types/MakeMethodDefaultIntention.java +++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/types/MakeMethodDefaultIntention.java @@ -1,5 +1,5 @@ /* - * Copyright 2011 Bas Leijdekkers + * 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. @@ -26,10 +26,13 @@ import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; public class MakeMethodDefaultIntention extends BaseElementAtCaretIntentionAction { + + private String text = "Make method default"; + @NotNull @Override public String getText() { - return "Make method default"; + return text; } @NotNull @@ -44,7 +47,10 @@ public class MakeMethodDefaultIntention extends BaseElementAtCaretIntentionActio if (psiMethod != null && PsiUtil.isLanguageLevel8OrHigher(psiMethod)) { if (psiMethod.getBody() == null && !psiMethod.hasModifierProperty(PsiModifier.DEFAULT)) { final PsiClass containingClass = psiMethod.getContainingClass(); - return containingClass != null && containingClass.isInterface(); + if (containingClass != null && containingClass.isInterface()) { + text = "Make '" + psiMethod.getName() + "()' default"; + return true; + } } } return false; diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/MakeMethodDefaultIntention/after.java.template b/plugins/IntentionPowerPak/src/intentionDescriptions/MakeMethodDefaultIntention/after.java.template index 57243a54282b..d422297cb87b 100644 --- a/plugins/IntentionPowerPak/src/intentionDescriptions/MakeMethodDefaultIntention/after.java.template +++ b/plugins/IntentionPowerPak/src/intentionDescriptions/MakeMethodDefaultIntention/after.java.template @@ -1,3 +1,3 @@ public interface X { - default void foo(){} + default void foo() {} } \ No newline at end of file diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/MakeMethodDefaultIntention/before.java.template b/plugins/IntentionPowerPak/src/intentionDescriptions/MakeMethodDefaultIntention/before.java.template index db31b04c6025..f3fd8d2b8c14 100644 --- a/plugins/IntentionPowerPak/src/intentionDescriptions/MakeMethodDefaultIntention/before.java.template +++ b/plugins/IntentionPowerPak/src/intentionDescriptions/MakeMethodDefaultIntention/before.java.template @@ -1,3 +1,3 @@ public interface X { - void foo() + void foo(); } \ No newline at end of file diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/MakeMethodDefaultIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/MakeMethodDefaultIntention/description.html index d939cf8c7523..fb1df8a01103 100644 --- a/plugins/IntentionPowerPak/src/intentionDescriptions/MakeMethodDefaultIntention/description.html +++ b/plugins/IntentionPowerPak/src/intentionDescriptions/MakeMethodDefaultIntention/description.html @@ -1,6 +1,6 @@ -This intention adds default modifier and body to method in interface +Adds a default modifier and body to a method in an interface. \ No newline at end of file diff --git a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/types/MakeMethodDefaultTest.java b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/types/MakeMethodDefaultTest.java index e81dda48a2ea..e2939b50abe1 100644 --- a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/types/MakeMethodDefaultTest.java +++ b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/types/MakeMethodDefaultTest.java @@ -22,7 +22,7 @@ public class MakeMethodDefaultTest extends IPPTestCase { @Override protected String getIntentionName() { - return "Make method default"; + return "Make 'foo()' default"; } @Override