com.intellij.util.IconUtil Java Examples

The following examples show how to use com.intellij.util.IconUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModelDialog.java    From intellij-extra-icons-plugin with MIT License 6 votes vote down vote up
private void initComponents() {
    setIdComponentsVisible(false);
    conditionsCheckboxList = new CheckBoxList<>((index, value) -> {
        //noinspection ConstantConditions
        conditionsCheckboxList.getItemAt(index).setEnabled(value);
    });
    chooseIconButton.addActionListener(e -> SwingUtilities.invokeLater(() -> {
        try {
            customIconImage = loadCustomIcon();
            if (customIconImage != null) {
                iconLabel.setIcon(IconUtil.createImageIcon(customIconImage.getImage()));
            }
        }
        catch (IllegalArgumentException ex) {
            Messages.showErrorDialog(ex.getMessage(), "Could Not Load Icon.");
        }
    }));
    conditionsCheckboxList.getEmptyText().setText("No conditions added.");
    toolbarPanel = createConditionsListToolbar();
    conditionsPanel.add(toolbarPanel, BorderLayout.CENTER);

    for (ModelType value : ModelType.values()) {
        typeComboBox.addItem(value.getFriendlyName());
    }
}
 
Example #2
Source File: TipPanel.java    From IntelliJ-Key-Promoter-X with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
TipPanel() {
  setLayout(new BorderLayout());
  if (isWin10OrNewer && !isUnderDarcula()) {
    setBorder(JBUI.Borders.customLine(xD0, 1, 0, 0, 0));
  }
  myBrowser = TipUIUtil.createBrowser();
  myBrowser.getComponent().setBorder(JBUI.Borders.empty(8, 12));
  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myBrowser.getComponent(), true);
  scrollPane.setBorder(JBUI.Borders.customLine(DIVIDER_COLOR, 0, 0, 1, 0));
  add(scrollPane, BorderLayout.CENTER);

  JLabel kpxIcon = new JBLabel(IconUtil.scale(KeyPromoterIcons.KP_ICON, this, 3.0f));
  kpxIcon.setSize(128, 128);
  kpxIcon.setBorder(JBUI.Borders.empty(0, 10));
  kpxIcon.setForeground(SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES.getFgColor());

  JLabel versionLabel = new JBLabel(KeyPromoterBundle.message("kp.tool.window.name"));
  versionLabel.setFont(new Font(versionLabel.getName(), Font.BOLD, 24));
  versionLabel.setForeground(JBUI.CurrentTheme.Label.foreground(false));
  JBBox horizontalBox = JBBox.createHorizontalBox();
  horizontalBox.setAlignmentX(.5f);
  horizontalBox.add(kpxIcon);
  horizontalBox.add(versionLabel);

  add(horizontalBox, BorderLayout.NORTH);
}
 
Example #3
Source File: ScopeChooserConfigurable.java    From consulo with Apache License 2.0 6 votes vote down vote up
@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 Object editableObject = ((MyNode)o).getConfigurable().getEditableObject();
        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;
}
 
Example #4
Source File: CustomPathDialog.java    From PackageTemplates with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #5
Source File: NavBarPresentation.java    From consulo with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("MethodMayBeStatic")
@Nullable
public Icon getIcon(final Object object) {
  if (!NavBarModel.isValid(object)) return null;
  if (object instanceof Project) return AllIcons.Nodes.ProjectTab;
  if (object instanceof Module) return AllIcons.Nodes.Module;
  try {
    if (object instanceof PsiElement) {
      Icon icon = TargetAWT.to(AccessRule.read(() -> ((PsiElement)object).isValid() ? IconDescriptorUpdaters.getIcon(((PsiElement)object), 0) : null));

      if (icon != null && (icon.getIconHeight() > JBUI.scale(16) || icon.getIconWidth() > JBUI.scale(16))) {
        icon = IconUtil.cropIcon(icon, JBUI.scale(16), JBUI.scale(16));
      }
      return icon;
    }
  }
  catch (IndexNotReadyException e) {
    return null;
  }
  if (object instanceof ModuleExtensionWithSdkOrderEntry) {
    return TargetAWT.to(SdkUtil.getIcon(((ModuleExtensionWithSdkOrderEntry)object).getSdk()));
  }
  if (object instanceof LibraryOrderEntry) return AllIcons.Nodes.PpLibFolder;
  if (object instanceof ModuleOrderEntry) return AllIcons.Nodes.Module;
  return null;
}
 
