Java 类com.intellij.ui.LayeredIcon 实例源码

项目:intellij-ce-playground    文件:FileTypeRenderer.java   
@Override
public void customize(JList list, FileType type, int index, boolean selected, boolean hasFocus) {
  LayeredIcon layeredIcon = new LayeredIcon(2);
  layeredIcon.setIcon(EMPTY_ICON, 0);
  final Icon icon = type.getIcon();
  if (icon != null) {
    layeredIcon.setIcon(icon, 1, (- icon.getIconWidth() + EMPTY_ICON.getIconWidth())/2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight())/2);
  }

  setIcon(layeredIcon);

  String description = type.getDescription();
  String trimmedDescription = StringUtil.capitalizeWords(description.replaceAll("(?i)\\s*file(?:s)?$", ""), true);
  if (isDuplicated(description)) {
    setText(trimmedDescription + " (" + type.getName() + ")");

  }
  else {
    setText(trimmedDescription);
  }
}
项目:intellij-ce-playground    文件:BookmarksFavoriteListProvider.java   
@Override
public void customizeRenderer(ColoredTreeCellRenderer renderer,
                              JTree tree,
                              @NotNull Object value,
                              boolean selected,
                              boolean expanded,
                              boolean leaf,
                              int row,
                              boolean hasFocus) {
  renderer.clear();
  renderer.setIcon(Bookmark.DEFAULT_ICON);
  if (value instanceof Bookmark) {
    Bookmark bookmark = (Bookmark)value;
    BookmarkItem.setupRenderer(renderer, myProject, bookmark, selected);
    if (renderer.getIcon() != null) {
      renderer.setIcon(LayeredIcon.createHorizontalIcon(bookmark.getIcon(), renderer.getIcon()));
    }
    else {
      renderer.setIcon(bookmark.getIcon());
    }
  }
  else {
    renderer.append(getListName(myProject));
  }
}
项目:intellij-ce-playground    文件:PsiDirectoryNode.java   
protected Icon patchIcon(Icon original, VirtualFile file) {
  Icon icon = original;

  final Bookmark bookmarkAtFile = BookmarkManager.getInstance(myProject).findFileBookmark(file);
  if (bookmarkAtFile != null) {
    final RowIcon composite = new RowIcon(2, RowIcon.Alignment.CENTER);
    composite.setIcon(icon, 0);
    composite.setIcon(bookmarkAtFile.getIcon(), 1);
    icon = composite;
  }

  if (!file.isWritable()) {
    icon = LayeredIcon.create(icon, PlatformIcons.LOCKED_ICON);
  }

  if (file.is(VFileProperty.SYMLINK)) {
    icon = LayeredIcon.create(icon, PlatformIcons.SYMLINK_ICON);
  }

  return icon;
}
项目:tools-idea    文件:SameSignatureCallParametersProvider.java   
private static LookupElement createParametersLookupElement(PsiMethod takeParametersFrom, PsiElement call, PsiMethod invoked) {
  PsiParameter[] parameters = takeParametersFrom.getParameterList().getParameters();
  final String lookupString = StringUtil.join(parameters, new Function<PsiParameter, String>() {
    @Override
    public String fun(PsiParameter psiParameter) {
      return psiParameter.getName();
    }
  }, ", ");

  final int w = PlatformIcons.PARAMETER_ICON.getIconWidth();
  LayeredIcon icon = new LayeredIcon(2);
  icon.setIcon(PlatformIcons.PARAMETER_ICON, 0, 2*w/5, 0);
  icon.setIcon(PlatformIcons.PARAMETER_ICON, 1);

  final LookupElement element = LookupElementBuilder.create(lookupString).withIcon(icon);
  element.putUserData(JavaCompletionUtil.SUPER_METHOD_PARAMETERS, Boolean.TRUE);

  return TailTypeDecorator.withTail(element, ExpectedTypesProvider.getFinalCallParameterTailType(call, invoked.getReturnType(), invoked));
}
项目:tools-idea    文件:FileTypeRenderer.java   
@Override
public void customize(JList list, FileType type, int index, boolean selected, boolean hasFocus) {
  LayeredIcon layeredIcon = new LayeredIcon(2);
  layeredIcon.setIcon(EMPTY_ICON, 0);
  final Icon icon = type.getIcon();
  if (icon != null) {
    layeredIcon.setIcon(icon, 1, (- icon.getIconWidth() + EMPTY_ICON.getIconWidth())/2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight())/2);
  }

  setIcon(layeredIcon);

  if (isDuplicated(type.getDescription())) {
    setText(type.getDescription() + " (" + type.getName() + ")");

  }
  else {
    setText(type.getDescription());
  }
}
项目:tools-idea    文件:BookmarksFavoriteListProvider.java   
@Override
public void customizeRenderer(ColoredTreeCellRenderer renderer,
                              JTree tree,
                              @NotNull Object value,
                              boolean selected,
                              boolean expanded,
                              boolean leaf,
                              int row,
                              boolean hasFocus) {
  renderer.clear();
  renderer.setIcon(Bookmark.DEFAULT_ICON);
  if (value instanceof Bookmark) {
    Bookmark bookmark = (Bookmark)value;
    BookmarkItem.setupRenderer(renderer, myProject, bookmark, selected);
    if (renderer.getIcon() != null) {
      renderer.setIcon(LayeredIcon.createHorizontalIcon(bookmark.getIcon(), renderer.getIcon()));
    }
    else {
      renderer.setIcon(bookmark.getIcon());
    }
  }
  else {
    renderer.append(getListName(myProject));
  }
}
项目:tools-idea    文件:PsiDirectoryNode.java   
protected Icon patchIcon(Icon original, VirtualFile file) {
  Icon icon = original;

  final Bookmark bookmarkAtFile = BookmarkManager.getInstance(myProject).findFileBookmark(file);
  if (bookmarkAtFile != null) {
    final RowIcon composite = new RowIcon(2, RowIcon.Alignment.CENTER);
    composite.setIcon(icon, 0);
    composite.setIcon(bookmarkAtFile.getIcon(), 1);
    icon = composite;
  }

  if (!file.isWritable()) {
    icon = LayeredIcon.create(icon, PlatformIcons.LOCKED_ICON);
  }

  if (file.is(VFileProperty.SYMLINK)) {
    icon = LayeredIcon.create(icon, PlatformIcons.SYMLINK_ICON);
  }

  return icon;
}
项目:tools-idea    文件:GotoActionModel.java   
protected JLabel createActionLabel(final AnAction anAction, final String anActionName,
                                   final Color fg, final Color bg,
                                   final Icon icon) {
  final LayeredIcon layeredIcon = new LayeredIcon(2);
  layeredIcon.setIcon(EMPTY_ICON, 0);
  if (icon != null && icon.getIconWidth() <= EMPTY_ICON.getIconWidth() && icon.getIconHeight() <= EMPTY_ICON.getIconHeight()) {
    layeredIcon
      .setIcon(icon, 1, (-icon.getIconWidth() + EMPTY_ICON.getIconWidth()) / 2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight()) / 2);
  }

  final Shortcut[] shortcutSet = KeymapManager.getInstance().getActiveKeymap().getShortcuts(getActionId(anAction));
  final String actionName = anActionName + (shortcutSet != null && shortcutSet.length > 0
                                            ? " (" + KeymapUtil.getShortcutText(shortcutSet[0]) + ")"
                                            : "");
  final JLabel actionLabel = new JLabel(actionName, layeredIcon, SwingConstants.LEFT);
  actionLabel.setBackground(bg);
  actionLabel.setForeground(fg);
  return actionLabel;
}
项目:consulo    文件:IconDescriptor.java   
@Nonnull
public Icon toIcon() {
  Icon mainIcon = null;
  if(myLayerIcons == null) {
    mainIcon = myMainIcon;
  }
  else {
    LayeredIcon layeredIcon = new LayeredIcon(myLayerIcons.size() + 1);
    layeredIcon.setIcon(myMainIcon, 0);
    for (int i = 0; i < myLayerIcons.size(); i++) {
      Icon icon = myLayerIcons.get(i);
      layeredIcon.setIcon(icon, i + 1);
    }
    mainIcon = layeredIcon;
  }

  if(myRightIcon == null) {
    return mainIcon == null ? EmptyIcon.ICON_16 : mainIcon;
  }
  else {
    RowIcon baseIcon = new RowIcon(2);
    baseIcon.setIcon(mainIcon, 0);
    baseIcon.setIcon(myRightIcon, 1);
    return baseIcon;
  }
}
项目:consulo    文件:FileTypeRenderer.java   
@Override
public void customize(JList list, FileType type, int index, boolean selected, boolean hasFocus) {
  LayeredIcon layeredIcon = new LayeredIcon(2);
  layeredIcon.setIcon(EMPTY_ICON, 0);
  final Icon icon = type.getIcon();
  if (icon != null) {
    layeredIcon.setIcon(icon, 1, (- icon.getIconWidth() + EMPTY_ICON.getIconWidth())/2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight())/2);
  }

  setIcon(layeredIcon);

  String description = type.getDescription();
  String trimmedDescription = StringUtil.capitalizeWords(description.replaceAll("(?i)\\s*file(?:s)?$", ""), true);
  if (isDuplicated(description)) {
    setText(trimmedDescription + " (" + type.getName() + ")");

  }
  else {
    setText(trimmedDescription);
  }
}
项目:consulo    文件:PsiDirectoryNode.java   
protected Icon patchIcon(Icon original, VirtualFile file) {
  Icon icon = original;

  final Bookmark bookmarkAtFile = BookmarkManager.getInstance(myProject).findFileBookmark(file);
  if (bookmarkAtFile != null) {
    final RowIcon composite = new RowIcon(2, RowIcon.Alignment.CENTER);
    composite.setIcon(icon, 0);
    composite.setIcon(bookmarkAtFile.getIcon(), 1);
    icon = composite;
  }

  if (!file.isWritable()) {
    icon = LayeredIcon.create(icon, AllIcons.Nodes.Locked);
  }

  if (file.is(VFileProperty.SYMLINK)) {
    icon = LayeredIcon.create(icon, AllIcons.Nodes.Symlink);
  }

  return icon;
}
项目:django-migrations-pycharm-plugin    文件:MigrationRunConfigurationType.java   
@Override
public Icon getIcon() {
    return LayeredIcon.create(
            PythonUltimateIcons.Django.Django,
            AllIcons.Nodes.RunnableMark
    );
}
项目:intellij-ce-playground    文件:SameSignatureCallParametersProvider.java   
private static LookupElement createParametersLookupElement(final PsiMethod takeParametersFrom, PsiElement call, PsiMethod invoked) {
  final PsiParameter[] parameters = takeParametersFrom.getParameterList().getParameters();
  final String lookupString = StringUtil.join(parameters, new Function<PsiParameter, String>() {
    @Override
    public String fun(PsiParameter psiParameter) {
      return psiParameter.getName();
    }
  }, ", ");

  final int w = PlatformIcons.PARAMETER_ICON.getIconWidth();
  LayeredIcon icon = new LayeredIcon(2);
  icon.setIcon(PlatformIcons.PARAMETER_ICON, 0, 2*w/5, 0);
  icon.setIcon(PlatformIcons.PARAMETER_ICON, 1);

  LookupElementBuilder element = LookupElementBuilder.create(lookupString).withIcon(icon);
  if (PsiTreeUtil.isAncestor(takeParametersFrom, call, true)) {
    element = element.withInsertHandler(new InsertHandler<LookupElement>() {
      @Override
      public void handleInsert(InsertionContext context, LookupElement item) {
        context.commitDocument();
        for (PsiParameter parameter : CompletionUtil.getOriginalOrSelf(takeParametersFrom).getParameterList().getParameters()) {
          VariableLookupItem.makeFinalIfNeeded(context, parameter);
        }
      }
    });
  }
  element.putUserData(JavaCompletionUtil.SUPER_METHOD_PARAMETERS, Boolean.TRUE);

  return TailTypeDecorator.withTail(element, ExpectedTypesProvider.getFinalCallParameterTailType(call, invoked.getReturnType(), invoked));
}
项目:intellij-ce-playground    文件:JavaFileIconPatcher.java   
public Icon patchIcon(final Icon baseIcon, final VirtualFile file, final int flags, final Project project) {
  if (project == null) {
    return baseIcon;
  }

  Icon icon = replaceIcon(file, flags, project, baseIcon);

  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  if (fileIndex.isInSource(file) && CompilerManager.getInstance(project).isExcludedFromCompilation(file)) {
    return new LayeredIcon(icon, PlatformIcons.EXCLUDED_FROM_COMPILE_ICON);
  }

  return icon;
}
项目:intellij-ce-playground    文件:ServersTreeStructure.java   
public static Icon getServerNodeIcon(@NotNull Icon itemIcon, @Nullable Icon statusIcon) {
  if (statusIcon == null) {
    return itemIcon;
  }

  LayeredIcon icon = new LayeredIcon(2);
  icon.setIcon(itemIcon, 0);
  icon.setIcon(statusIcon, 1, itemIcon.getIconWidth() - statusIcon.getIconWidth(), itemIcon.getIconHeight() - statusIcon.getIconHeight());
  return icon;
}
项目:intellij-ce-playground    文件:ElementBase.java   
public static RowIcon createLayeredIcon(Iconable instance, Icon icon, int flags) {
  List<Icon> layersFromProviders = new SmartList<Icon>();
  for (IconLayerProvider provider : Extensions.getExtensions(IconLayerProvider.EP_NAME)) {
    final Icon layerIcon = provider.getLayerIcon(instance, (flags & FLAGS_LOCKED) != 0);
    if (layerIcon != null) {
      layersFromProviders.add(layerIcon);
    }
  }
  if (flags != 0 || !layersFromProviders.isEmpty()) {
    List<Icon> iconLayers = new SmartList<Icon>();
    for(IconLayer l: ourIconLayers) {
      if ((flags & l.flagMask) != 0) {
        iconLayers.add(l.icon);
      }
    }
    iconLayers.addAll(layersFromProviders);
    LayeredIcon layeredIcon = new LayeredIcon(1 + iconLayers.size());
    layeredIcon.setIcon(icon, 0);
    for (int i = 0; i < iconLayers.size(); i++) {
      Icon icon1 = iconLayers.get(i);
      layeredIcon.setIcon(icon1, i+1);
    }
    icon = layeredIcon;
  }
  RowIcon baseIcon = new RowIcon(2);
  baseIcon.setIcon(icon, 0);
  return baseIcon;
}
项目:intellij-ce-playground    文件:ToolWindowImpl.java   
@Override
public final void setIcon(final Icon icon) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  final Icon oldIcon = getIcon();
  if (oldIcon != icon && icon != null && !(icon instanceof LayeredIcon) && (icon.getIconHeight() != JBUI.scale(13) || icon.getIconWidth() != JBUI.scale(13))) {
    LOG.warn("ToolWindow icons should be 13x13. Please fix ToolWindow (ID:  " + getId() + ") or icon " + icon);
  }
  //getSelectedContent().setIcon(icon);
  myIcon = icon;
  myChangeSupport.firePropertyChange(PROP_ICON, oldIcon, icon);
}
项目:intellij-ce-playground    文件:NewFileAction.java   
protected void update(FileSystemTree fileSystemTree, AnActionEvent e) {
  Presentation presentation = e.getPresentation();
  final FileType fileType = e.getData(FileChooserKeys.NEW_FILE_TYPE);
  if (fileType != null) {
    presentation.setVisible(true);
    VirtualFile selectedFile = fileSystemTree.getNewFileParent();
    presentation.setEnabled(selectedFile != null && selectedFile.isDirectory());
    presentation.setIcon(LayeredIcon.create(fileType.getIcon(), AllIcons.Actions.New));
  }
  else {
    presentation.setVisible(false);
  }
}
项目:intellij-ce-playground    文件:ContentImpl.java   
@Override
public void setIcon(Icon icon) {
  Icon oldValue = getIcon();
  myIcon = icon;
  myLayeredIcon = LayeredIcon.create(myIcon, AllIcons.Nodes.PinToolWindow);
  myChangeSupport.firePropertyChange(PROP_ICON, oldValue, getIcon());
}
项目:intellij-ce-playground    文件:IdeNotificationArea.java   
private void applyIconToStatusAndToolWindow(Project project, LayeredIcon icon) {
  if (UISettings.getInstance().HIDE_TOOL_STRIPES || UISettings.getInstance().PRESENTATION_MODE) {
    setVisible(true);
    setIcon(icon);
  }
  else {
    ToolWindow eventLog = EventLog.getEventLog(project);
    if (eventLog != null) {
      eventLog.setIcon(icon);
    }
    setVisible(false);
  }
}
项目:intellij-ce-playground    文件:IdeNotificationArea.java   
private LayeredIcon createIconWithNotificationCount(ArrayList<Notification> notifications) {
  LayeredIcon icon = new LayeredIcon(2);
  Icon statusIcon = getPendingNotificationsIcon(AllIcons.Ide.Notifications, getMaximumType(notifications));
  icon.setIcon(statusIcon, 0);
  if (notifications.size() > 0) {
    icon.setIcon(new TextIcon(this, String.valueOf(notifications.size())), 1, statusIcon.getIconWidth() - 2, 0);
  }
  return icon;
}
项目:intellij-ce-playground    文件:IdeFatalErrorsIcon.java   
public IdeFatalErrorsIcon(ActionListener aListener) {
  myListener = aListener;
  setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 1));

  new ClickListener() {
    @Override
    public boolean onClick(@NotNull MouseEvent e, int clickCount) {
      if (myState != State.NoErrors) {
        myListener.actionPerformed(null);
        return true;
      }
      return false;
    }
  }.installOn(this);

  myIcon = new LayeredIcon(AllIcons.Ide.FatalError, AllIcons.Ide.FatalError_read, AllIcons.Ide.EmptyFatalError) {
    @Override
    public synchronized void paintIcon(Component c, Graphics g, int x, int y) {
      super.paintIcon(c, g, x, y);
    }

    @Override
    public synchronized void setLayerEnabled(int layer, boolean enabled) {
      super.setLayerEnabled(layer, enabled);
    }
  };
  setIcon(myIcon);
}
项目:intellij-ce-playground    文件:ExecutionUtil.java   
public static Icon getLiveIndicator(@Nullable final Icon base) {
  return new LayeredIcon(base, new Icon() {
    @SuppressWarnings("UseJBColor")
    @Override
    public void paintIcon(Component c, Graphics g, int x, int y) {
      int iSize = JBUI.scale(4);
      Graphics2D g2d = (Graphics2D)g.create();
      try {
        GraphicsUtil.setupAAPainting(g2d);
        g2d.setColor(Color.GREEN);
        Ellipse2D.Double shape =
          new Ellipse2D.Double(x + getIconWidth() - JBUI.scale(iSize), y + getIconHeight() - iSize, iSize, iSize);
        g2d.fill(shape);
        g2d.setColor(ColorUtil.withAlpha(Color.BLACK, .40));
        g2d.draw(shape);
      }
      finally {
        g2d.dispose();
      }
    }

    @Override
    public int getIconWidth() {
      return base != null ? base.getIconWidth() : 13;
    }

    @Override
    public int getIconHeight() {
      return base != null ? base.getIconHeight() : 13;
    }
  });
}
项目:intellij-ce-playground    文件:AdvancedSettingsAction.java   
@Override
public void update(AnActionEvent e) {
  super.update(e);
  final InspectionProfileImpl inspectionProfile = getInspectionProfile();
  final Icon icon = AllIcons.General.Gear;
  e.getPresentation().setIcon(
    (inspectionProfile != null && inspectionProfile.isProfileLocked()) ? LayeredIcon.create(icon, PlatformIcons.LOCKED_ICON) : icon);
}
项目:intellij-ce-playground    文件:CompoundRunConfigurationType.java   
public CompoundRunConfigurationType() {
  super("CompoundRunConfigurationType",
        "Compound",
        "It runs batch of run configurations at once",
        LayeredIcon.create(AllIcons.Nodes.Folder, AllIcons.Nodes.RunnableMark));
  addFactory(new ConfigurationFactory(this) {
    @Override
    public RunConfiguration createTemplateConfiguration(Project project) {
      return new CompoundRunConfiguration(project, CompoundRunConfigurationType.this, "Compound Run Configuration");
    }

    @Override
    public String getName() {
      return "Compound Run Configuration";
    }

    @Override
    public boolean isConfigurationSingletonByDefault() {
      return true;
    }

    @Override
    public boolean canConfigurationBeSingleton() {
      return false;
    }
  });
}
项目:intellij-ce-playground    文件:ProgramRunnerUtil.java   
public static Icon getConfigurationIcon(final RunnerAndConfigurationSettings settings,
                                        final boolean invalid) {
  Icon icon = getRawIcon(settings);

  final Icon configurationIcon = settings.isTemporary() ?  getTemporaryIcon(icon): icon;
  if (invalid) {
    return LayeredIcon.create(configurationIcon, AllIcons.RunConfigurations.InvalidConfigurationLayer);
  }

  return configurationIcon;
}
项目:intellij-ce-playground    文件:FindAllAction.java   
private void updateTemplateIcon(@Nullable EditorSearchSession session) {
  if (session == null || getTemplatePresentation().getIcon() != null) return;

  Icon base = AllIcons.Actions.Find;
  Icon text = IconUtil.textToIcon("ALL", session.getComponent(), JBUI.scale(6F));

  LayeredIcon icon = new LayeredIcon(2);
  icon.setIcon(base, 0);
  icon.setIcon(text, 1, 0, base.getIconHeight() - text.getIconHeight());
  getTemplatePresentation().setIcon(icon);
}
项目:intellij-ce-playground    文件:PySdkListCellRenderer.java   
private static LayeredIcon wrapIconWithWarningDecorator(Icon icon) {
  final LayeredIcon layered = new LayeredIcon(2);
  layered.setIcon(icon, 0);
  final Icon overlay = AllIcons.Actions.Cancel;
  layered.setIcon(overlay, 1);
  return layered;
}
项目:intellij-ce-playground    文件:RegExpFileType.java   
private RegExpFileType() {
        super(RegExpLanguage.INSTANCE);

        myIcon = new LayeredIcon(2);
        ((LayeredIcon)myIcon).setIcon(AllIcons.FileTypes.Text, 0);
        ((LayeredIcon)myIcon).setIcon(RegExpSupportIcons.Regexp_filetype_icon, 1);

//        myIcon = LayeredIcon.create(
//                IconLoader.getIcon("/fileTypes/text.png"),
//                IconLoader.getIcon("regexp-filetype-icon.png"));
    }
