use of com.intellij.openapi.ui.InputValidatorEx in project intellij-community by JetBrains.
the class InstanceFilterEditor method addClassFilter.
protected void addClassFilter() {
String idString = Messages.showInputDialog(myProject, DebuggerBundle.message("add.instance.filter.dialog.prompt"), DebuggerBundle.message("add.instance.filter.dialog.title"), Messages.getQuestionIcon(), null, new InputValidatorEx() {
@Nullable
@Override
public String getErrorText(String inputString) {
try {
//noinspection ResultOfMethodCallIgnored
Long.parseLong(inputString);
return null;
} catch (NumberFormatException e) {
return DebuggerBundle.message("add.instance.filter.dialog.error.numeric.value.expected");
}
}
@Override
public boolean checkInput(String inputString) {
return getErrorText(inputString) == null;
}
@Override
public boolean canClose(String inputString) {
return getErrorText(inputString) == null;
}
});
if (idString != null) {
ClassFilter filter = createFilter(idString);
myTableModel.addRow(filter);
int row = myTableModel.getRowCount() - 1;
myTable.getSelectionModel().setSelectionInterval(row, row);
myTable.scrollRectToVisible(myTable.getCellRect(row, 0, true));
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
IdeFocusManager.getGlobalInstance().requestFocus(myTable, true);
});
}
}
Aggregations