com.intellij.openapi.util.IconLoader Java Examples
The following examples show how to use
com.intellij.openapi.util.IconLoader.
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: DesktopApplicationStarter.java From consulo with Apache License 2.0 | 6 votes |
@Override protected void patchSystem(boolean headless) { System.setProperty("sun.awt.noerasebackground", "true"); IdeEventQueue.getInstance(); // replace system event queue if (headless) return; if (Patches.SUN_BUG_ID_6209673) { RepaintManager.setCurrentManager(new IdeRepaintManager()); } if (SystemInfo.isXWindow) { String wmName = X11UiUtil.getWmName(); LOG.info("WM detected: " + wmName); if (wmName != null) { X11UiUtil.patchDetectedWm(wmName); } } IconLoader.activate(); }
Example #2
Source File: RatesPanel.java From consulo with Apache License 2.0 | 6 votes |
public void setRate(String rating) { Double dblRating = 0d; try { dblRating = Double.valueOf(rating); } catch (Exception ignore) {} final int intRating = dblRating.intValue(); for (int i = 0; i < intRating; i++) { myLabels[i].setIcon(STAR); } if (intRating < MAX_RATE) { myLabels[intRating].setIcon(STARs[((Double)(dblRating * 10)).intValue() % 10]); for (int i = 1 + intRating; i < MAX_RATE; i++) { myLabels[i].setIcon(IconLoader.getDisabledIcon(STAR)); } } }
Example #3
Source File: NotificationTestAction.java From consulo with Apache License 2.0 | 6 votes |
public Notification getNotification() { if (myNotification == null) { Image icon = null; if (!StringUtil.isEmpty(myGroupId)) { icon = IconLoader.findIcon(myGroupId); } String displayId = mySticky ? TEST_STICKY_GROUP.getDisplayId() : TEST_GROUP_ID; if (myToolwindow) { displayId = TEST_TOOLWINDOW_GROUP.getDisplayId(); } String content = myContent == null ? "" : StringUtil.join(myContent, "\n"); if (icon == null) { myNotification = new Notification(displayId, StringUtil.notNullize(myTitle), content, myType, getListener()); } else { myNotification = new Notification(displayId, icon, myTitle, mySubtitle, content, myType, getListener()); } if (myActions != null) { for (String action : myActions) { myNotification.addAction(new MyAnAction(action)); } } } return myNotification; }
Example #4
Source File: UserFileType.java From consulo with Apache License 2.0 | 6 votes |
@Override public Image getIcon() { Image icon = myIcon; if (icon == null) { if (myIconPath != null) { icon = IconLoader.getIcon(myIconPath); myIcon = icon; } if (icon == null) { // to not load PlatformIcons on UserFileType instantiation icon = AllIcons.FileTypes.Custom; } } return icon; }
Example #5
Source File: ActionManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
private static void setIconFromClass(@Nonnull Class<?> actionClass, @Nonnull final ClassLoader classLoader, @Nonnull final String iconPath, @Nonnull Presentation presentation, final PluginId pluginId) { Image lazyIcon = consulo.ui.image.Image.lazy(() -> { //try to find icon in idea class path consulo.ui.image.Image icon = IconLoader.findIcon(iconPath, actionClass, true); if (icon == null) { icon = IconLoader.findIcon(iconPath, classLoader); } if (icon == null) { reportActionError(pluginId, "Icon cannot be found in '" + iconPath + "', action class='" + actionClass + "'"); icon = AllIcons.Toolbar.Unknown; } return icon; }); presentation.setIcon(lazyIcon); }
Example #6
Source File: CommentNodeRenderer.java From Crucible4IDEA with MIT License | 6 votes |
void setComment(final Comment comment) { String avatar = comment.getAuthor().getAvatar(); Icon icon = AllIcons.Ide.Notification.WarningEvents; if (avatar != null) { try { icon = IconLoader.findIcon(new URL(avatar)); } catch (MalformedURLException e) { LOG.warn(e); } } myIconLabel.setIcon(icon); myMessageLabel.setText(XmlStringUtil.wrapInHtml(comment.getMessage())); RoundedLineBorder roundedLineBorder = new RoundedLineBorder(comment.isDraft() ? DRAFT_BORDER_COLOR : COMMENT_BORDER_COLOR, 20, 2); Border marginBorder = BorderFactory.createEmptyBorder(0, 0, UIUtil.DEFAULT_VGAP, 0); myMainPanel.setBorder(BorderFactory.createCompoundBorder(marginBorder, roundedLineBorder)); myMainPanel.setBackground(comment.isDraft() ? DRAFT_BG_COLOR : COMMENT_BG_COLOR); myPostLink.setVisible(comment.isDraft()); }
Example #7
Source File: FindTextToggleButton.java From netbeans-mmd-plugin with Apache License 2.0 | 6 votes |
public FindTextToggleButton(final Icon icon, final String tooltipText, final ActionListener actionListener) { super(); this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); this.setToolTipText(tooltipText); this.selectedIcon = icon; this.normalIcon = IconLoader.getDisabledIcon(icon); this.setSelected(true); this.listener = actionListener; this.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); this.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (!e.isPopupTrigger()) { setSelected(!selected); } } }); }
Example #8
Source File: TaskConfigurationType.java From JHelper with GNU Lesser General Public License v3.0 | 5 votes |
public TaskConfigurationType() { super( "name.admitriev.jhelper.configuration.TaskConfigurationType", "Task", "Task for JHelper", new NotNullLazyValue<Icon>() { @NotNull @Override protected Icon compute() { return IconLoader.getIcon("/name/admitriev/jhelper/icons/task.png"); } } ); }
Example #9
Source File: Donate.java From StringManipulation with Apache License 2.0 | 5 votes |
public static JComponent newDonateButton(JPanel donatePanel) { JButton donate = new JButton(); donate.setBorder(null); donate.setIcon(IconLoader.getIcon("donate.gif", Donate.class)); donate.setContentAreaFilled(false); donate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { BrowserUtil.browse("https://www.paypal.me/VojtechKrasa"); } }); donate.putClientProperty("JButton.backgroundColor", donatePanel.getBackground()); return donate; }
Example #10
Source File: GuiUtils.java From nosql4idea with Apache License 2.0 | 5 votes |
public static Icon loadIcon(String iconFilename, String darkIconFilename) { String iconPath = ICON_FOLDER; if (isUnderDarcula()) { iconPath += darkIconFilename; } else { iconPath += iconFilename; } return IconLoader.findIcon(iconPath); }
Example #11
Source File: PluginIcons.java From freeline with BSD 3-Clause "New" or "Revised" License | 5 votes |
private static Icon load(String path) { try { return IconLoader.getIcon(path, PluginIcons.class); } catch (IllegalStateException e) { return null; } }
Example #12
Source File: CustomIconLoader.java From intellij-extra-icons-plugin with MIT License | 5 votes |
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 #13
Source File: ActionMenu.java From consulo with Apache License 2.0 | 5 votes |
private void updateIcon() { if (UISettings.getInstance().SHOW_ICONS_IN_MENUS) { final Presentation presentation = myPresentation; final Icon icon = presentation.getIcon(); setIcon(icon); if (presentation.getDisabledIcon() != null) { setDisabledIcon(presentation.getDisabledIcon()); } else { setDisabledIcon(IconLoader.getDisabledIcon(icon)); } } }
Example #14
Source File: FlutterCupertinoIcons.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
private static Icon getIcon(String name) { if (name == null) { return null; } final String path = icons.getProperty(name); if (path == null) { return null; } return IconLoader.findIcon(path, FlutterCupertinoIcons.class); }
Example #15
Source File: FlutterMaterialIcons.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
private static Icon getIcon(String name) { if (name == null) { return null; } final String path = icons.getProperty(name); if (path == null) { return null; } return IconLoader.findIcon(path, FlutterMaterialIcons.class); }
Example #16
Source File: ActionButton.java From consulo with Apache License 2.0 | 5 votes |
public void updateIcon() { myIcon = myPresentation.getIcon(); if (myPresentation.getDisabledIcon() != null) { // set disabled icon if it is specified myDisabledIcon = myPresentation.getDisabledIcon(); } else { myDisabledIcon = IconLoader.getDisabledIcon(myIcon); } }
Example #17
Source File: NotificationBalloonShadowBorderProvider.java From consulo with Apache License 2.0 | 5 votes |
private static void drawLine(@Nonnull JComponent component, @Nonnull Graphics g, @Nonnull Icon icon, int fullLength, int start, int end, int step, int start2, boolean horizontal) { int length = fullLength - start - end; int count = length / step; int calcLength = step * count; int lastValue = start + calcLength; if (horizontal) { for (int i = start; i < lastValue; i += step) { icon.paintIcon(component, g, i, start2); } } else { for (int i = start; i < lastValue; i += step) { icon.paintIcon(component, g, start2, i); } } if (calcLength < length) { ImageIcon imageIcon = (ImageIcon)IconLoader.getIconSnapshot(icon); if (horizontal) { UIUtil.drawImage(g, imageIcon.getImage(), new Rectangle(lastValue, start2, length - calcLength, imageIcon.getIconHeight()), new Rectangle(0, 0, length - calcLength, imageIcon.getIconHeight()), component); } else { UIUtil.drawImage(g, imageIcon.getImage(), new Rectangle(start2, lastValue, imageIcon.getIconWidth(), length - calcLength), new Rectangle(0, 0, imageIcon.getIconWidth(), length - calcLength), component); } } }
Example #18
Source File: NotificationTestAction.java From consulo with Apache License 2.0 | 5 votes |
private MyAnAction(@Nullable String text) { if (text != null) { if (text.endsWith(".png")) { Icon icon = IconLoader.findIcon(text); if (icon != null) { getTemplatePresentation().setIcon(icon); return; } } getTemplatePresentation().setText(text); } }
Example #19
Source File: FlutterCupertinoIcons.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
private static Icon getIcon(String name) { if (name == null) { return null; } final String path = icons.getProperty(name); if (path == null) { return null; } return IconLoader.findIcon(path, FlutterCupertinoIcons.class); }
Example #20
Source File: SwingUtil.java From p4ic4idea with Apache License 2.0 | 5 votes |
/** * Set a button to have only the icon. * * @param button button to setup as an icon-only button * @param icon icon to assign to the button. */ public static JButton iconOnlyButton(@NotNull JButton button, @NotNull Icon icon, @NotNull ButtonType type) { button.setText(""); button.setIcon(icon); button.setDisabledIcon(IconLoader.getDisabledIcon(icon)); button.setPreferredSize(new Dimension(icon.getIconWidth() + type.borderSize, icon.getIconHeight() + type.borderSize)); return button; }
Example #21
Source File: LoadingDecoratorTest.java From consulo with Apache License 2.0 | 5 votes |
public static void main(String[] args) { IconLoader.activate(); final JFrame frame = new JFrame(); frame.getContentPane().setLayout(new BorderLayout()); final JPanel content = new JPanel(new BorderLayout()); final LoadingDecorator loadingTree = new LoadingDecorator(new JComboBox(), Disposable.newDisposable(), -1); content.add(loadingTree.getComponent(), BorderLayout.CENTER); final JCheckBox loadingCheckBox = new JCheckBox("Loading"); loadingCheckBox.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { if (loadingTree.isLoading()) { loadingTree.stopLoading(); } else { loadingTree.startLoading(false); } } }); content.add(loadingCheckBox, BorderLayout.SOUTH); frame.getContentPane().add(content, BorderLayout.CENTER); frame.setBounds(300, 300, 300, 300); frame.show(); }
Example #22
Source File: PluginIcons.java From react-native-console with BSD 3-Clause "New" or "Revised" License | 5 votes |
private static Icon load(String path) { try { return IconLoader.getIcon(path, PluginIcons.class); } catch (IllegalStateException e) { return null; } }
Example #23
Source File: ModuleExtensionProviderEP.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override protected Image compute() { if (StringUtil.isEmpty(icon)) { return AllIcons.Toolbar.Unknown; } Image temp = IconLoader.findIcon(icon, getLoaderForClass()); return temp == null ? AllIcons.Toolbar.Unknown : temp; }
Example #24
Source File: GeneratorIcons.java From intellij-thrift with Apache License 2.0 | 5 votes |
private GeneratorIcons() { for (final GeneratorType generatorType : GeneratorType.values()) { IconLoader.LazyIcon lazyIcon = new IconLoader.LazyIcon() { @Override protected Icon compute() { return IconLoader.getIcon(generatorType.getIconName()); } }; icons.put(generatorType, lazyIcon); } }
Example #25
Source File: Icons.java From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static Icon getToolWindow() { // IntelliJ 2018.2+ has monochrome icons for tool windows so let's use one too if (ApplicationInfo.getInstance().getBuild().getBaselineVersion() >= 182) { return IconLoader.getIcon("/icons/org/antlr/intellij/plugin/toolWindowAntlr.svg"); } return IconLoader.getIcon("/icons/org/antlr/intellij/plugin/antlr.png"); }
Example #26
Source File: SelectedTestRunLineMarkerContributor.java From buck with Apache License 2.0 | 5 votes |
private Info createInfo(PsiClass psiClass, PsiMethod psiMethod) { // TODO: Verify that this file is part of a buck test target return new Info( IconLoader.getIcon("/icons/buck_icon.png"), new AnAction[] { new FixedBuckTestAction(psiClass, psiMethod, false), new FixedBuckTestAction(psiClass, psiMethod, true), }, RunLineMarkerContributor.RUN_TEST_TOOLTIP_PROVIDER); }
Example #27
Source File: HighlightUtils.java From CppTools with Apache License 2.0 | 5 votes |
static RangeHighlighter createRangeMarker(Editor editor, final int rangeOffset, final int rangeOffset2, final int index, TextAttributes attrs) { RangeHighlighter rangeHighlighter = editor.getMarkupModel().addRangeHighlighter( rangeOffset, rangeOffset2, index == PP_SKIPPED_INDEX ? HighlighterLayer.LAST:100, attrs, HighlighterTargetArea.EXACT_RANGE ); if (index == OVERRIDES_INDEX) { rangeHighlighter.setGutterIconRenderer( new MyGutterIconRenderer( IconLoader.getIcon("/gutter/overridingMethod.png"), true ) ); } else if (index == OVERRIDDEN_INDEX) { rangeHighlighter.setGutterIconRenderer( new MyGutterIconRenderer( IconLoader.getIcon("/gutter/overridenMethod.png"), false ) ); } return rangeHighlighter; }
Example #28
Source File: FloobitsWindowManager.java From floobits-intellij with Apache License 2.0 | 5 votes |
protected void createChatWindow(Project project) { ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); toolWindow = toolWindowManager.registerToolWindow("Floobits", true, ToolWindowAnchor.BOTTOM); toolWindow.setIcon(IconLoader.getIcon("/icons/floo13.png")); Content content = ContentFactory.SERVICE.getInstance().createContent(chatForm.getChatPanel(), "", true); toolWindow.getContentManager().addContent(content); updateTitle(); }
Example #29
Source File: AddCommentAction.java From Crucible4IDEA with MIT License | 5 votes |
public AddCommentAction(@NotNull final Review review, @Nullable final Editor editor, @Nullable FilePath filePath, @NotNull final String description, boolean isReply) { super(description, description, isReply ? IconLoader.getIcon("/images/comment_reply.png") : IconLoader.getIcon("/images/comment_add.png")); myFilePath = filePath; myIsReply = isReply; myReview = review; myEditor = editor; }
Example #30
Source File: ModernDarkLaf.java From consulo with Apache License 2.0 | 5 votes |
protected Object parseValue(String key, @Nonnull String value) { if (key.endsWith("Insets")) { final List<String> numbers = StringUtil.split(value, ","); return new InsetsUIResource(Integer.parseInt(numbers.get(0)), Integer.parseInt(numbers.get(1)), Integer.parseInt(numbers.get(2)), Integer.parseInt(numbers.get(3))); } else if (key.endsWith(".border")) { try { return Class.forName(value).newInstance(); } catch (Exception e) { log(e); } } else { final Color color = parseColor(value); final Integer invVal = getInteger(value); final Boolean boolVal = "true".equals(value) ? Boolean.TRUE : "false".equals(value) ? Boolean.FALSE : null; Icon icon = value.startsWith("AllIcons.") ? IconLoader.getIcon(value) : null; if (icon == null && value.endsWith(".png")) { icon = IconLoader.findIcon(value, getClass(), true); } if (color != null) { return new ColorUIResource(color); } else if (invVal != null) { return invVal; } else if (icon != null) { return new IconUIResource(icon); } else if (boolVal != null) { return boolVal; } } return value; }