JComponent (final Editor editor, final int lineNumber, Disposable parent) { 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); Disposer.register(parent, () -> { prevAction.unregisterCustomShortcutSet(editorComponent); nextAction.unregisterCustomShortcutSet(editorComponent); }); final LineData lineData = getLineData(lineNumber); if (myCoverageByTestApplicable) { group.add(new ShowCoveringTestsAction(editor.getProject(), myCoverageSuite, 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("CoverageHintToolbar", group, true); toolbar.setTargetComponent(editorComponent); 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)); return toolbarComponent; }