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


Java IconUtil类代码示例

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


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

示例1: getDeleteButton

import com.intellij.util.IconUtil; //导入依赖的package包/类
@NotNull
private JButton getDeleteButton(final JPanel view, SearchActionWrapper wrapper) {
    JButton btnDelete = new JButton(IconUtil.getRemoveIcon());

    btnDelete.addMouseListener(new ClickListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            actionsPanel.remove(btnDelete);
            actionsPanel.remove(view);
            customPath.getListSearchAction().remove(wrapper.getAction());
            wrappers.remove(wrapper);
            actionsPanel.revalidate();
        }
    });
    return btnDelete;
}
 
开发者ID:CeH9,项目名称:PackageTemplates,代码行数:17,代码来源:CustomPathDialog.java

示例2: createActions

import com.intellij.util.IconUtil; //导入依赖的package包/类
@Override
@Nullable
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
  if (myProjectJdksModel == null) {
    return null;
  }
  final ArrayList<AnAction> actions = new ArrayList<AnAction>();
  DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.new.jdk.text"), true);
  group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
  myProjectJdksModel.createAddActions(group, myTree, new Consumer<Sdk>() {
    @Override
    public void consume(final Sdk projectJdk) {
      addNode(new MyNode(new JdkConfigurable(((ProjectJdkImpl)projectJdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject), false), myRoot);
      selectNodeInTree(findNodeByObject(myRoot, projectJdk));
    }
  });
  actions.add(new MyActionGroupWrapper(group));
  actions.add(new MyDeleteAction(Conditions.<Object[]>alwaysTrue()));
  return actions;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ProjectJdksConfigurable.java

示例3: getSmallApplicationIcon

import com.intellij.util.IconUtil; //导入依赖的package包/类
protected static Icon getSmallApplicationIcon() {
  if (ourSmallAppIcon == null) {
    try {
      Icon appIcon = IconLoader.findIcon(ApplicationInfoEx.getInstanceEx().getIconUrl());

      if (appIcon != null) {
        if (appIcon.getIconWidth() == JBUI.scale(16) && appIcon.getIconHeight() == JBUI.scale(16)) {
          ourSmallAppIcon = appIcon;
        } else {
          BufferedImage image = ImageUtil.toBufferedImage(IconUtil.toImage(appIcon));
          image = Scalr.resize(image, Scalr.Method.ULTRA_QUALITY, UIUtil.isRetina() ? 32 : JBUI.scale(16));
          ourSmallAppIcon = toRetinaAwareIcon(image);
        }
      }
    }
    catch (Exception e) {//
    }
    if (ourSmallAppIcon == null) {
      ourSmallAppIcon = EmptyIcon.ICON_16;
    }
  }

  return ourSmallAppIcon;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RecentProjectsManagerBase.java

示例4: setConfigurationIcon

import com.intellij.util.IconUtil; //导入依赖的package包/类
private static void setConfigurationIcon(final Presentation presentation,
                                         final RunnerAndConfigurationSettings settings,
                                         final Project project) {
  try {
    Icon icon = RunManagerEx.getInstanceEx(project).getConfigurationIcon(settings);
    ExecutionManagerImpl executionManager = ExecutionManagerImpl.getInstance(project);
    List<RunContentDescriptor> runningDescriptors = executionManager.getRunningDescriptors(new Condition<RunnerAndConfigurationSettings>() {
        @Override
        public boolean value(RunnerAndConfigurationSettings s) {
          return s == settings;
        }
      });
    if (runningDescriptors.size() == 1) {
      icon = ExecutionUtil.getLiveIndicator(icon);
    }
    if (runningDescriptors.size() > 1) {
      icon = IconUtil.addText(icon, String.valueOf(runningDescriptors.size()));
    }
    presentation.setIcon(icon);
  }
  catch (IndexNotReadyException ignored) {
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:RunConfigurationsComboBoxAction.java

示例5: createActions

import com.intellij.util.IconUtil; //导入依赖的package包/类
@Override
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
  final ArrayList<AnAction> result = new ArrayList<AnAction>();
  result.add(new MyAddAction(fromPopup));
  result.add(new MyDeleteAction(forAll(new Condition<Object>() {
    @Override
    public boolean value(final Object o) {
      if (o instanceof MyNode) {
        final NamedConfigurable namedConfigurable = ((MyNode)o).getConfigurable();
        final Object editableObject = namedConfigurable != null ? namedConfigurable.getEditableObject() : null;
        return editableObject instanceof NamedScope;
      }
      return false;
    }
  })));
  result.add(new MyCopyAction());
  result.add(new MySaveAsAction());
  result.add(new MyMoveAction(ExecutionBundle.message("move.up.action.name"), IconUtil.getMoveUpIcon(), -1));
  result.add(new MyMoveAction(ExecutionBundle.message("move.down.action.name"), IconUtil.getMoveDownIcon(), 1));
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ScopeChooserConfigurable.java

示例6: initializeHeaderPanel

import com.intellij.util.IconUtil; //导入依赖的package包/类
private void initializeHeaderPanel(@NotNull DeveloperServiceMetadata developerServiceMetadata) {
  HtmlBuilder htmlBuilder = new HtmlBuilder();
  htmlBuilder.openHtmlBody();
  htmlBuilder.addBold(developerServiceMetadata.getName()).newline();
  htmlBuilder.add(developerServiceMetadata.getDescription());
  htmlBuilder.closeHtmlBody();
  myHeaderLabel.setText(htmlBuilder.getHtml());

  myIcon.setIcon(IconUtil.toSize(developerServiceMetadata.getIcon(), myIcon.getWidth(), myIcon.getHeight()));

  URI learnMoreLink = developerServiceMetadata.getLearnMoreLink();
  if (learnMoreLink != null) {
    addToLinkPanel("Learn More", learnMoreLink);
  }

  URI apiLink = developerServiceMetadata.getApiLink();
  if (apiLink != null) {
    addToLinkPanel("API Documentation", apiLink);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:DeveloperServicePanel.java

示例7: createUIComponents

import com.intellij.util.IconUtil; //导入依赖的package包/类
private void createUIComponents() {
  myOrientationToggle =
    new ASGallery<ScreenOrientation>(JBList.createDefaultListModel(ScreenOrientation.PORTRAIT, ScreenOrientation.LANDSCAPE),
                                     new Function<ScreenOrientation, Image>() {
                                       @Override
                                       public Image apply(ScreenOrientation input) {
                                         return IconUtil.toImage(ORIENTATIONS.get(input).myIcon);
                                       }
                                     }, new Function<ScreenOrientation, String>() {
      @Override
      public String apply(ScreenOrientation input) {
        return ORIENTATIONS.get(input).myName;
      }
    }, new Dimension(50, 50));
  myOrientationToggle.setCellMargin(new Insets(3, 5, 3, 5));
  myOrientationToggle.setBackground(JBColor.background());
  myOrientationToggle.setForeground(JBColor.foreground());
  myScalingComboBox = new ComboBox(new EnumComboBoxModel<AvdScaleFactor>(AvdScaleFactor.class));
  myHardwareSkinHelpLabel = new HyperlinkLabel("How do I create a custom hardware skin?");
  myHardwareSkinHelpLabel.setHyperlinkTarget(AvdWizardConstants.CREATE_SKIN_HELP_LINK);
  mySkinComboBox = new SkinChooser(getProject());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ConfigureAvdOptionsStep.java

示例8: variantsViaQuery

import com.intellij.util.IconUtil; //导入依赖的package包/类
@NotNull
private Object[] variantsViaQuery(@NotNull final Query<PsiClass> query,
                                  @Nullable final PsiClass exclude) {
  final List<LookupElement> variants = new LinkedList<LookupElement>();
  final Project project = getElement().getProject();
  final String qnameOfExclude = exclude == null ? null : exclude.getQualifiedName();

  for(final PsiClass klass : query.findAll()) {
    if(klass == null || (qnameOfExclude != null && qnameOfExclude.equals(klass.getQualifiedName()))) {
      continue;
    }

    try {
      variants.add(
          LookupElementBuilder.create(klass).
              withInsertHandler(QualifiedClassNameInsertHandler.INSTANCE).
              withIcon(IconUtil.getIcon(klass.getContainingFile().getVirtualFile(), 0, project)).
              withTypeText(klass.getContainingFile().getName())
      );
    } catch(final PsiInvalidElementAccessException invalidElementAccess) {
      LOG.error(invalidElementAccess);
    }
  }

  return variants.toArray(new Object[variants.size()]);
}
 
开发者ID:defrac,项目名称:defrac-plugin-intellij,代码行数:27,代码来源:InjectorClassReference.java

示例9: variantsViaQuery

import com.intellij.util.IconUtil; //导入依赖的package包/类
@NotNull
private Object[] variantsViaQuery(@NotNull final Query<PsiClass> query) {
  final List<LookupElement> variants = new LinkedList<LookupElement>();
  final Project project = getElement().getProject();

  for(final PsiClass klass : query.findAll()) {
    if(klass == null) {
      continue;
    }

    try {
      variants.add(
          LookupElementBuilder.create(klass).
              withInsertHandler(QualifiedClassNameInsertHandler.INSTANCE).
              withIcon(IconUtil.getIcon(klass.getContainingFile().getVirtualFile(), 0, project)).
              withTypeText(klass.getContainingFile().getName()));
    } catch(final PsiInvalidElementAccessException invalidElementAccess) {
      LOG.error(invalidElementAccess);
    }
  }

  return variants.toArray(new Object[variants.size()]);
}
 
开发者ID:defrac,项目名称:defrac-plugin-intellij,代码行数:24,代码来源:MacroClassReference.java

示例10: createActions

import com.intellij.util.IconUtil; //导入依赖的package包/类
@Override
@Nullable
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
  final ArrayList<AnAction> actions = new ArrayList<AnAction>();
  DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.new.jdk.text"), true);
  group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
  myProjectJdksModel.createAddActions(group, myTree, new Consumer<Sdk>() {
    @Override
    public void consume(final Sdk projectJdk) {
      addNode(new MyNode(new JdkConfigurable(((ProjectJdkImpl)projectJdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject), false), myRoot);
      selectNodeInTree(findNodeByObject(myRoot, projectJdk));
    }
  });
  actions.add(new MyActionGroupWrapper(group));
  actions.add(new MyDeleteAction(Conditions.<Object[]>alwaysTrue()));
  return actions;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:ProjectJdksConfigurable.java

示例11: paintComponent

import com.intellij.util.IconUtil; //导入依赖的package包/类
@Override
protected void paintComponent(Graphics g) {
  super.paintComponent(g);

  Icon image = getBackgroundImage();
  if (image != null) {
    final int w = image.getIconWidth();
    final int h = image.getIconHeight();
    int x = 0;
    int y = 0;
    while (w > 0 &&  x < getWidth()) {
      while (h > 0 && y < getHeight()) {
        image.paintIcon(this, g, x, y);
        y+=h;
      }
      y=0;
      x+=w;
    }
  }

  Icon centerImage = getCenterImage();
  if (centerImage != null) {
    IconUtil.paintInCenterOf(this, g, centerImage);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:JBPanel.java

示例12: customizeCellRenderer

import com.intellij.util.IconUtil; //导入依赖的package包/类
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
  if (value instanceof VirtualFile) {
    VirtualFile virtualFile = (VirtualFile)value;
    String name = virtualFile.getPresentableName();
    setIcon(IconUtil.getIcon(virtualFile, Iconable.ICON_FLAG_READ_STATUS, myProject));

    FileStatus fileStatus = FileStatusManager.getInstance(myProject).getStatus(virtualFile);
    TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null , null, EffectType.LINE_UNDERSCORE,
                                                   Font.PLAIN);
    append(name, SimpleTextAttributes.fromTextAttributes(attributes));

    if (!selected && FileEditorManager.getInstance(myProject).isFileOpen(virtualFile)) {
      setBackground(LightColors.SLIGHTLY_GREEN);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:BaseShowRecentFilesAction.java

示例13: customizeCellRenderer

import com.intellij.util.IconUtil; //导入依赖的package包/类
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
  if (value instanceof FileInfo) {
    VirtualFile virtualFile = ((FileInfo)value).getFirst();
    String name = virtualFile instanceof VirtualFilePathWrapper
                  ? ((VirtualFilePathWrapper)virtualFile).getPresentablePath()
                  : UISettings.getInstance().SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES
                    ? UniqueVFilePathBuilder.getInstance().getUniqueVirtualFilePath(myProject, virtualFile)
                    : virtualFile.getName();
    setIcon(IconUtil.getIcon(virtualFile, Iconable.ICON_FLAG_READ_STATUS, myProject));

    FileStatus fileStatus = FileStatusManager.getInstance(myProject).getStatus(virtualFile);
    open = FileEditorManager.getInstance(myProject).isFileOpen(virtualFile);
    TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null , null, EffectType.LINE_UNDERSCORE, Font.PLAIN);
    append(name, SimpleTextAttributes.fromTextAttributes(attributes));

    // calc color the same way editor tabs do this, i.e. including extensions
    Color color = EditorTabbedContainer.calcTabColor(myProject, virtualFile);

    if (!selected &&  color != null) {
      setBackground(color);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:Switcher.java

示例14: createLeftPanel

import com.intellij.util.IconUtil; //导入依赖的package包/类
private JPanel createLeftPanel() {
  initTree();
  MyRemoveAction removeAction = new MyRemoveAction();
  MyMoveAction moveUpAction = new MyMoveAction(ExecutionBundle.message("move.up.action.name"), null, IconUtil.getMoveUpIcon(), -1);
  MyMoveAction moveDownAction = new MyMoveAction(ExecutionBundle.message("move.down.action.name"), null, IconUtil.getMoveDownIcon(), 1);
  myToolbarDecorator = ToolbarDecorator.createDecorator(myTree).setAsUsualTopToolbar()
    .setAddAction(myAddAction).setAddActionName(ExecutionBundle.message("add.new.run.configuration.acrtion.name"))
    .setRemoveAction(removeAction).setRemoveActionUpdater(removeAction)
    .setRemoveActionName(ExecutionBundle.message("remove.run.configuration.action.name"))
    .setMoveUpAction(moveUpAction).setMoveUpActionName(ExecutionBundle.message("move.up.action.name")).setMoveUpActionUpdater(moveUpAction)
    .setMoveDownAction(moveDownAction).setMoveDownActionName(ExecutionBundle.message("move.down.action.name")).setMoveDownActionUpdater(moveDownAction)
    .addExtraAction(AnActionButton.fromAction(new MyCopyAction()))
    .addExtraAction(AnActionButton.fromAction(new MySaveAction()))
    .addExtraAction(AnActionButton.fromAction(new MyEditDefaultsAction()))
    .addExtraAction(AnActionButton.fromAction(new MyCreateFolderAction()))
    .setButtonComparator(ExecutionBundle.message("add.new.run.configuration.acrtion.name"),
                         ExecutionBundle.message("remove.run.configuration.action.name"),
                         ExecutionBundle.message("copy.configuration.action.name"),
                         ExecutionBundle.message("action.name.save.configuration"),
                         ExecutionBundle.message("run.configuration.edit.default.configuration.settings.text"),
                         ExecutionBundle.message("move.up.action.name"),
                         ExecutionBundle.message("move.down.action.name"),
                         ExecutionBundle.message("run.configuration.create.folder.text")
    ).setForcedDnD();
  return myToolbarDecorator.createPanel();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:RunConfigurable.java

示例15: createActions

import com.intellij.util.IconUtil; //导入依赖的package包/类
@Override
@Nullable
protected ArrayList<AnAction> createActions(boolean fromPopup) {
    ArrayList<AnAction> result = new ArrayList<AnAction>();
    result.add(new AnAction("Add", "Add", IconUtil.getAddIcon()) {
        {
            registerCustomShortcutSet(CommonShortcuts.INSERT, myTree);
        }

        public void actionPerformed(AnActionEvent event) {
            final VirtualFile sdk = NuxeoSDKChooser.chooseNuxeoSDK(project);
            if (sdk == null)
                return;

            final String name = askForNuxeoSDKName("Register Nuxeo SDK", "");
            if (name == null)
                return;
            final NuxeoSDK nuxeoSDK = new NuxeoSDK(name, sdk.getPath());
            addNuxeoSDKNode(nuxeoSDK);
        }
    });
    result.add(new MyDeleteAction(forAll(Conditions.alwaysTrue())));
    return result;
}
 
开发者ID:troger,项目名称:nuxeo-intellij,代码行数:25,代码来源:NuxeoSDKsPanel.java


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