use of com.intellij.ui.AnActionButton 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();
}
use of com.intellij.ui.AnActionButton in project intellij-community by JetBrains.
the class PythonPathEditor method addToolbarButtons.
@Override
protected void addToolbarButtons(ToolbarDecorator toolbarDecorator) {
AnActionButton reloadButton = new AnActionButton(PyBundle.message("sdk.paths.dialog.reload.paths"), AllIcons.Actions.Refresh) {
@Override
public void actionPerformed(AnActionEvent e) {
onReloadButtonClicked();
}
};
toolbarDecorator.addExtraAction(reloadButton);
}
use of com.intellij.ui.AnActionButton in project intellij-community by JetBrains.
the class CheckBoxListModelEditor method editAction.
@NotNull
public CheckBoxListModelEditor<T> editAction(@NotNull final Function<T, T> consumer) {
final Runnable action = () -> {
T item = getSelectedItem();
if (item != null) {
T newItem = consumer.fun(item);
if (newItem != null) {
list.updateItem(item, newItem, StringUtil.notNullize(toNameConverter.fun(newItem)));
}
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
IdeFocusManager.getGlobalInstance().requestFocus(list, true);
});
}
};
toolbarDecorator.setEditAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
action.run();
}
});
EditSourceOnDoubleClickHandler.install(list, action);
return this;
}
use of com.intellij.ui.AnActionButton 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();
}
use of com.intellij.ui.AnActionButton 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);
}
Aggregations