private void initActionIcons() { ActionManager actionManager = ActionManager.getInstance(); for (String actionId : myIconCustomizations.keySet()) { final AnAction anAction = actionManager.getAction(actionId); if (anAction != null) { Icon icon; final String iconPath = myIconCustomizations.get(actionId); if (iconPath != null && new File(FileUtil.toSystemDependentName(iconPath)).exists()) { Image image = null; try { image = ImageLoader.loadFromStream(VfsUtilCore.convertToURL(VfsUtil.pathToUrl(iconPath)).openStream()); } catch (IOException e) { LOG.debug(e); } icon = image == null ? null : new JBImageIcon(image); } else { icon = AllIcons.Toolbar.Unknown; } anAction.getTemplatePresentation().setIcon(icon); anAction.getTemplatePresentation().setDisabledIcon(IconLoader.getDisabledIcon(icon)); anAction.setDefaultIcon(false); } } final IdeFrameImpl frame = WindowManagerEx.getInstanceEx().getFrame(null); if (frame != null) { frame.updateView(); } }
@Deprecated public static Icon getIcon(@NotNull final Image image) { return new JBImageIcon(image); }
@Deprecated public static Icon getIcon(@Nonnull final Image image) { return new JBImageIcon(image); }