當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。