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; }
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 updateIcon(AnAction action) { if (isToggleable() && (myPresentation.getIcon() == null || myInsideCheckedGroup || !UISettings.getInstance().SHOW_ICONS_IN_MENUS)) { action.update(myEvent); myToggled = Boolean.TRUE.equals( myEvent.getPresentation().getClientProperty(Toggleable.SELECTED_PROPERTY)); if (ActionPlaces.MAIN_MENU.equals(myPlace) && SystemInfo.isMacSystemMenu || UIUtil.isUnderNimbusLookAndFeel() || UIUtil.isUnderWindowsLookAndFeel() && SystemInfo.isWin7OrNewer) { setState(myToggled); } else if (!(getUI() instanceof GtkMenuItemUI)) { if (myToggled) { setIcon(ourCheckedIcon); setDisabledIcon(IconLoader.getDisabledIcon(ourCheckedIcon)); } else { setIcon(ourUncheckedIcon); setDisabledIcon(IconLoader.getDisabledIcon(ourUncheckedIcon)); } } } else { if (UISettings.getInstance().SHOW_ICONS_IN_MENUS) { Icon icon = myPresentation.getIcon(); if (action instanceof ToggleAction && ((ToggleAction) action).isSelected(myEvent)) { icon = new PoppedIcon(icon, 16, 16); } setIcon(icon); if (myPresentation.getDisabledIcon() != null) { setDisabledIcon(myPresentation.getDisabledIcon()); } else { setDisabledIcon(IconLoader.getDisabledIcon(icon)); } } } }
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); }
private MyNextDiffAction() { super("Next Change", "Next Change", IconLoader.getIcon("/actions/nextOccurence.png")); }
private MyPreviousDiffAction() { super( "Previous Change", "Previous Change", IconLoader.getIcon("/actions/previousOccurence.png")); }
private MyChangeContextAction() { super( "More/Less Lines...", "More/Less Lines...", IconLoader.getIcon("/actions/expandall.png")); }
private MyUseSoftWrapsAction(boolean turned) { super("Use soft wraps"); myIcon = IconLoader.findIcon("/actions/checked.png"); }