Abstract extension function added

This commit is contained in:
Nikolay Krasko
2017-04-11 13:19:44 +03:00
parent 1596f19fd7
commit 6898176b43
5 changed files with 11 additions and 10 deletions
@@ -84,16 +84,15 @@ public final class KotlinDescriptorIconProvider {
if (descriptor instanceof FunctionDescriptor) {
FunctionDescriptor functionDescriptor = (FunctionDescriptor) descriptor;
if (functionDescriptor.getExtensionReceiverParameter() != null) {
return KotlinIcons.EXTENSION_FUNCTION;
return Modality.ABSTRACT == functionDescriptor.getModality()
? KotlinIcons.ABSTRACT_EXTENSION_FUNCTION
: KotlinIcons.EXTENSION_FUNCTION;
}
if (descriptor.getContainingDeclaration() instanceof ClassDescriptor) {
if (Modality.ABSTRACT == functionDescriptor.getModality()) {
return PlatformIcons.ABSTRACT_METHOD_ICON;
}
else {
return PlatformIcons.METHOD_ICON;
}
return Modality.ABSTRACT == functionDescriptor.getModality()
? PlatformIcons.ABSTRACT_METHOD_ICON
: PlatformIcons.METHOD_ICON;
}
else {
return KotlinIcons.FUNCTION;
@@ -32,7 +32,6 @@ import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
import javax.swing.Icon
class KotlinIconProvider : IconProvider(), DumbAware {
override fun getIcon(psiElement: PsiElement, flags: Int): Icon? {
if (psiElement is KtFile) {
val mainClass = getMainClass(psiElement)
@@ -92,10 +91,12 @@ class KotlinIconProvider : IconProvider(), DumbAware {
}
is KtLightClassForSourceDeclaration -> navigationElement.getBaseIcon()
is KtNamedFunction -> when {
receiverTypeReference != null -> KotlinIcons.EXTENSION_FUNCTION
receiverTypeReference != null ->
if (KtPsiUtil.isAbstract(this)) KotlinIcons.ABSTRACT_EXTENSION_FUNCTION else KotlinIcons.EXTENSION_FUNCTION
getStrictParentOfType<KtNamedDeclaration>() is KtClass ->
if (KtPsiUtil.isAbstract(this)) PlatformIcons.ABSTRACT_METHOD_ICON else PlatformIcons.METHOD_ICON
else -> KotlinIcons.FUNCTION
else ->
KotlinIcons.FUNCTION
}
is KtFunctionLiteral -> KotlinIcons.LAMBDA
is KtClass -> when {
@@ -36,6 +36,7 @@ public interface KotlinIcons {
Icon ANNOTATION = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/annotationKotlin.png");
Icon FUNCTION = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/function.png");
Icon EXTENSION_FUNCTION = PlatformIcons.FUNCTION_ICON;
Icon ABSTRACT_EXTENSION_FUNCTION = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/abstract_extension_function.png");
Icon LAMBDA = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/lambda.png");
Icon VAR = PlatformIcons.VARIABLE_ICON;
Icon VAL = IconLoader.getIcon("/org/jetbrains/kotlin/idea/icons/value.png");
Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B