项目:intellij-ce-playground    文件:GrFieldImpl.java   
@Nullable
@Override
protected Icon getElementIcon(@IconFlags int flags) {
  Icon superIcon = JetgroovyIcons.Groovy.Field;
  if (!isProperty()) return superIcon;
  LayeredIcon rowIcon = new LayeredIcon(2);
  rowIcon.setIcon(superIcon, 0);
  rowIcon.setIcon(JetgroovyIcons.Groovy.Def, 1);
  return rowIcon;
}
项目:intellij-ce-playground    文件:XsltTreeStructureProvider.java   
public void updateImpl(PresentationData presentationData) {
  super.updateImpl(presentationData);
  final PsiFile[] psiFiles = myInstance.getAssociationsFor(getValue());

  Icon icon = XsltSupport.createXsltIcon(presentationData.getIcon(false));
  if (psiFiles.length > 0) {
    icon = LayeredIcon.create(icon, XpathIcons.Association_small);
  }
  presentationData.setIcon(icon);
}
项目:epigraph    文件:SchemaFileIconPatcher.java   
@Override
public Icon patchIcon(Icon baseIcon, VirtualFile file, @Iconable.IconFlags int flags, @Nullable Project project) {
  if (project == null) {
    return baseIcon;
  }

  Icon icon = replaceIcon(file, flags, project, baseIcon);

  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  if (fileIndex.isInSource(file) && CompilerManager.getInstance(project).isExcludedFromCompilation(file)) {
    return new LayeredIcon(icon, PlatformIcons.EXCLUDED_FROM_COMPILE_ICON);
  }

  return icon;
}
项目:tools-idea    文件:JavaFileIconPatcher.java   
public Icon patchIcon(final Icon baseIcon, final VirtualFile file, final int flags, final Project project) {
  if (project == null) {
    return baseIcon;
  }

  Icon icon = replaceIcon(file, flags, project, baseIcon);

  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  if (fileIndex.isInSource(file) && CompilerManager.getInstance(project).isExcludedFromCompilation(file)) {
    return new LayeredIcon(icon, PlatformIcons.EXCLUDED_FROM_COMPILE_ICON);
  }

  return icon;
}
项目:tools-idea    文件:ElementBase.java   
public static RowIcon createLayeredIcon(Iconable instance, Icon icon, int flags) {
  List<Icon> layersFromProviders = new SmartList<Icon>();
  for (IconLayerProvider provider : Extensions.getExtensions(IconLayerProvider.EP_NAME)) {
    final Icon layerIcon = provider.getLayerIcon(instance, (flags & FLAGS_LOCKED) != 0);
    if (layerIcon != null) {
      layersFromProviders.add(layerIcon);
    }
  }
  if (flags != 0 || !layersFromProviders.isEmpty()) {
    List<Icon> iconLayers = new SmartList<Icon>();
    for(IconLayer l: ourIconLayers) {
      if ((flags & l.flagMask) != 0) {
        iconLayers.add(l.icon);
      }
    }
    iconLayers.addAll(layersFromProviders);
    LayeredIcon layeredIcon = new LayeredIcon(1 + iconLayers.size());
    layeredIcon.setIcon(icon, 0);
    for (int i = 0; i < iconLayers.size(); i++) {
      Icon icon1 = iconLayers.get(i);
      layeredIcon.setIcon(icon1, i+1);
    }
    icon = layeredIcon;
  }
  RowIcon baseIcon = new RowIcon(2);
  baseIcon.setIcon(icon, 0);
  return baseIcon;
}
项目:tools-idea    文件:ToolWindowImpl.java   
public final void setIcon(final Icon icon) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  final Icon oldIcon = getIcon();
  if (oldIcon != icon && !(icon instanceof LayeredIcon) && (icon.getIconHeight() != 13 || icon.getIconWidth() != 13)) {
    LOG.warn("ToolWindow icons should be 13x13. Please fix " + icon);
  }
  getSelectedContent().setIcon(icon);
  myIcon = icon;
  myChangeSupport.firePropertyChange(PROP_ICON, oldIcon, icon);
}
项目:tools-idea    文件:NewFileAction.java   
protected void update(FileSystemTree fileSystemTree, AnActionEvent e) {
  Presentation presentation = e.getPresentation();
  final FileType fileType = e.getData(FileChooserKeys.NEW_FILE_TYPE);
  if (fileType != null) {
    presentation.setVisible(true);
    VirtualFile selectedFile = fileSystemTree.getNewFileParent();
    presentation.setEnabled(selectedFile != null && selectedFile.isDirectory());
    presentation.setIcon(LayeredIcon.create(fileType.getIcon(), AllIcons.Actions.New));
  }
  else {
    presentation.setVisible(false);
  }
}
项目:tools-idea    文件:ContentImpl.java   
@Override
public void setIcon(Icon icon) {
  Icon oldValue = getIcon();
  myIcon = icon;
  myLayeredIcon = LayeredIcon.create(myIcon, AllIcons.Nodes.PinToolWindow);
  myChangeSupport.firePropertyChange(PROP_ICON, oldValue, getIcon());
}
项目:tools-idea    文件:IdeNotificationArea.java   
private void applyIconToStatusAndToolWindow(Project project, LayeredIcon icon) {
  if (UISettings.getInstance().HIDE_TOOL_STRIPES || UISettings.getInstance().PRESENTATION_MODE) {
    setVisible(true);
    setIcon(icon);
  }
  else {
    ToolWindow eventLog = EventLog.getEventLog(project);
    if (eventLog != null) {
      eventLog.setIcon(icon);
    }
    setVisible(false);
  }
}
项目:tools-idea    文件:IdeNotificationArea.java   
private LayeredIcon createIconWithNotificationCount(ArrayList<Notification> notifications) {
  LayeredIcon icon = new LayeredIcon(2);
  Icon statusIcon = getPendingNotificationsIcon(AllIcons.Ide.Notifications, getMaximumType(notifications));
  icon.setIcon(statusIcon, 0);
  if (notifications.size() > 0) {
    icon.setIcon(new TextIcon(this, String.valueOf(notifications.size())), 1, statusIcon.getIconWidth() - 2, 0);
  }
  return icon;
}
项目:tools-idea    文件:IdeFatalErrorsIcon.java   
public IdeFatalErrorsIcon(ActionListener aListener) {
  myListener = aListener;
  setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 1));

  new ClickListener() {
    @Override
    public boolean onClick(MouseEvent e, int clickCount) {
      if (myState != State.NoErrors) {
        myListener.actionPerformed(null);
        return true;
      }
      return false;
    }
  }.installOn(this);

  myIcon = new LayeredIcon(AllIcons.Ide.FatalError, AllIcons.Ide.FatalError_read, AllIcons.Ide.EmptyFatalError) {
    @Override
    public synchronized void paintIcon(Component c, Graphics g, int x, int y) {
      super.paintIcon(c, g, x, y);
    }

    @Override
    public synchronized void setLayerEnabled(int layer, boolean enabled) {
      super.setLayerEnabled(layer, enabled);
    }
  };
  setIcon(myIcon);
}