Search in sources :

Example 1 with ShowCoveringTestsAction

use of com.intellij.coverage.actions.ShowCoveringTestsAction in project intellij-community by JetBrains.

the class CoverageLineMarkerRenderer method createActionsToolbar.

protected JComponent createActionsToolbar(final Editor editor, final int lineNumber) {
    final JComponent editorComponent = editor.getComponent();
    final DefaultActionGroup group = new DefaultActionGroup();
    final GotoPreviousCoveredLineAction prevAction = new GotoPreviousCoveredLineAction(editor, lineNumber);
    final GotoNextCoveredLineAction nextAction = new GotoNextCoveredLineAction(editor, lineNumber);
    group.add(prevAction);
    group.add(nextAction);
    prevAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK)), editorComponent);
    nextAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK)), editorComponent);
    final LineData lineData = getLineData(lineNumber);
    if (myCoverageByTestApplicable) {
        group.add(new ShowCoveringTestsAction(myClassName, lineData));
    }
    final AnAction byteCodeViewAction = ActionManager.getInstance().getAction("ByteCodeViewer");
    if (byteCodeViewAction != null) {
        group.add(byteCodeViewAction);
    }
    group.add(new EditCoverageColorsAction(editor, lineNumber));
    group.add(new HideCoverageInfoAction());
    final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.FILEHISTORY_VIEW_TOOLBAR, group, true);
    final JComponent toolbarComponent = toolbar.getComponent();
    final Color background = ((EditorEx) editor).getBackgroundColor();
    final Color foreground = editor.getColorsScheme().getColor(EditorColors.CARET_COLOR);
    toolbarComponent.setBackground(background);
    toolbarComponent.setBorder(new ColoredSideBorder(foreground, foreground, lineData == null || lineData.getStatus() == LineCoverage.NONE || mySubCoverageActive ? foreground : null, foreground, 1));
    toolbar.updateActionsImmediately();
    return toolbarComponent;
}
Also used : EditorEx(com.intellij.openapi.editor.ex.EditorEx) ShowCoveringTestsAction(com.intellij.coverage.actions.ShowCoveringTestsAction) HideCoverageInfoAction(com.intellij.coverage.actions.HideCoverageInfoAction) LineData(com.intellij.rt.coverage.data.LineData) ColoredSideBorder(com.intellij.ui.ColoredSideBorder)

Aggregations

HideCoverageInfoAction (com.intellij.coverage.actions.HideCoverageInfoAction)1 ShowCoveringTestsAction (com.intellij.coverage.actions.ShowCoveringTestsAction)1 EditorEx (com.intellij.openapi.editor.ex.EditorEx)1 LineData (com.intellij.rt.coverage.data.LineData)1 ColoredSideBorder (com.intellij.ui.ColoredSideBorder)1