Search in sources :

Example 1 with ToolbarDecorator

use of com.intellij.ui.ToolbarDecorator in project intellij-community by JetBrains.

the class CvsConfigurationsListEditor method createListPanel.

private JComponent createListPanel() {
    final AnActionButton duplicateButton = new DumbAwareActionButton(CvsBundle.message("action.name.copy"), PlatformIcons.COPY_ICON) {

        @Override
        public void updateButton(AnActionEvent e) {
            e.getPresentation().setEnabled(getSelectedConfiguration() != null);
        }

        @Override
        public void actionPerformed(AnActionEvent e) {
            copySelectedConfiguration();
        }
    };
    duplicateButton.setShortcut(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_D, SystemInfo.isMac ? KeyEvent.META_MASK : KeyEvent.CTRL_MASK)));
    final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myList).setAddAction(new AnActionButtonRunnable() {

        @Override
        public void run(AnActionButton anActionButton) {
            createNewConfiguration();
        }
    }).addExtraAction(duplicateButton);
    return decorator.createPanel();
}
Also used : DumbAwareActionButton(com.intellij.ui.DumbAwareActionButton) CustomShortcutSet(com.intellij.openapi.actionSystem.CustomShortcutSet) AnActionButtonRunnable(com.intellij.ui.AnActionButtonRunnable) ToolbarDecorator(com.intellij.ui.ToolbarDecorator) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) AnActionButton(com.intellij.ui.AnActionButton)

Example 2 with ToolbarDecorator

use of com.intellij.ui.ToolbarDecorator in project intellij-plugins by JetBrains.

the class AddRemoveTableRowsDialog method initButtons.

private void initButtons() {
    ToolbarDecorator d = ToolbarDecorator.createDecorator(myTable);
    d.setAddAction(new AnActionButtonRunnable() {

        public void run(AnActionButton button) {
            if (addObject()) {
                ((AbstractTableModel) myTable.getModel()).fireTableDataChanged();
                if (myEditAddedRow) {
                    myTable.editCellAt(myTable.getRowCount() - 1, 0);
                }
            }
        }
    });
    d.setRemoveAction(new AnActionButtonRunnable() {

        public void run(AnActionButton anActionButton) {
            TableUtil.stopEditing(myTable);
            final int[] selectedRows = myTable.getSelectedRows();
            Arrays.sort(selectedRows);
            for (int i = selectedRows.length - 1; i >= 0; i--) {
                myList.remove(selectedRows[i]);
            }
            ((AbstractTableModel) myTable.getModel()).fireTableDataChanged();
        }
    });
    myMainPanel.add(d.createPanel(), BorderLayout.CENTER);
}
Also used : AnActionButtonRunnable(com.intellij.ui.AnActionButtonRunnable) ToolbarDecorator(com.intellij.ui.ToolbarDecorator) AnActionButton(com.intellij.ui.AnActionButton)

Example 3 with ToolbarDecorator

use of com.intellij.ui.ToolbarDecorator in project android by JetBrains.

the class UpdateSitesPanel method createUIComponents.

private void createUIComponents() {
    mySourcesLoadingIcon = new AsyncProcessIcon("Loading...");
    mySourcesTableModel = new SourcesTableModel(new Runnable() {

        @Override
        public void run() {
            UIUtil.invokeAndWaitIfNeeded(new Runnable() {

                @Override
                public void run() {
                    mySourcesLoadingPanel.setVisible(true);
                }
            });
        }
    }, new Runnable() {

        @Override
        public void run() {
            UIUtil.invokeAndWaitIfNeeded(new Runnable() {

                @Override
                public void run() {
                    mySourcesLoadingPanel.setVisible(false);
                }
            });
        }
    });
    myUpdateSitesTable = new TableView<SourcesTableModel.Row>(mySourcesTableModel);
    ToolbarDecorator userDefinedDecorator = ToolbarDecorator.createDecorator(myUpdateSitesTable);
    mySourcesPanel = addExtraActions(userDefinedDecorator).createPanel();
    SdkUpdaterConfigPanel.setTableProperties(myUpdateSitesTable, null);
}
Also used : AnActionButtonRunnable(com.intellij.ui.AnActionButtonRunnable) AsyncProcessIcon(com.intellij.util.ui.AsyncProcessIcon) ToolbarDecorator(com.intellij.ui.ToolbarDecorator)

