/** * Adds an action to the view header. * @param name The name of the action. * @param icon An icon to display in the view header for the action. * @param runnable The code that should be called when the action is executed. */ public void addAction(@Nonnull String name, @Nonnull Icon icon, @Nonnull final Runnable runnable) { addAction(new AbstractAction(name, icon) { @Override public void actionPerformed(ActionEvent e) { runnable.run(); } }); }
private void addViewManipulationActions() { // View manipulation toolbar ViewBanner viewBanner = viewBarComponent.getViewBar().getViewBanner(); plugin.getHelpLink().ifPresent(u -> viewBanner.addAction("Help", HelpIcon.get(), this::showHelpIfPresent)); viewBanner.addAction("Split vertically", SplitVerticallyIcon.get(), this::splitVertically); viewBanner.addAction("Split horizontally", SplitHorizontallyIcon.get(), this::splitHorizontally); viewBanner.addAction("Float", FloatIcon.get(), this::copyAndFloatView); viewBanner.addAction("Close", CloseIcon.get(), this::closeView); }
private void addViewManipulationActions() { viewBarComponent.getViewBar().getViewBanner().addAction(new AbstractAction("Split vertically", Icons.getIcon( SPLIT_VERTICALLY_ICON_NAME)) { viewBarComponent.getViewBar().getViewBanner().addAction(new AbstractAction("Split horizontally", Icons.getIcon( SPLIT_HORIZONTALLY_ICON_NAME)) { viewBarComponent.getViewBar().getViewBanner().addAction(new AbstractAction("Float", Icons.getIcon(FLOAT_ICON_NAME)) { viewBarComponent.getViewBar().getViewBanner().addAction(new AbstractAction("Close", Icons.getIcon(CLOSE_ICON_NAME)) {
private void addViewManipulationActions() { viewBarComponent.getViewBar().getViewBanner().addAction(new AbstractAction("Split vertically", Icons.getIcon( SPLIT_VERTICALLY_ICON_NAME)) { viewBarComponent.getViewBar().getViewBanner().addAction(new AbstractAction("Split horizontally", Icons.getIcon( SPLIT_HORIZONTALLY_ICON_NAME)) { viewBarComponent.getViewBar().getViewBanner().addAction(new AbstractAction("Float", Icons.getIcon(FLOAT_ICON_NAME)) { viewBarComponent.getViewBar().getViewBanner().addAction(new AbstractAction("Close", Icons.getIcon(CLOSE_ICON_NAME)) {