本文整理汇总了Java中com.intellij.ui.IconDeferrer类的典型用法代码示例。如果您正苦于以下问题:Java IconDeferrer类的具体用法?Java IconDeferrer怎么用?Java IconDeferrer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IconDeferrer类属于com.intellij.ui包,在下文中一共展示了IconDeferrer类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeIcon
import com.intellij.ui.IconDeferrer; //导入依赖的package包/类
@Nullable
private Icon computeIcon(@Iconable.IconFlags int flags) {
PsiElement psiElement = (PsiElement)this;
if (!psiElement.isValid()) return null;
if (Registry.is("psi.deferIconLoading")) {
Icon baseIcon = LastComputedIcon.get(psiElement, flags);
if (baseIcon == null) {
TIntObjectHashMap<Icon> cache = getUserData(BASE_ICONS);
if (cache == null) {
cache = putUserDataIfAbsent(BASE_ICONS, new TIntObjectHashMap<Icon>());
}
synchronized (cache) {
if (!cache.containsKey(flags)) {
cache.put(flags, computeBaseIcon(flags));
}
baseIcon = cache.get(flags);
}
}
return IconDeferrer.getInstance().defer(baseIcon, new ElementIconRequest(psiElement, flags), ICON_COMPUTE);
}
return computeIconNow(psiElement, flags);
}
示例2: getClassIcon
import com.intellij.ui.IconDeferrer; //导入依赖的package包/类
public static Icon getClassIcon(int flags, @NotNull PsiClass aClass, @Nullable Icon symbolIcon) {
Icon base = Iconable.LastComputedIcon.get(aClass, flags);
if (base == null) {
if (symbolIcon == null) {
symbolIcon = ElementPresentationUtil.getClassIconOfKind(aClass, ElementPresentationUtil.getBasicClassKind(aClass));
}
RowIcon baseIcon = ElementBase.createLayeredIcon(aClass, symbolIcon, 0);
base = ElementPresentationUtil.addVisibilityIcon(aClass, flags, baseIcon);
}
return IconDeferrer.getInstance().defer(base, new ClassIconRequest(aClass, flags, symbolIcon), FULL_ICON_EVALUATOR);
}
示例3: setIcon
import com.intellij.ui.IconDeferrer; //导入依赖的package包/类
public TabInfo setIcon(Icon icon) {
Icon old = myIcon;
if (!IconDeferrer.getInstance().equalIcons(old, icon)) {
myIcon = icon;
myChangeSupport.firePropertyChange(ICON, old, icon);
}
return this;
}
示例4: computeIcon
import com.intellij.ui.IconDeferrer; //导入依赖的package包/类
@Nullable
private Icon computeIcon(@Iconable.IconFlags int flags) {
PsiElement psiElement = (PsiElement)this;
if (!psiElement.isValid()) return null;
if (Registry.is("psi.deferIconLoading")) {
Icon baseIcon = LastComputedIcon.get(psiElement, flags);
if (baseIcon == null) {
baseIcon = computeBaseIcon(flags);
}
return IconDeferrer.getInstance().defer(baseIcon, new ElementIconRequest(psiElement, flags), ICON_COMPUTE);
}
return computeIconNow(psiElement, flags);
}
示例5: getIcon
import com.intellij.ui.IconDeferrer; //导入依赖的package包/类
@Nullable
public static Icon getIcon(@Nonnull final VirtualFile file, @Iconable.IconFlags final int flags, @Nullable final Project project) {
Icon icon = Iconable.LastComputedIcon.get(file, flags);
if (icon == null) {
icon = VirtualFilePresentation.getIcon(file);
}
return IconDeferrer.getInstance().defer(icon, new AnyIconKey<>(file, project, flags), ourVirtualFileIconFunc);
}
示例6: getIcon
import com.intellij.ui.IconDeferrer; //导入依赖的package包/类
@Nonnull
@RequiredReadAction
public static Icon getIcon(@Nonnull final PsiElement element, @Iconable.IconFlags final int flags) {
if (!element.isValid()) return AllIcons.Nodes.NodePlaceholder;
Icon baseIcon = Iconable.LastComputedIcon.get(element, flags);
if (baseIcon == null) {
baseIcon = computeBaseIcon(element, flags);
}
return IconDeferrer.getInstance().defer(baseIcon, new ElementIconRequest(element, flags), ourIconCompute);
}
示例7: getIcon
import com.intellij.ui.IconDeferrer; //导入依赖的package包/类
public static Icon getIcon(@NotNull final VirtualFile file, @Iconable.IconFlags final int flags, @Nullable final Project project) {
Icon lastIcon = Iconable.LastComputedIcon.get(file, flags);
final Icon base = lastIcon != null ? lastIcon : VirtualFilePresentation.getIconImpl(file);
return IconDeferrer.getInstance().defer(base, new FileIconKey(file, project, flags), ICON_NULLABLE_FUNCTION);
}
示例8: getConfigurationIcon
import com.intellij.ui.IconDeferrer; //导入依赖的package包/类
@Override
public Icon getConfigurationIcon(@Nonnull final RunnerAndConfigurationSettings settings) {
final String uniqueID = settings.getUniqueID();
RunnerAndConfigurationSettings selectedConfiguration = getSelectedConfiguration();
String selectedId = selectedConfiguration != null ? selectedConfiguration.getUniqueID() : "";
if (selectedId.equals(uniqueID)) {
Long lastCheckTime = myIconCheckTimes.get(uniqueID);
Long calcTime = myIconCalcTime.get(uniqueID);
if (calcTime == null || calcTime < 150) calcTime = 150L;
if (lastCheckTime == null || System.currentTimeMillis() - lastCheckTime > calcTime * 10) {
myIdToIcon.remove(uniqueID);//cache has expired
}
}
Icon icon = myIdToIcon.get(uniqueID);
if (icon == null) {
icon = IconDeferrer.getInstance().deferAutoUpdatable(settings.getConfiguration().getIcon(), myProject.hashCode() ^ settings.hashCode(), param -> {
if (myProject.isDisposed()) return null;
myIconCalcTime.remove(uniqueID);
long startTime = System.currentTimeMillis();
Icon ico;
try {
DumbService.getInstance(myProject).setAlternativeResolveEnabled(true);
settings.checkSettings();
ico = ProgramRunnerUtil.getConfigurationIcon(settings, false);
}
catch (IndexNotReadyException e) {
ico = ProgramRunnerUtil.getConfigurationIcon(settings, false);
}
catch (RuntimeConfigurationException ignored) {
ico = ProgramRunnerUtil.getConfigurationIcon(settings, true);
}
finally {
DumbService.getInstance(myProject).setAlternativeResolveEnabled(false);
}
myIconCalcTime.put(uniqueID, System.currentTimeMillis() - startTime);
return ico;
});
myIdToIcon.put(uniqueID, icon);
myIconCheckTimes.put(uniqueID, System.currentTimeMillis());
}
return icon;
}