Example #6
Source File: RunConfigurationsComboBoxAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void setConfigurationIcon(final Presentation presentation, final RunnerAndConfigurationSettings settings, final Project project) {
  try {
    Icon icon = TargetAWT.to(RunManagerEx.getInstanceEx(project).getConfigurationIcon(settings));
    ExecutionManagerImpl executionManager = ExecutionManagerImpl.getInstance(project);
    List<RunContentDescriptor> runningDescriptors = executionManager.getRunningDescriptors(s -> s == settings);
    if (runningDescriptors.size() == 1) {
      icon = ExecutionUtil.getLiveIndicator(icon);
    }
    // FIXME [VISTALL] not supported by UI framework
    if (runningDescriptors.size() > 1) {
      icon = IconUtil.addText(icon, String.valueOf(runningDescriptors.size()));
    }
    presentation.setIcon(icon);
  }
  catch (IndexNotReadyException ignored) {
  }
}
 
Example #7
Source File: ExecutorRegistryImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private Icon getInformativeIcon(Project project, final RunnerAndConfigurationSettings selectedConfiguration) {
  final ExecutionManagerImpl executionManager = ExecutionManagerImpl.getInstance(project);

  List<RunContentDescriptor> runningDescriptors = executionManager.getRunningDescriptors(s -> s == selectedConfiguration);
  runningDescriptors = ContainerUtil.filter(runningDescriptors, descriptor -> {
    RunContentDescriptor contentDescriptor = executionManager.getContentManager().findContentDescriptor(myExecutor, descriptor.getProcessHandler());
    return contentDescriptor != null && executionManager.getExecutors(contentDescriptor).contains(myExecutor);
  });

  if (!runningDescriptors.isEmpty() && DefaultRunExecutor.EXECUTOR_ID.equals(myExecutor.getId()) && selectedConfiguration.isSingleton()) {
    return AllIcons.Actions.Restart;
  }
  if (runningDescriptors.isEmpty()) {
    return TargetAWT.to(myExecutor.getIcon());
  }

  if (runningDescriptors.size() == 1) {
    return TargetAWT.to(ExecutionUtil.getIconWithLiveIndicator(myExecutor.getIcon()));
  }
  else {
    // FIXME [VISTALL] not supported by UI framework
    return IconUtil.addText(TargetAWT.to(myExecutor.getIcon()), String.valueOf(runningDescriptors.size()));
  }
}
 
Example #8
Source File: NotificationsManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
public DropDownAction(String text, @Nullable LinkListener<Void> listener) {
  super(text, null, listener);

  setHorizontalTextPosition(SwingConstants.LEADING);
  setIconTextGap(0);

  setIcon(new Icon() {
    @Override
    public void paintIcon(Component c, Graphics g, int x, int y) {
      int lineY = getUI().getBaseline(DropDownAction.this, getWidth(), getHeight()) - getIconHeight();
      IconUtil.colorize(myIcon, getTextColor()).paintIcon(c, g, x - 1, lineY);
    }

    @Override
    public int getIconWidth() {
      return myIcon.getIconWidth();
    }

    @Override
    public int getIconHeight() {
      return myIcon.getIconHeight();
    }
  });
}
 
Example #9
Source File: ShadowPainter.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void fill(Graphics g, Icon pattern, int x, int y, int from, int to, boolean horizontally) {
  double scale = JBUI.sysScale((Graphics2D)g);
  if (UIUtil.isJreHiDPIEnabled() && Math.ceil(scale) > scale) {
    // Direct painting for fractional scale
    BufferedImage img = ImageUtil.toBufferedImage(IconUtil.toImage(pattern));
    int patternSize = horizontally ? img.getWidth() : img.getHeight();
    Graphics2D g2d = (Graphics2D)g.create();
    try {
      g2d.scale(1 / scale, 1 / scale);
      g2d.translate(x * scale, y * scale);
      for (int at = (int)Math.floor(from * scale); at < to * scale; at += patternSize) {
        if (horizontally) {
          g2d.drawImage(img, at, 0, null);
        }
        else {
          g2d.drawImage(img, 0, at, null);
        }
      }
    }
    finally {
      g2d.dispose();
    }
  }
  else {
    for (int at = from; at < to; at++) {
      if (horizontally) {
        pattern.paintIcon(null, g, x + at, y);
      }
      else {
        pattern.paintIcon(null, g, x, y + at);
      }
    }
  }
}
 
