private void btAddAtcNodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAddAtcNodeActionPerformed
Object value = treeTextTemplates.getLastSelectedPathComponent();
if (value instanceof DirectoryTextTemplateTreeItem){
try {
DirectoryTextTemplateTreeItem selected = (DirectoryTextTemplateTreeItem) value;
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();
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();
}
} catch (ClipsException ex) {