mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IPP: make method default cosmetics
This commit is contained in:
@@ -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;
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
public interface X {
|
||||
default void foo(){}
|
||||
default void foo() {}
|
||||
}
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
public interface X {
|
||||
<spot>void foo()</spot>
|
||||
<spot>void foo();</spot>
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention adds default modifier and body to method in interface
|
||||
Adds a default modifier and body to a method in an interface.
|
||||
<!-- tooltip end -->
|
||||
</body>
|
||||
</html>
|
||||
@@ -22,7 +22,7 @@ public class MakeMethodDefaultTest extends IPPTestCase {
|
||||
|
||||
@Override
|
||||
protected String getIntentionName() {
|
||||
return "Make method default";
|
||||
return "Make 'foo()' default";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user