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 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; } }
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(); } } }); }
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 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); } }
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); }
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; } }
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); } } } } }
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 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); }
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); } }
protected boolean doSetIcon( DefaultMutableTreeNode node, @Nullable String path, Component component) { if (StringUtil.isNotEmpty(path) && !new File(path).isFile()) { Messages.showErrorDialog( component, IdeBundle.message("error.file.not.found.message", path), IdeBundle.message("title.choose.action.icon")); return false; } String actionId = getActionId(node); if (actionId == null) return false; final AnAction action = ActionManager.getInstance().getAction(actionId); if (action != null && action.getTemplatePresentation() != null) { if (StringUtil.isNotEmpty(path)) { Image image = null; try { image = ImageLoader.loadFromStream( VfsUtil.convertToURL(VfsUtil.pathToUrl(path.replace(File.separatorChar, '/'))) .openStream()); } catch (IOException e) { LOG.debug(e); } Icon icon = new File(path).exists() ? IconLoader.getIcon(image) : null; if (icon != null) { if (icon.getIconWidth() > EmptyIcon.ICON_18.getIconWidth() || icon.getIconHeight() > EmptyIcon.ICON_18.getIconHeight()) { Messages.showErrorDialog( component, IdeBundle.message("custom.icon.validation.message"), IdeBundle.message("title.choose.action.icon")); return false; } node.setUserObject(Pair.create(actionId, icon)); mySelectedSchema.addIconCustomization(actionId, path); } } else { node.setUserObject(Pair.create(actionId, null)); mySelectedSchema.removeIconCustomization(actionId); final DefaultMutableTreeNode nodeOnToolbar = findNodeOnToolbar(actionId); if (nodeOnToolbar != null) { editToolbarIcon(actionId, nodeOnToolbar); node.setUserObject(nodeOnToolbar.getUserObject()); } } return true; } return false; }
/** * This renderer is used both as PropertyRenderer and as cell renderer in the color chooser pane * list. * * @author yole */ public class ColorRenderer extends ColoredListCellRenderer implements PropertyRenderer<ColorDescriptor> { private ColorDescriptor myColorDescriptor; private final Icon myEmptyIcon = IconLoader.getIcon("/com/intellij/uiDesigner/icons/empty.png"); public ColorRenderer() { setOpaque(true); } public JComponent getComponent( RadRootContainer rootContainer, ColorDescriptor value, boolean selected, boolean hasFocus) { prepareComponent(value, selected); return this; } private void prepareComponent(final ColorDescriptor value, final boolean selected) { myColorDescriptor = value; clear(); setIcon(myEmptyIcon); setBackground(selected ? UIUtil.getTableSelectionBackground() : UIUtil.getTableBackground()); if (myColorDescriptor != null) { append( myColorDescriptor.toString(), selected ? SimpleTextAttributes.SELECTED_SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES); } } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (myColorDescriptor != null) { final int size = getBounds().height; g.setColor(getBackground()); g.fillRect(0, 0, size + getIconTextGap() + 1, size); g.setColor(myColorDescriptor.getResolvedColor()); g.fillRect(2, 2, size - 4, size - 4); g.setColor(Color.BLACK); g.drawRect(2, 2, size - 4, size - 4); } } protected void customizeCellRenderer( JList list, Object value, int index, boolean selected, boolean hasFocus) { prepareComponent((ColorDescriptor) value, selected); } }
public class Icons { // 16x16 public static final Icon NuxeoFacet = IconLoader.getIcon("/icons/nuxeo-facet.png"); public static final Icon NuxeoReload = IconLoader.getIcon("/icons/nuxeo-reload.png"); public static final Icon NuxeoServerStart = IconLoader.getIcon("/icons/start.png"); public static final Icon NuxeoServerStartDisabled = IconLoader.getIcon("/icons/start_disabled.png"); public static final Icon NuxeoServerStop = IconLoader.getIcon("/icons/stop.png"); public static final Icon NuxeoServerStopDisabled = IconLoader.getIcon("/icons/stop_disabled.png"); }
/** Created by zyuyou on 15/7/6. */ public interface ElixirIcons { Icon FILE = IconLoader.getIcon("/icons/elixir-16.png"); Icon MIX_MODULE_CONFLICT = AllIcons.Actions.Cancel; Icon ELIXIR_APPLICATION = IconLoader.getIcon("/icons/elixir-Application-16.png"); Icon ELIXIR_SUPERVISOR = IconLoader.getIcon("/icons/elixir-Supervisor-16.png"); Icon ELIXIR_GEN_EVENT = IconLoader.getIcon("/icons/elixir-GenEvent-16.png"); Icon ELIXIR_GEN_SERVER = IconLoader.getIcon("/icons/elixir-GenServer-16.png"); Icon ELIXIR_MARK = IconLoader.getIcon("/icons/elixir-mark.png"); Icon ELIXIR_MODULE_NODE = new LayeredIcon(PlatformIcons.FOLDER_ICON, ELIXIR_MARK); Icon MIX = IconLoader.getIcon("/icons/mix-16.png"); Icon MIX_EX_UNIT = new LayeredIcon(MIX, AllIcons.Nodes.JunitTestMark); }
public Splash(String imageName, final Color textColor) { setUndecorated(true); setResizable(false); setModal(false); setFocusableWindowState(false); Icon originalImage = IconLoader.getIcon(imageName); myImage = new MyIcon(originalImage, textColor); myLabel = new JLabel(myImage); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(myLabel, BorderLayout.CENTER); Dimension size = getPreferredSize(); setSize(size); pack(); setLocationRelativeTo(null); }
public void setText(@Nullable final String... text) { myText.removeAll(); if (text == null) return; for (int i = 0; i < text.length; i++) { final JLabel eachLabel = new JLabel(text[i], JLabel.CENTER); final int gap = eachLabel.getIconTextGap(); eachLabel.setBorder(new EmptyBorder(0, 0, 0, gap)); eachLabel.setVerticalTextPosition(JLabel.TOP); eachLabel.setFont(eachLabel.getFont().deriveFont(Font.BOLD, eachLabel.getFont().getSize())); myText.add(eachLabel); if (i < text.length - 1) { final JLabel eachIcon = new JLabel(IconLoader.getIcon("/general/comboArrowRight.png"), JLabel.CENTER); eachIcon.setBorder(new EmptyBorder(0, 0, 0, gap)); myText.add(eachIcon); } } }
private static class CopyFromColumnInfo extends ColumnInfo<VcsFileRevision, String> { private final Icon myIcon = IconLoader.getIcon("/actions/menu-copy.png"); private final ColoredTableCellRenderer myRenderer = new ColoredTableCellRenderer() { protected void customizeCellRenderer( final JTable table, final Object value, final boolean selected, final boolean hasFocus, final int row, final int column) { if (value instanceof String && ((String) value).length() > 0) { setIcon(myIcon); setToolTipText(SvnBundle.message("copy.column.tooltip", value)); } else { setToolTipText(""); } } }; public CopyFromColumnInfo() { super(SvnBundle.message("copy.column.title")); } public String valueOf(final VcsFileRevision o) { return o instanceof SvnFileRevision ? ((SvnFileRevision) o).getCopyFromPath() : ""; } @Override public TableCellRenderer getRenderer(final VcsFileRevision vcsFileRevision) { return myRenderer; } @Override public String getMaxStringValue() { return SvnBundle.message("copy.column.title"); } @Override public int getAdditionalWidth() { return 6; } }
private PopupAction() { super("Settings", "Settings", IconLoader.getIcon("/general/secondaryGroup.png")); myUsual = new AnAction("Top | Bottom") { @Override public void actionPerformed(AnActionEvent e) { boolean was = myConfiguration.SHORT_DIFF_HORISONTALLY; myConfiguration.SHORT_DIFF_HORISONTALLY = false; ensurePresentation(); } }; myNumbered = new AnAction("Left | Right") { @Override public void actionPerformed(AnActionEvent e) { boolean was = myConfiguration.SHORT_DIFF_HORISONTALLY; myConfiguration.SHORT_DIFF_HORISONTALLY = true; ensurePresentation(); } }; mySoftWrapsAction = new MyUseSoftWrapsAction(myConfiguration.SOFT_WRAPS_IN_SHORT_DIFF); }