More special icons for kotlin entities

This commit is contained in:
Nikolay Krasko
2012-04-13 18:16:55 +04:00
parent 482887c052
commit e161c66a78
12 changed files with 54 additions and 14 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

Before

Width:  |  Height:  |  Size: 473 B

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 828 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

@@ -17,7 +17,6 @@
package org.jetbrains.jet.plugin;
import com.intellij.ide.IconProvider;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.Iconable;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
@@ -34,8 +33,6 @@ import java.util.List;
* @author yole
*/
public class JetIconProvider extends IconProvider {
public static final Icon ICON_FOR_OBJECT = PlatformIcons.ANONYMOUS_CLASS_ICON;
public static final Icon KOTLIN_ICON = IconLoader.getIcon("/org/jetbrains/jet/plugin/icons/kotlin16x16.png");
public static JetIconProvider INSTANCE = new JetIconProvider();
@@ -60,41 +57,47 @@ public class JetIconProvider extends IconProvider {
if (mostImportantClass != null) {
return getIcon(mostImportantClass, flags);
}
return KOTLIN_ICON;
return JetIcons.FILE;
}
if (psiElement instanceof JetNamespaceHeader) {
return (flags & Iconable.ICON_FLAG_OPEN) != 0 ? PlatformIcons.PACKAGE_OPEN_ICON : PlatformIcons.PACKAGE_ICON;
}
if (psiElement instanceof JetNamedFunction) {
return PsiTreeUtil.getParentOfType(psiElement, JetNamedDeclaration.class) instanceof JetClass
? PlatformIcons.METHOD_ICON
: PlatformIcons.FUNCTION_ICON;
? JetIcons.LAMBDA
: JetIcons.FUNCTION;
}
if (psiElement instanceof JetClass) {
JetClass jetClass = (JetClass) psiElement;
if (jetClass.isTrait()) {
return JetIcons.TRAIT;
}
Icon icon = jetClass.hasModifier(JetTokens.ENUM_KEYWORD) ? PlatformIcons.ENUM_ICON : PlatformIcons.CLASS_ICON;
if (jetClass instanceof JetEnumEntry) {
JetEnumEntry enumEntry = (JetEnumEntry) jetClass;
if (enumEntry.getPrimaryConstructorParameterList() == null) {
icon = ICON_FOR_OBJECT;
icon = PlatformIcons.ENUM_ICON;
}
}
return icon;
}
if (psiElement instanceof JetObjectDeclaration || psiElement instanceof JetClassObject) {
return ICON_FOR_OBJECT;
return JetIcons.OBJECT;
}
if (psiElement instanceof JetParameter) {
if (((JetParameter) psiElement).getValOrVarNode() != null) {
JetParameter parameter = (JetParameter)psiElement;
if (parameter.getValOrVarNode() != null) {
JetParameterList parameterList = PsiTreeUtil.getParentOfType(psiElement, JetParameterList.class);
if (parameterList != null && parameterList.getParent() instanceof JetClass) {
return PlatformIcons.PROPERTY_ICON;
return parameter.isVarArg() ? JetIcons.VAR : JetIcons.VAL;
}
}
return PlatformIcons.PARAMETER_ICON;
return JetIcons.PARAMETER;
}
if (psiElement instanceof JetProperty) {
return PlatformIcons.PROPERTY_ICON;
JetProperty property = (JetProperty)psiElement;
return property.isVar() ? JetIcons.VAR : JetIcons.VAL;
}
return null;
}
@@ -0,0 +1,37 @@
/*
* Copyright 2010-2012 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;
import com.intellij.openapi.util.IconLoader;
import javax.swing.*;
/**
* @author Nikolay Krasko
*/
public interface JetIcons {
Icon SMALL_LOGO = IconLoader.getIcon("/org/jetbrains/jet/plugin/icons/kotlin16x16.png");
Icon FILE = SMALL_LOGO; // TODO: Add file icon
Icon OBJECT = IconLoader.getIcon("/org/jetbrains/jet/plugin/icons/object.png");
Icon TRAIT = IconLoader.getIcon("/org/jetbrains/jet/plugin/icons/trait.png");
Icon FUNCTION = IconLoader.getIcon("/org/jetbrains/jet/plugin/icons/function.png");
Icon LAMBDA = IconLoader.getIcon("/org/jetbrains/jet/plugin/icons/lambda.png");
Icon VAR = IconLoader.getIcon("/org/jetbrains/jet/plugin/icons/variable.png");
Icon VAL = IconLoader.getIcon("/org/jetbrains/jet/plugin/icons/value.png");
Icon PARAMETER = IconLoader.getIcon("/org/jetbrains/jet/plugin/icons/parameter.png");
}
@@ -24,7 +24,7 @@ import com.intellij.openapi.options.colors.ColorDescriptor;
import com.intellij.openapi.options.colors.ColorSettingsPage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.plugin.JetBundle;
import org.jetbrains.jet.plugin.JetIconProvider;
import org.jetbrains.jet.plugin.JetIcons;
import javax.swing.*;
import java.lang.reflect.Field;
@@ -35,7 +35,7 @@ import java.util.Map;
public class JetColorSettingsPage implements ColorSettingsPage {
@Override
public Icon getIcon() {
return JetIconProvider.KOTLIN_ICON;
return JetIcons.SMALL_LOGO;
}
@NotNull