datasetEditor.deleteRecords();
}
}
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
presentation.setText("Delete records");
DatasetEditor datasetEditor = getDatasetEditor(e);
if (datasetEditor == null || !datasetEditor.getActiveConnection().isConnected()) {
presentation.setEnabled(false);
} else {
presentation.setVisible(!datasetEditor.isReadonlyData());
presentation.setEnabled(true);
if (datasetEditor.isInserting() || datasetEditor.isLoading() || datasetEditor.isReadonly()) {
presentation.setEnabled(false);
} else {
DatasetEditorTable editorTable = datasetEditor.getEditorTable();
if (editorTable != null && editorTable.getSelectedRows() != null && editorTable.getSelectedRows().length > 0) {
for (int selectedRow : editorTable.getSelectedRows()) {
if (selectedRow < editorTable.getModel().getRowCount()) {
DatasetEditorModelRow row = editorTable.getModel().getRowAtIndex(selectedRow);
if (!row.isDeleted()) {
presentation.setEnabled(true);
return;
}
}
}
}