Example #10
Source File: ScopeChooserConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@Nonnull
public AnAction[] getChildren(@Nullable AnActionEvent e) {
  if (myChildren == null) {
    myChildren = new AnAction[2];
    myChildren[0] = new AnAction(IdeBundle.message("add.local.scope.action.text"), IdeBundle.message("add.local.scope.action.text"), myLocalScopesManager.getIcon()) {
      @RequiredUIAccess
      @Override
      public void actionPerformed(AnActionEvent e) {
        createScope(true, IdeBundle.message("add.scope.dialog.title"), null);
      }
    };
    myChildren[1] = new AnAction(IdeBundle.message("add.shared.scope.action.text"), IdeBundle.message("add.shared.scope.action.text"), mySharedScopesManager.getIcon()) {
      @RequiredUIAccess
      @Override
      public void actionPerformed(AnActionEvent e) {
        createScope(false, IdeBundle.message("add.scope.dialog.title"), null);
      }
    };
  }
  if (myFromPopup) {
    final AnAction action = myChildren[getDefaultIndex()];
    action.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
    return new AnAction[]{action};
  }
  return myChildren;
}
 
Example #11
Source File: DockManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private MyDragSession(MouseEvent me, @Nonnull DockableContent content) {
  myWindow = JWindowPopupFactory.getInstance().create(null);
  myContent = content;

  Image previewImage = content.getPreviewImage();

  double requiredSize = 220;

  double width = previewImage.getWidth(null);
  double height = previewImage.getHeight(null);

  double ratio;
  if (width > height) {
    ratio = requiredSize / width;
  }
  else {
    ratio = requiredSize / height;
  }

  BufferedImage buffer = UIUtil.createImage(myWindow, (int)width, (int)height, BufferedImage.TYPE_INT_ARGB);
  buffer.createGraphics().drawImage(previewImage, 0, 0, (int)width, (int)height, null);

  myDefaultDragImage = buffer.getScaledInstance((int)(width * ratio), (int)(height * ratio), Image.SCALE_SMOOTH);
  myDragImage = myDefaultDragImage;

  myWindow.getContentPane().setLayout(new BorderLayout());
  myImageContainer = new JLabel(IconUtil.createImageIcon(myDragImage));
  myImageContainer.setBorder(new LineBorder(Color.lightGray));
  myWindow.getContentPane().add(myImageContainer, BorderLayout.CENTER);

  setLocationFrom(me);

  myWindow.setVisible(true);

  WindowManagerEx.getInstanceEx().setAlphaModeEnabled(myWindow, true);
  WindowManagerEx.getInstanceEx().setAlphaModeRatio(myWindow, 0.1f);
  myWindow.getRootPane().putClientProperty("Window.shadow", Boolean.FALSE);
}
 
Example #12
Source File: SwitcherToolWindowsListRenderer.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static Icon getIcon(ToolWindow toolWindow) {
  Icon icon = TargetAWT.to(toolWindow.getIcon());
  if (icon == null) {
    return AllIcons.FileTypes.UiForm;
  }

  icon = IconUtil.toSize(icon, 16, 16);
  return icon;
}
 
Example #13
Source File: AbstractValueHint.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected JComponent createExpandableHintComponent(final SimpleColoredText text, final Runnable expand) {
  final JComponent component = HintUtil.createInformationLabel(text, IconUtil.getAddIcon());
  addClickListenerToHierarchy(component, new ClickListener() {
    @Override
    public boolean onClick(@Nonnull MouseEvent event, int clickCount) {
      if (myCurrentHint != null) {
        myCurrentHint.hide();
      }
      expand.run();
      return true;
    }
  });
  return component;
}
 
Example #14
Source File: DefaultLookupItemRenderer.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
public static Icon getRawIcon(final LookupElement item, boolean real) {
  final Icon icon = _getRawIcon(item, real);
  if (icon != null && icon.getIconHeight() > IconUtil.getDefaultNodeIconSize()) {
    return new SizedIcon(icon, icon.getIconWidth(), IconUtil.getDefaultNodeIconSize());
  }
  return icon;
}
 
