当前位置: 首页>>代码示例>>Java>>正文


Java IconDeferrer类代码示例

本文整理汇总了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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:ElementBase.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:PsiClassImplUtil.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:TabInfo.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ElementBase.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:VfsIconUtil.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:IconDescriptorUpdaters.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:IconUtil.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:47,代码来源:RunManagerImpl.java


注:本文中的com.intellij.ui.IconDeferrer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。