if (res == JOptionPane.OK_OPTION) {
if (tfName.getText().isEmpty()) {
MessageBox.showWarning(MessageBox.W_INCORRECT_DATA);
return;
} else {
TextTemplateTreeDetails details = new TextTemplateTreeDetails();
details.title = tfName.getText();
details.parentItem = selected.getID();
DirectoryTextTemplateTreeItem newItem = new DirectoryTextTemplateTreeItem(details);
selected.getItems().append(newItem);
}
updateTree();
}
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
}else{
try {
tfName.setText("");
int res = JOptionPane.showConfirmDialog(
null, pnlNewNode, "Заполните поля", JOptionPane.OK_CANCEL_OPTION, -1);
if (res == JOptionPane.OK_OPTION) {
if (tfName.getText().isEmpty()) {
MessageBox.showWarning(MessageBox.W_INCORRECT_DATA);
return;
} else {
TextTemplateTreeDetails details = new TextTemplateTreeDetails();
details.title = tfName.getText();
DirectoryTextTemplateTreeItem newItem = new DirectoryTextTemplateTreeItem(details);
templateTree.getItems().append(newItem);
}
updateTree();