Example #15
Source File: DefaultLookupItemRenderer.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
private static Icon _getRawIcon(LookupElement item, boolean real) {
  if (item instanceof LookupItem) {
    Icon icon = (Icon)((LookupItem)item).getAttribute(LookupItem.ICON_ATTR);
    if (icon != null) return icon;
  }

  Object o = item.getObject();

  if (!real) {
    if (item.getObject() instanceof String) {
      return EmptyIcon.ICON_0;
    }

    return new EmptyIcon(IconUtil.getDefaultNodeIconSize() * 2, IconUtil.getDefaultNodeIconSize());
  }

  if (o instanceof Iconable && !(o instanceof PsiElement)) {
    return TargetAWT.to(((Iconable)o).getIcon(Iconable.ICON_FLAG_VISIBILITY));
  }

  final PsiElement element = item.getPsiElement();
  if (element != null && element.isValid()) {
    return TargetAWT.to(IconDescriptorUpdaters.getIcon(element, Iconable.ICON_FLAG_VISIBILITY));
  }
  return null;
}
 
Example #16
Source File: DocumentationOrderRootTypeUIFactory.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void addToolbarButtons(ToolbarDecorator toolbarDecorator) {
  AnActionButton specifyUrlButton = new AnActionButton(ProjectBundle.message("sdk.paths.specify.url.button"), IconUtil.getAddLinkIcon()) {
    @RequiredUIAccess
    @Override
    public void actionPerformed(@Nonnull AnActionEvent e) {
      onSpecifyUrlButtonClicked();
    }
  };
  specifyUrlButton.setShortcut(CustomShortcutSet.fromString("alt S"));
  specifyUrlButton.addCustomUpdater(e -> myEnabled);
  toolbarDecorator.addExtraAction(specifyUrlButton);
}
 
Example #17
Source File: ArtifactEditorImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private DefaultActionGroup createToolbarActionGroup() {
  final DefaultActionGroup toolbarActionGroup = new DefaultActionGroup();

  toolbarActionGroup.add(createAddGroup());
  toolbarActionGroup.add(new RemovePackagingElementAction(this));
  toolbarActionGroup.add(AnSeparator.getInstance());
  toolbarActionGroup.add(new SortElementsToggleAction(this.getLayoutTreeComponent()));
  toolbarActionGroup.add(new MovePackagingElementAction(myLayoutTreeComponent, "Move Up", "", IconUtil.getMoveUpIcon(), -1));
  toolbarActionGroup.add(new MovePackagingElementAction(myLayoutTreeComponent, "Move Down", "", IconUtil.getMoveDownIcon(), 1));
  return toolbarActionGroup;
}
 
Example #18
Source File: ArtifactEditorImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private ActionGroup createAddGroup() {
  DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("artifacts.add.copy.action"), true);
  group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
  for (PackagingElementType<?> type : PackagingElementFactory.getInstance(myProject).getAllElementTypes()) {
    if (type.isAvailableForAdd(getContext(), getArtifact())) {
      group.add(new AddNewPackagingElementAction(type, this));
    }
  }
  return group;
}
 
Example #19
Source File: SdksConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@Nullable
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
  final ArrayList<AnAction> actions = new ArrayList<AnAction>();
  DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.action.name"), true);
  group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
  mySdksModel.createAddActions(group, myTree, projectJdk -> {
    addNode(new MyNode(new SdkConfigurable(((SdkImpl)projectJdk), mySdksModel, TREE_UPDATER, myHistory, myProject), false), myRoot);
    selectNodeInTree(findNodeByObject(myRoot, projectJdk));
  }, SdkListConfigurable.ADD_SDK_FILTER);
  actions.add(new MyActionGroupWrapper(group));
  actions.add(new MyDeleteAction(forAll(Conditions.alwaysTrue())));
  return actions;
}
 
Example #20
Source File: RunConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
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)
          .setAddAction(myAddAction).setAddActionName(ExecutionBundle.message("add.new.run.configuration.acrtion.name"))
          .setRemoveAction(removeAction).setRemoveActionUpdater(removeAction)
          .setRemoveActionName(ExecutionBundle.message("remove.run.configuration.action.name"))
          .setPanelBorder(JBUI.Borders.empty())
          .setToolbarBorder(JBUI.Borders.empty())
          .setToolbarBackgroundColor(SwingUIDecorator.get(SwingUIDecorator::getSidebarColor))
          .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();
}
 
