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


Java LayeredIcon类代码示例

本文整理汇总了Java中com.intellij.ui.LayeredIcon的典型用法代码示例。如果您正苦于以下问题:Java LayeredIcon类的具体用法?Java LayeredIcon怎么用?Java LayeredIcon使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LayeredIcon类属于com.intellij.ui包,在下文中一共展示了LayeredIcon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: customize

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:FileTypeRenderer.java

示例2: customizeRenderer

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
@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));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:BookmarksFavoriteListProvider.java

示例3: patchIcon

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:PsiDirectoryNode.java

示例4: createParametersLookupElement

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
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));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:SameSignatureCallParametersProvider.java

示例5: customize

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
@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());
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:FileTypeRenderer.java

示例6: createActionLabel

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:GotoActionModel.java

示例7: toIcon

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
@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;
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:IconDescriptor.java

示例8: patchIcon

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:PsiDirectoryNode.java

示例9: getIcon

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
@Override
public Icon getIcon() {
    return LayeredIcon.create(
            PythonUltimateIcons.Django.Django,
            AllIcons.Nodes.RunnableMark
    );
}
 
开发者ID:chornsby,项目名称:django-migrations-pycharm-plugin,代码行数:8,代码来源:MigrationRunConfigurationType.java

示例10: createParametersLookupElement

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:SameSignatureCallParametersProvider.java

示例11: patchIcon

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JavaFileIconPatcher.java

示例12: getServerNodeIcon

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ServersTreeStructure.java

示例13: createLayeredIcon

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:ElementBase.java

示例14: setIcon

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
@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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ToolWindowImpl.java

示例15: update

import com.intellij.ui.LayeredIcon; //导入依赖的package包/类
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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:NewFileAction.java


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