make java method/field deferred icons not flickering IDEA-343602

GitOrigin-RevId: 56bbc9a8235bab6032ce6da531b517780f34c0c5
This commit is contained in:
Dmitry Batkovich
2024-01-22 10:28:30 +01:00
committed by intellij-monorepo-bot
parent 6c0c329ac4
commit 0e123a278a
11 changed files with 42 additions and 22 deletions

View File

@@ -227,13 +227,19 @@ public class ClsFieldImpl extends ClsMemberImpl<PsiFieldStub> implements PsiFiel
}
@Override
public Icon getElementIcon(final int flags) {
public Icon getElementIcon(int flags) {
IconManager iconManager = IconManager.getInstance();
RowIcon baseIcon =
iconManager.createLayeredIcon(this, iconManager.getPlatformIcon(PlatformIcons.Field), ElementPresentationUtil.getFlags(this, false));
iconManager.createLayeredIcon(this, getBaseIcon(), ElementPresentationUtil.getFlags(this, false));
return ElementPresentationUtil.addVisibilityIcon(this, flags, baseIcon);
}
@Override
protected @NotNull Icon getBaseIcon() {
IconManager iconManager = IconManager.getInstance();
return iconManager.getPlatformIcon(PlatformIcons.Field);
}
@Override
public boolean isEquivalentTo(final PsiElement another) {
return PsiClassImplUtil.isFieldEquivalentTo(this, another);

View File

@@ -295,14 +295,18 @@ public final class ClsMethodImpl extends ClsMemberImpl<PsiMethodStub> implements
}
@Override
public Icon getElementIcon(final int flags) {
public Icon getElementIcon(int flags) {
IconManager iconManager = IconManager.getInstance();
Icon methodIcon =
iconManager.getPlatformIcon(hasModifierProperty(PsiModifier.ABSTRACT) ? PlatformIcons.AbstractMethod : PlatformIcons.Method);
RowIcon baseIcon = iconManager.createLayeredIcon(this, methodIcon, ElementPresentationUtil.getFlags(this, false));
RowIcon baseIcon = iconManager.createLayeredIcon(this, getBaseIcon(), ElementPresentationUtil.getFlags(this, false));
return ElementPresentationUtil.addVisibilityIcon(this, flags, baseIcon);
}
@Override
protected @NotNull Icon getBaseIcon() {
PlatformIcons iconId = hasModifierProperty(PsiModifier.ABSTRACT) ? PlatformIcons.AbstractMethod : PlatformIcons.Method;
return IconManager.getInstance().getPlatformIcon(iconId);
}
@Override
public boolean isEquivalentTo(final PsiElement another) {
return PsiClassImplUtil.isMethodEquivalentTo(this, another);

View File

@@ -263,10 +263,16 @@ public class PsiFieldImpl extends JavaStubPsiElement<PsiFieldStub> implements Ps
public Icon getElementIcon(int flags) {
IconManager iconManager = IconManager.getInstance();
RowIcon baseIcon =
iconManager.createLayeredIcon(this, iconManager.getPlatformIcon(PlatformIcons.Field), ElementPresentationUtil.getFlags(this, false));
iconManager.createLayeredIcon(this, getBaseIcon(), ElementPresentationUtil.getFlags(this, false));
return ElementPresentationUtil.addVisibilityIcon(this, flags, baseIcon);
}
@Override
protected @NotNull Icon getBaseIcon() {
IconManager iconManager = IconManager.getInstance();
return iconManager.getPlatformIcon(PlatformIcons.Field);
}
private static final class OurConstValueComputer implements JavaResolveCache.ConstValueComputer {
private static final OurConstValueComputer INSTANCE = new OurConstValueComputer();

View File

@@ -334,12 +334,16 @@ public class PsiMethodImpl extends JavaStubPsiElement<PsiMethodStub> implements
@Override
public Icon getElementIcon(int flags) {
IconManager iconManager = IconManager.getInstance();
Icon methodIcon =
iconManager.getPlatformIcon(hasModifierProperty(PsiModifier.ABSTRACT) ? PlatformIcons.AbstractMethod : PlatformIcons.Method);
RowIcon baseIcon = iconManager.createLayeredIcon(this, methodIcon, ElementPresentationUtil.getFlags(this, false));
RowIcon baseIcon = iconManager.createLayeredIcon(this, getBaseIcon(), ElementPresentationUtil.getFlags(this, false));
return ElementPresentationUtil.addVisibilityIcon(this, flags, baseIcon);
}
@Override
protected @NotNull Icon getBaseIcon() {
PlatformIcons iconId = hasModifierProperty(PsiModifier.ABSTRACT) ? PlatformIcons.AbstractMethod : PlatformIcons.Method;
return IconManager.getInstance().getPlatformIcon(iconId);
}
@Override
public boolean isEquivalentTo(PsiElement another) {
return PsiClassImplUtil.isMethodEquivalentTo(this, another);