Example #21
Source File: FindAllAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #22
Source File: ScopeChooserConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
public MyAddAction(boolean fromPopup) {
  super(IdeBundle.message("add.scope.popup.title"), true);
  myFromPopup = fromPopup;
  final Presentation presentation = getTemplatePresentation();
  presentation.setIcon(IconUtil.getAddIcon());
  setShortcutSet(CommonShortcuts.INSERT);
}
 
Example #23
Source File: CustomIconLoader.java    From intellij-extra-icons-plugin with MIT License 5 votes vote down vote up
public static Icon getIcon(Model model) {
    if (model.getIconType() == IconType.PATH) {
        return IconLoader.getIcon(model.getIcon());
    }
    if (model.getIconType() == IconType.ICON) {
        return model.getIntelliJIcon();
    }
    ImageWrapper fromBase64 = fromBase64(model.getIcon(), model.getIconType());
    if (fromBase64 == null) {
        return null;
    }
    return IconUtil.createImageIcon(fromBase64.getImage());
}
 
Example #24
Source File: PackageTemplateWrapper.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
private void initTextInjectionAddButton() {
    if (getMode() == ViewMode.USAGE) {
        return;
    }

    JButton btnAdd = new JButton(Localizer.get("action.AddTextInjection"), IconUtil.getAddIcon());
    btnAdd.addMouseListener(new ClickListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            createTextInjection();
        }
    });
    panel.add(btnAdd, new CC().wrap());
}
 
Example #25
Source File: CommonActionsPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public SwingImageRef getIcon() {
  switch (this) {
    case ADD:    return IconUtil.getAddIcon();
    case EDIT:    return IconUtil.getEditIcon();
    case REMOVE: return IconUtil.getRemoveIcon();
    case UP:     return IconUtil.getMoveUpIcon();
    case DOWN:   return IconUtil.getMoveDownIcon();
  }
  return null;
}
 
Example #26
Source File: CustomPathDialog.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
private JButton getAddButton() {
    JButton btnAdd = new JButton(Localizer.get("action.Add"), IconUtil.getAddIcon());
    btnAdd.addMouseListener(new ClickListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            createSearchAction(null);
        }
    });
    return btnAdd;
}
 
Example #27
Source File: HighlightDisplayLevel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static Icon createErrorIcon(@Nonnull TextAttributesKey textAttributesKey) {
  return new SingleColorIcon(textAttributesKey) {
    @Override
    public void paintIcon(Component c, Graphics g, int x, int y) {
      IconUtil.colorize(AllIcons.General.InspectionsError, getColor()).paintIcon(c, g, x, y);
    }
  };
}
 
Example #28
Source File: ShadowPainter.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void updateIcons(ScaleContext ctx) {
  updateIcon(myTop, ctx, () -> myCroppedTop = IconUtil.cropIcon(myTop, 1, Integer.MAX_VALUE));
  updateIcon(myTopRight, ctx, null);
  updateIcon(myRight, ctx, () -> myCroppedRight = IconUtil.cropIcon(myRight, Integer.MAX_VALUE, 1));
  updateIcon(myBottomRight, ctx, null);
  updateIcon(myBottom, ctx, () -> myCroppedBottom = IconUtil.cropIcon(myBottom, 1, Integer.MAX_VALUE));
  updateIcon(myBottomLeft, ctx, null);
  updateIcon(myLeft, ctx, () -> myCroppedLeft = IconUtil.cropIcon(myLeft, Integer.MAX_VALUE, 1));
  updateIcon(myTopLeft, ctx, null);
}
 
Example #29
Source File: AssetLookupElement.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
@Override
public void renderElement(LookupElementPresentation presentation) {

    String typeText = "Web";
    if(assetFile.getAssetPosition().equals(AssetEnum.Position.Bundle)) {
        typeText = "Bundle";
    }

    presentation.setItemText(assetFile.toString());
    presentation.setTypeText(typeText);
    presentation.setIcon(IconUtil.getIcon(assetFile.getFile(), 0, project));

}
 
Example #30
Source File: SymfonyBundleFileLookupElement.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(getLookupString());
    presentation.setTypeText(this.bundleFile.getSymfonyBundle().getName());
    presentation.setTypeGrayed(true);
    presentation.setIcon(IconUtil.getIcon(this.bundleFile.getVirtualFile(), 0, this.bundleFile.getProject()));

}