Runnable icon for all classes Groovy can run

This commit is contained in:
Maxim.Medvedev
2012-02-22 15:16:28 +04:00
parent fb5df5ad3e
commit 1d05ead46e
2 changed files with 8 additions and 2 deletions
@@ -86,7 +86,7 @@ public class ElementPresentationUtil implements PlatformIcons {
private static final int FLAGS_STATIC = 0x200;
private static final int FLAGS_FINAL = 0x400;
private static final int FLAGS_JUNIT_TEST = 0x2000;
private static final int FLAGS_RUNNABLE = 0x4000;
public static final int FLAGS_RUNNABLE = 0x4000;
private static final Key<CachedValue<Integer>> CLASS_KIND_KEY = new Key<CachedValue<Integer>>("CLASS_KIND_KEY");
@@ -74,6 +74,7 @@ import org.jetbrains.plugins.groovy.lang.psi.stubs.GrTypeDefinitionStub;
import org.jetbrains.plugins.groovy.lang.psi.util.GrClassImplUtil;
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
import org.jetbrains.plugins.groovy.lang.resolve.AstTransformContributor;
import org.jetbrains.plugins.groovy.runner.GroovyRunnerUtil;
import org.jetbrains.plugins.groovy.util.LightCacheKey;
import javax.swing.*;
@@ -660,13 +661,18 @@ public abstract class GrTypeDefinitionImpl extends GrStubElementBase<GrTypeDefin
public Icon getIcon(int flags) {
Icon icon = getIconInner();
final boolean isLocked = (flags & ICON_FLAG_READ_STATUS) != 0 && !isWritable();
RowIcon rowIcon = ElementPresentationUtil.createLayeredIcon(icon, this, isLocked);
RowIcon rowIcon = createLayeredIcon(this, icon, ElementPresentationUtil.getFlags(this, isLocked) | getFlagsInner());
if ((flags & ICON_FLAG_VISIBILITY) != 0) {
VisibilityIcons.setVisibilityIcon(getModifierList(), rowIcon);
}
return rowIcon;
}
//hack to get runnable icon for all classes that can be run by Groovy
private int getFlagsInner() {
return GroovyRunnerUtil.isRunnable(this) ? ElementPresentationUtil.FLAGS_RUNNABLE : 0;
}
private Icon getIconInner() {
if (isAnnotationType()) return GroovyIcons.ANNOTATION_TYPE;