Example 4 with ToolbarDecorator

use of com.intellij.ui.ToolbarDecorator in project azure-tools-for-java by Microsoft.

the class WebAppDeployDialog method createUIComponents.

private void createUIComponents() {
    DefaultTableModel tableModel = new DefaultTableModel() {

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };
    tableModel.addColumn("Name");
    tableModel.addColumn("JDK");
    tableModel.addColumn("Web container");
    tableModel.addColumn("Resource group");
    table = new JBTable(tableModel);
    table.setRowSelectionAllowed(true);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent event) {
            if (event.getValueIsAdjusting())
                return;
            //System.out.println("row : " + table.getValueAt(table.getSelectedRow(), 0).toString());
            fillAppServiceDetails();
        }
    });
    AnActionButton refreshAction = new AnActionButton("Refresh", AllIcons.Actions.Refresh) {

        @Override
        public void actionPerformed(AnActionEvent anActionEvent) {
            refreshAppServices();
        }
    };
    ToolbarDecorator tableToolbarDecorator = ToolbarDecorator.createDecorator(table).setAddAction(new AnActionButtonRunnable() {

        @Override
        public void run(AnActionButton button) {
            createAppService();
        }
    }).setRemoveAction(new AnActionButtonRunnable() {

        @Override
        public void run(AnActionButton button) {
            deleteAppService();
        }
    }).setRemoveActionUpdater(new AnActionButtonUpdater() {

        @Override
        public boolean isEnabled(AnActionEvent e) {
            return table.getSelectedRow() != -1;
        }
    }).disableUpDownActions().addExtraActions(refreshAction);
    panelTable = tableToolbarDecorator.createPanel();
}
Also used : AnActionButtonRunnable(com.intellij.ui.AnActionButtonRunnable) AnActionButtonUpdater(com.intellij.ui.AnActionButtonUpdater) DefaultTableModel(javax.swing.table.DefaultTableModel) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ToolbarDecorator(com.intellij.ui.ToolbarDecorator) JBTable(com.intellij.ui.table.JBTable) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) AnActionButton(com.intellij.ui.AnActionButton) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 5 with ToolbarDecorator

use of com.intellij.ui.ToolbarDecorator in project sonarlint-intellij by SonarSource.

the class SonarLintProjectAnalyzersPanel method createUIComponents.

private void createUIComponents() {
    tableModel = new Model();
    analyzerTable = new JBTable(tableModel);
    analyzerTable.setShowGrid(false);
    analyzerTable.setIntercellSpacing(JBUI.emptySize());
    analyzerTable.getEmptyText().setText("No information");
    analyzerTable.setDragEnabled(false);
    analyzerTable.setShowVerticalLines(false);
    analyzerTable.getTableHeader().setReorderingAllowed(false);
    analyzerTable.enableInputMethods(false);
    analyzerTable.setDefaultRenderer(String.class, new NoFocusCellRenderer(new DefaultTableCellRenderer()));
    final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(analyzerTable);
    tablePanel = decorator.createPanel();
}
Also used : AbstractTableModel(javax.swing.table.AbstractTableModel) ToolbarDecorator(com.intellij.ui.ToolbarDecorator) JBTable(com.intellij.ui.table.JBTable) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer)

Aggregations

ToolbarDecorator (com.intellij.ui.ToolbarDecorator)20 AnActionButton (com.intellij.ui.AnActionButton)15 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)9 AnActionButtonRunnable (com.intellij.ui.AnActionButtonRunnable)9 JBTable (com.intellij.ui.table.JBTable)8 DefaultTableModel (javax.swing.table.DefaultTableModel)6 AzureString (com.microsoft.azure.toolkit.lib.common.bundle.AzureString)3 List (java.util.List)3 ApplicationManager (com.intellij.openapi.application.ApplicationManager)2 CustomLineBorder (com.intellij.ui.border.CustomLineBorder)2 Tree (com.intellij.ui.treeStructure.Tree)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Collectors (java.util.stream.Collectors)2 TableColumn (javax.swing.table.TableColumn)2 CloudLineBreakpointType (com.google.cloud.tools.intellij.debugger.CloudLineBreakpointType)1 CommonBundle (com.intellij.CommonBundle)1 CodeInsightBundle (com.intellij.codeInsight.CodeInsightBundle)1 HintManager (com.intellij.codeInsight.hint.HintManager)1