public interface MoonIcons { final String PATH = "/icons/"; final Icon MOON_ICON = IconLoader.findIcon(PATH + "Moon.png"); final Icon MOON_FUNCTION = IconLoader.findIcon(PATH + "function.png"); final Icon MOON_IDEA_MODULE_ICON = IconLoader.findIcon(PATH + "logo_24x24.png"); final Icon TAIL_RECURSION = IconLoader.findIcon(PATH + "repeat-icon-16x16.png"); }
private void updateBackground() { if (UIUtil.isUnderDarcula()) { setBackgroundImage(IconLoader.getIcon("/frame_background.png")); String icon = ApplicationInfoEx.getInstanceEx().getEditorBackgroundImageUrl(); if (icon != null) setCenterImage(IconLoader.getIcon(icon)); } else { setBackgroundImage(null); setCenterImage(null); } }
private static Icon[] findIcons(String prefix, String maskIconPath) { Icon maskIcon = maskIconPath != null ? IconLoader.getIcon(maskIconPath) : null; Icon[] icons = new Icon[COUNT]; for (int i = 0; i <= COUNT - 1; i++) { Icon eachIcon = IconLoader.getIcon(prefix + (i + 1) + ".png"); if (maskIcon != null) { icons[i] = new ProcessIcon(maskIcon, eachIcon); } else { icons[i] = eachIcon; } } return icons; }
public static class ChooseEntityTypeAction extends AnAction { private static Icon icon = IconLoader.getIcon("/actions/quickList.png"); private Project project; private JComponent component; private List<String> entityTypes; private ChooseEntityTypePopup.Listener listener; public ChooseEntityTypeAction( Project project, JComponent component, List<String> entityTypes, ChooseEntityTypePopup.Listener listener) { this.project = project; this.component = component; this.entityTypes = entityTypes; this.listener = listener; getTemplatePresentation().setIcon(icon); } public void setComponent(JComponent component) { this.component = component; } @Override public void actionPerformed(AnActionEvent anActionEvent) { ChooseEntityTypePopup popup = new ChooseEntityTypePopup(project, entityTypes, listener); popup.showOrInvokeDirectly(component, 0, 0); } }
@Override public void paintComponent(Graphics g) { super.paintComponent(g); AnAction action = getAction(); if (action instanceof ActivateCard) { Rectangle bounds = getBounds(); Icon icon = AllIcons.Actions.Forward; // AllIcons.Icons.Ide.NextStepGrayed; int y = (bounds.height - icon.getIconHeight()) / 2; int x = bounds.width - icon.getIconWidth() - 15; if (getPopState() == POPPED) { final GraphicsConfig config = GraphicsUtil.setupAAPainting(g); g.setColor(WelcomeScreenColors.CAPTION_BACKGROUND); g.fillOval(x - 3, y - 3, icon.getIconWidth() + 6, icon.getIconHeight() + 6); g.setColor(WelcomeScreenColors.GROUP_ICON_BORDER_COLOR); g.drawOval(x - 3, y - 3, icon.getIconWidth() + 6, icon.getIconHeight() + 6); config.restore(); } else { icon = IconLoader.getDisabledIcon(icon); } icon.paintIcon(this, g, x, y); } }
public MyClickPad() { super( KeyMapBundle.message("mouse.shortcut.label"), IconLoader.getIcon("/general/mouse.png"), SwingConstants.CENTER); // It's very imporatant that MouseListener is added to the Dialog. If you add // the same listener, for example, into the MyClickPad component you get fake // Alt and Meta modifiers. I means that pressing of middle button causes // Alt+Button2 event. // See bug ID 4109826 on Sun's bug parade. // cast is needed in order to compile with mustang MouseShortcutDialog.this.addMouseListener( (MouseListener) new MouseAdapter() { public void mouseReleased(MouseEvent e) { Component component = SwingUtilities.getDeepestComponentAt(e.getComponent(), e.getX(), e.getY()); if (component == MyClickPad.this) { e.consume(); myButton = e.getButton(); myModifiers = e.getModifiersEx(); updatePreviewAndConflicts(); } } }); }
/** @author mrubino */ public class RobotFeatureFileType extends LanguageFileType { private static final Icon ROBOT_ICON = IconLoader.findIcon("/images/robot_icon.png"); private static final RobotFeatureFileType INSTANCE = new RobotFeatureFileType(); public static RobotFeatureFileType getInstance() { return INSTANCE; } private RobotFeatureFileType() { super(RobotLanguage.INSTANCE); } @NotNull public String getName() { return "Robot Feature"; } @NotNull public String getDescription() { return "Robot Feature Files"; } @NotNull public String getDefaultExtension() { return "robot"; } @Nullable public Icon getIcon() { return ROBOT_ICON; } }
public ChangeViewAction(AntBuildMessageView antBuildMessageView) { super( AntBundle.message("ant.view.toggle.tree.text.action.name"), null, IconLoader.getIcon("/ant/changeView.png")); myAntBuildMessageView = antBuildMessageView; }
private ReRunAction() { super( UsageViewBundle.message("action.rerun"), UsageViewBundle.message("action.description.rerun"), IconLoader.getIcon("/actions/refreshUsages.png")); registerCustomShortcutSet(CommonShortcuts.getRerun(), myRootPanel); }
public class JavaFileType extends LanguageFileType { @NonNls public static final String DEFAULT_EXTENSION = "java"; @NonNls public static final String DOT_DEFAULT_EXTENSION = ".java"; private static final Icon ICON = IconLoader.getIcon("/fileTypes/java.png"); public static final JavaFileType INSTANCE = new JavaFileType(); private JavaFileType() { super(new JavaLanguage()); } @NotNull public String getName() { return "JAVA"; } @NotNull public String getDescription() { return IdeBundle.message("filetype.description.java"); } @NotNull public String getDefaultExtension() { return DEFAULT_EXTENSION; } public Icon getIcon() { return ICON; } public boolean isJVMDebuggingSupported() { return true; } }
private JComponent createLogo() { NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout()); ApplicationInfoEx app = ApplicationInfoEx.getInstanceEx(); JLabel logo = new JLabel(IconLoader.getIcon(app.getWelcomeScreenLogoUrl())); logo.setBorder(JBUI.Borders.empty(30, 0, 10, 0)); logo.setHorizontalAlignment(SwingConstants.CENTER); panel.add(logo, BorderLayout.NORTH); JLabel appName = new JLabel(ApplicationNamesInfo.getInstance().getFullProductName()); Font font = getProductFont(); appName.setForeground(JBColor.foreground()); appName.setFont(font.deriveFont(JBUI.scale(36f)).deriveFont(Font.PLAIN)); appName.setHorizontalAlignment(SwingConstants.CENTER); String appVersion = "Version " + app.getFullVersion(); if (app.isEAP() && app.getBuild().getBuildNumber() < Integer.MAX_VALUE) { appVersion += " (" + app.getBuild().asString() + ")"; } JLabel version = new JLabel(appVersion); version.setFont(getProductFont().deriveFont(JBUI.scale(16f))); version.setHorizontalAlignment(SwingConstants.CENTER); version.setForeground(Gray._128); panel.add(appName); panel.add(version, BorderLayout.SOUTH); panel.setBorder(JBUI.Borders.emptyBottom(20)); return panel; }
public MyCopyAction() { super(CvsBundle.message("action.name.copy"), null, IconLoader.getIcon("/general/copy.png")); registerCustomShortcutSet( new CustomShortcutSet( KeyStroke.getKeyStroke( KeyEvent.VK_C, SystemInfo.isMac ? KeyEvent.META_MASK : KeyEvent.CTRL_MASK)), myList); }
@NotNull private static Icon createEmptyIconLike(@NotNull String baseIconPath) { Icon baseIcon = IconLoader.findIcon(baseIconPath); if (baseIcon == null) { return EmptyIcon.ICON_16; } return new EmptyIcon(baseIcon.getIconWidth(), baseIcon.getIconHeight()); }
private static Icon getCachedIcon(@PropertyKey(resourceBundle = BUNDLE) String property) { Icon result = _iconCache.get(property); if (result == null) { result = IconLoader.getIcon(getTranslation(property)); _iconCache.put(property, result); } return result; }
private MergeDupLines() { super( UsageViewImpl.this, UsageViewBundle.message("action.merge.same.line"), IconLoader.getIcon("/toolbar/filterdups.png")); setShortcutSet( new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_DOWN_MASK))); }
public static enum ListMergeStatus { COMMON(IconLoader.getIcon("/icons/Common.png")), MERGED(IconLoader.getIcon("/icons/Integrated.png")), NOT_MERGED(IconLoader.getIcon("/icons/Notintegrated.png")), // ALIEN(IconLoader.getIcon("/icons/OnDefault.png")), ALIEN(null), REFRESHING(IconLoader.getIcon("/icons/IntegrationStatusUnknown.png")); private final Icon myIcon; private ListMergeStatus(final Icon icon) { myIcon = icon; } public Icon getIcon() { return myIcon; } }
@Nullable private static Icon getAquaMenuDisabledIcon() { final Icon arrowIcon = (Icon) UIManager.get("Menu.arrowIcon"); if (arrowIcon != null) { return IconLoader.getDisabledIcon(arrowIcon); } return null; }
/** Sets current LAF. The method doesn't update component hierarchy. */ @Override public void setCurrentLookAndFeel(UIManager.LookAndFeelInfo lookAndFeelInfo) { if (findLaf(lookAndFeelInfo.getClassName()) == null) { LOG.error("unknown LookAndFeel : " + lookAndFeelInfo); return; } // Set L&F if (IdeaLookAndFeelInfo.CLASS_NAME.equals( lookAndFeelInfo.getClassName())) { // that is IDEA default LAF IdeaLaf laf = new IdeaLaf(); MetalLookAndFeel.setCurrentTheme(new IdeaBlueMetalTheme()); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { Messages.showMessageDialog( IdeBundle.message( "error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon()); return; } } else if (DarculaLookAndFeelInfo.CLASS_NAME.equals(lookAndFeelInfo.getClassName())) { DarculaLaf laf = new DarculaLaf(); try { UIManager.setLookAndFeel(laf); JBColor.setDark(true); IconLoader.setUseDarkIcons(true); } catch (Exception e) { Messages.showMessageDialog( IdeBundle.message( "error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon()); return; } } else { // non default LAF try { LookAndFeel laf = ((LookAndFeel) Class.forName(lookAndFeelInfo.getClassName()).newInstance()); if (laf instanceof MetalLookAndFeel) { MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); } UIManager.setLookAndFeel(laf); } catch (Exception e) { Messages.showMessageDialog( IdeBundle.message( "error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon()); return; } } myCurrentLaf = ObjectUtils.chooseNotNull(findLaf(lookAndFeelInfo.getClassName()), lookAndFeelInfo); checkLookAndFeel(lookAndFeelInfo, false); }
public MyValidatableComponent() { myNameLabel.setLabelFor(myNameText); myNameText.setDocument(myNameDocument); getEditor() .addSettingsEditorListener( new SettingsEditorListener() { public void stateChanged(SettingsEditor settingsEditor) { updateWarning(); } }); myWarningLabel.setIcon(IconLoader.getIcon("/runConfigurations/configurationWarning.png")); myComponentPlace.setLayout(new GridBagLayout()); myComponentPlace.add( getEditorComponent(), new GridBagConstraints( 0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); myComponentPlace.doLayout(); myFixButton.setIcon(IconLoader.getIcon("/actions/quickfixBulb.png")); updateWarning(); myFixButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { if (myQuickFix == null) { return; } myQuickFix.run(); myValidationResultValid = false; updateWarning(); } }); }
private class CloseTab extends AnAction implements DumbAware { ShadowAction myShadow; private final TabInfo myTabInfo; private final Icon myIcon = IconLoader.getIcon("/actions/close.png"); private final Icon myNewIcon = IconLoader.getIcon("/actions/closeNew.png"); private final Icon myHoveredIcon = IconLoader.getIcon("/actions/closeHovered.png"); private final Icon myNewHoveredIcon = IconLoader.getIcon("/actions/closeNewHovered.png"); public CloseTab(JComponent c, TabInfo info) { myTabInfo = info; myShadow = new ShadowAction(this, ActionManager.getInstance().getAction(IdeActions.ACTION_CLOSE), c); } @Override public void update(final AnActionEvent e) { e.getPresentation().setIcon(myTabs.isEditorTabs() ? myNewIcon : myIcon); e.getPresentation().setHoveredIcon(myTabs.isEditorTabs() ? myNewHoveredIcon : myHoveredIcon); e.getPresentation().setVisible(UISettings.getInstance().SHOW_CLOSE_BUTTON); e.getPresentation().setText("Close. Alt-click to close others."); } public void actionPerformed(final AnActionEvent e) { final FileEditorManagerEx mgr = FileEditorManagerEx.getInstanceEx(myProject); EditorWindow window; final VirtualFile file = (VirtualFile) myTabInfo.getObject(); if (ActionPlaces.EDITOR_TAB.equals(e.getPlace())) { window = myWindow; } else { window = mgr.getCurrentWindow(); } if (window != null) { if ((e.getModifiers() & InputEvent.ALT_MASK) != 0) { window.closeAllExcept(file); } else { if (window.findFileComposite(file) != null) { mgr.closeFile(file, window); } } } } }
private void loadIcons() { icons = new Icon[] { IconLoader.getIcon("/icons/progress/roller_1.png"), IconLoader.getIcon("/icons/progress/roller_2.png"), IconLoader.getIcon("/icons/progress/roller_3.png"), IconLoader.getIcon("/icons/progress/roller_4.png"), IconLoader.getIcon("/icons/progress/roller_5.png"), IconLoader.getIcon("/icons/progress/roller_6.png"), IconLoader.getIcon("/icons/progress/roller_7.png"), IconLoader.getIcon("/icons/progress/roller_8.png"), }; passiveIcon = IconLoader.getIcon("/icons/progress/roller_0.png"); }
public ConsoleExecuteAction( LanguageConsoleImpl languageConsole, ProcessHandler processHandler, ConsoleExecuteActionHandler consoleExecuteActionHandler) { super(null, null, IconLoader.getIcon(ACTIONS_EXECUTE_ICON)); myLanguageConsole = languageConsole; myProcessHandler = processHandler; myConsoleExecuteActionHandler = consoleExecuteActionHandler; EmptyAction.setupAction(this, CONSOLE_EXECUTE, null); }
protected Icon icon(String... iconPaths) { try { for (String iconPath : iconPaths) { Icon icon = IconLoader.findIcon(iconPath, getClass(), true); if (icon != null) return icon; } } catch (Exception e) { } return null; }
public void update(AnActionEvent e) { boolean isRecording = ActionMacroManager.getInstance().isRecording(); e.getPresentation() .setText( isRecording ? IdeBundle.message("action.stop.macro.recording") : IdeBundle.message("action.start.macro.recording")); if (ActionPlaces.STATUS_BAR_PLACE.equals(e.getPlace())) { e.getPresentation() .setIcon( isRecording ? IconLoader.getIcon("/ide/macro/recording_stop.png") : IconLoader.getIcon("/ide/macro/recording_stop.png")); } else { e.getPresentation().setIcon(null); } }
public class GutterActionRenderer extends GutterIconRenderer { private final AnAction myAction; public static final Icon REPLACE_ARROW = IconLoader.getIcon("/diff/arrow.png"); public static final Icon REMOVE_CROSS = IconLoader.getIcon("/diff/remove.png"); public GutterActionRenderer(@NotNull AnAction action) { myAction = action; } @NotNull public Icon getIcon() { return myAction.getTemplatePresentation().getIcon(); } public AnAction getClickAction() { return myAction; } public String getTooltipText() { return myAction.getTemplatePresentation().getText(); } public boolean isNavigateAction() { return true; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GutterActionRenderer that = (GutterActionRenderer) o; if (!myAction.equals(that.myAction)) return false; return true; } @Override public int hashCode() { return myAction.hashCode(); } }
@Override public void update(AnActionEvent e) { e.getPresentation().setEnabled(!myTable.isEditing() && myTable.getSelectedRow() >= 0); e.getPresentation().setText("Revert to Default"); e.getPresentation().setIcon(IconLoader.getIcon("/general/remove.png")); if (e.getPresentation().isEnabled()) { final RegistryValue rv = myModel.getRegistryValue(myTable.getSelectedRow()); e.getPresentation().setEnabled(rv.isChangedFromDefault()); } }
/** Definition of the run configuration */ public class RoboVMConfigurationType implements ConfigurationType { private final RoboVMConfigurationFactory configurationFactory; private String displayName = "iOS Application"; private String typeDescription = "iOS Application"; private Icon icon = IconLoader.getIcon("/icons/robovm_small.png"); public static String id = "robovm.config"; public RoboVMConfigurationType() { configurationFactory = new RoboVMConfigurationFactory(this); } @Override public String getDisplayName() { return displayName; } @Override public String getConfigurationTypeDescription() { return typeDescription; } @Override public Icon getIcon() { return icon; } @NotNull @Override public String getId() { return id; } @Override public ConfigurationFactory[] getConfigurationFactories() { return new ConfigurationFactory[] {configurationFactory}; } public class RoboVMConfigurationFactory extends ConfigurationFactory { public RoboVMConfigurationFactory(RoboVMConfigurationType roboVMConfigurationType) { super(roboVMConfigurationType); } @Override public RunConfiguration createTemplateConfiguration(Project project) { return new RoboVMRuntimeConfiguration("Run Configuration", project, getInstance()); } } public static RoboVMConfigurationType getInstance() { return ContainerUtil.findInstance( Extensions.getExtensions(CONFIGURATION_TYPE_EP), RoboVMConfigurationType.class); } }
public ExternalDocAction() { super( CodeInsightBundle.message("javadoc.action.view.external"), null, IconLoader.getIcon("/actions/browser-externalJavaDoc.png")); registerCustomShortcutSet( ActionManager.getInstance() .getAction(IdeActions.ACTION_EXTERNAL_JAVADOC) .getShortcutSet(), null); }
public ShowMembersToggleAction(JTree tree) { super( APIComparatorBundle.message("comparator.toolbar.actions.showmembers.text"), APIComparatorBundle.message("comparator.toolbar.actions.showmembers.description"), IconLoader.getIcon("/objectBrowser/showMembers.png")); this.tree = tree; if (!configuration.isShowMembers()) { ((TreeItemModel) tree.getModel()).addFilter(filter); } }
public void propertyChange(final PropertyChangeEvent e) { final String name = e.getPropertyName(); if (ToolWindowEx.PROP_AVAILABLE.equals(name)) { updateState(); } else if (ToolWindowEx.PROP_TITLE.equals(name)) { updateText(); } else if (ToolWindowEx.PROP_ICON.equals(name)) { final Icon icon = (Icon) e.getNewValue(); final Icon disabledIcon = IconLoader.getDisabledIcon(icon); setIcon(icon); setDisabledIcon(disabledIcon); } }