lazy icon loading

This commit is contained in:
Dmitry Jemerov
2011-10-17 13:58:57 +02:00
parent f29768efe9
commit fa3c8b4cfe
@@ -5,13 +5,20 @@ package org.jetbrains.jet.plugin;
import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.NotNullLazyValue;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
public class JetFileType extends LanguageFileType {
public static final JetFileType INSTANCE = new JetFileType();
private final Icon myIcon = IconLoader.getIcon("/org/jetbrains/jet/plugin/icons/kotlin16x16.png");
private final NotNullLazyValue<Icon> myIcon = new NotNullLazyValue<Icon>() {
@NotNull
@Override
protected Icon compute() {
return IconLoader.getIcon("/org/jetbrains/jet/plugin/icons/kotlin16x16.png");
}
};
private JetFileType() {
super(JetLanguage.INSTANCE);
@@ -33,7 +40,7 @@ public class JetFileType extends LanguageFileType {
}
public Icon getIcon() {
return myIcon;
return myIcon.getValue();
}
@Override