本文整理匯總了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;
}