@Override protected void buildToolBar(final DefaultActionGroup toolBarGroup) { super.buildToolBar(toolBarGroup); EmptyAction.registerWithShortcutSet( IdeActions.MOVE_TO_ANOTHER_CHANGE_LIST, CommonShortcuts.getMove(), myViewer); toolBarGroup.add(ActionManager.getInstance().getAction(IdeActions.MOVE_TO_ANOTHER_CHANGE_LIST)); }
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 addToolbarActions(final DialogWrapper dialogWrapper) { final Icon icon = AllIcons.Actions.Refresh; if (myBrowser.myChangesToDisplay == null) { myBrowser.addToolbarAction( new AnAction("Refresh Changes") { @Override public void actionPerformed(AnActionEvent e) { myBrowser.rebuildList(); } @Override public void update(AnActionEvent e) { e.getPresentation().setIcon(icon); } }); } RollbackDialogAction rollback = new RollbackDialogAction(); EmptyAction.setupAction(rollback, IdeActions.CHANGES_VIEW_ROLLBACK, myBrowser); myBrowser.addToolbarAction(rollback); final EditSourceForDialogAction editSourceAction = new EditSourceForDialogAction(myBrowser); editSourceAction.registerCustomShortcutSet(CommonShortcuts.getEditSource(), myBrowser); myBrowser.addToolbarAction(editSourceAction); myBrowser.addToolbarAction( ActionManager.getInstance().getAction("Vcs.CheckinProjectToolbar")); final List<AnAction> actions = AdditionalLocalChangeActionsInstaller.calculateActions( myProject, myBrowser.getAllChanges()); if (actions != null) { for (AnAction action : actions) { myBrowser.addToolbarAction(action); } } if (myAdditionalActions != null && myAdditionalActions.length > 0) { for (AnAction action : myAdditionalActions) { myBrowser.addToolbarAction(action); } } }
private void setupComponents() { setupEditorDefault(myConsoleEditor); setupEditorDefault(myHistoryViewer); myConsoleEditor.addEditorMouseListener( EditorActionUtil.createEditorPopupHandler(IdeActions.GROUP_CONSOLE_EDITOR_POPUP)); //noinspection PointlessBooleanExpression,ConstantConditions if (SEPARATOR_THICKNESS > 0 && myShowSeparatorLine) { myHistoryViewer .getComponent() .setBorder(new SideBorder(JBColor.LIGHT_GRAY, SideBorder.BOTTOM)); } myHistoryViewer.getComponent().setMinimumSize(new Dimension(0, 0)); myHistoryViewer.getComponent().setPreferredSize(new Dimension(0, 0)); myConsoleEditor.getSettings().setAdditionalLinesCount(2); myConsoleEditor.setHighlighter( EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, myVirtualFile)); myHistoryViewer.setCaretEnabled(false); myConsoleEditor.setHorizontalScrollbarVisible(true); final VisibleAreaListener areaListener = new VisibleAreaListener() { public void visibleAreaChanged(VisibleAreaEvent e) { final int offset = myConsoleEditor.getScrollingModel().getHorizontalScrollOffset(); final ScrollingModel model = myHistoryViewer.getScrollingModel(); final int historyOffset = model.getHorizontalScrollOffset(); if (historyOffset != offset) { try { model.disableAnimation(); model.scrollHorizontally(offset); } finally { model.enableAnimation(); } } } }; myConsoleEditor.getScrollingModel().addVisibleAreaListener(areaListener); final DocumentAdapter docListener = new DocumentAdapter() { @Override public void documentChanged(final DocumentEvent e) { queueUiUpdate(false); } }; myEditorDocument.addDocumentListener(docListener, this); myHistoryViewer.getDocument().addDocumentListener(docListener, this); myHistoryViewer .getContentComponent() .addKeyListener( new KeyAdapter() { public void keyTyped(KeyEvent event) { if (isConsoleEditorEnabled() && UIUtil.isReallyTypedEvent(event)) { myConsoleEditor.getContentComponent().requestFocus(); myConsoleEditor.processKeyTyped(event); } } }); for (AnAction action : createActions()) { action.registerCustomShortcutSet(action.getShortcutSet(), myConsoleEditor.getComponent()); } EmptyAction.registerActionShortcuts( myHistoryViewer.getComponent(), myConsoleEditor.getComponent()); }