name = name.substring(1);
}
if(type==Editor.JOB) {
XPath x3 = XPath.newInstance("//job[@name='"+ name + "']");
List listOfElement_3 = x3.selectNodes(_dom.getDoc());
if(!listOfElement_3.isEmpty()) {
SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
if(f == null)
return;
Tree tree = f.getTree();
for(int i = 0; i < tree.getItemCount(); i++) {
TreeItem item = tree.getItem(i);
if(item.getText().equals(SchedulerListener.JOBS)){
TreeItem[] jobsItem = item.getItems();
for(int j = 0; j < jobsItem.length; j++) {
TreeItem jItem = jobsItem[j];
//if(jItem.getText().equals("Job: "+ name)){
if(jItem.getText().endsWith("Job: "+ name)){
tree.setSelection(new TreeItem [] {jItem});
f.updateTreeItem(jItem.getText());
f.updateTree("jobs");
break;
}
}
}
}
}
} else if(type==Editor.MONITOR) {
String[] split = name.split("_@_");
String jobname = split[0];
String monitorname = split[1];
XPath x3 = XPath.newInstance("//job[@name='"+ jobname + "']/monitor[@name='"+ monitorname + "']");
List listOfElement_3 = x3.selectNodes(_dom.getDoc());
if(!listOfElement_3.isEmpty()) {
SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
if(f == null)
return;
Tree tree = f.getTree();
//if(tree.getSelection()[0].getText().equals("Monitor")){
if(tree.getSelection()[0].getText().equals(SchedulerListener.MONITOR)){
TreeItem[] monitorsItem = tree.getSelection()[0].getItems();
for(int k = 0; k < monitorsItem.length; k++) {
TreeItem monitor = monitorsItem[k];
if(monitor.getText().equals(monitorname)){
//if(jItem.getText().endsWith("Job: "+ name)){
tree.setSelection(new TreeItem [] {monitor});
f.updateTreeItem(monitorname);
f.updateTree("monitor");
break;
}
}
} else {
for(int i = 0; i < tree.getItemCount(); i++) {
TreeItem item = tree.getItem(i);
if(item.getText().equals(SchedulerListener.JOB + jobname)){
TreeItem[] jobsItem = item.getItems();
for(int j = 0; j < jobsItem.length; j++) {
TreeItem jItem = jobsItem[j];
if(jItem.getText().equals("Monitor")){
TreeItem[] monitorsItem = jItem.getItems();
for(int k = 0; k < monitorsItem.length; k++) {
TreeItem monitor = monitorsItem[k];
if(monitor.getText().equals(monitorname)){
//if(jItem.getText().endsWith("Job: "+ name)){
tree.setSelection(new TreeItem [] {monitor});
f.updateTreeItem(monitorname);
f.updateTree("monitor");
break;
}
}
}
}
}
}
}
}
} else if(type==Editor.JOB_CHAIN) {
XPath x3 = XPath.newInstance("//job_chain[@name='"+ name + "']");
List listOfElement_3 = x3.selectNodes(_dom.getDoc());
if(!listOfElement_3.isEmpty()) {
SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
if(f == null)
return;
Tree tree = f.getTree();
for(int i = 0; i < tree.getItemCount(); i++) {
TreeItem item = tree.getItem(i);
if(item.getText().equals(SchedulerListener.JOB_CHAINS)){
TreeItem[] jobsItem = item.getItems();
for(int j = 0; j < jobsItem.length; j++) {
TreeItem jItem = jobsItem[j];
//if(jItem.getText().equals("Job Chain: "+ name)){
if(jItem.getText().endsWith("Job Chain: "+ name)){
tree.setSelection(new TreeItem [] {jItem});
f.updateTreeItem(jItem.getText());
f.updateTree("");
break;
}
}
}
}
}
} else if (type == Editor.PROCESS_CLASSES) {
XPath x3 = XPath.newInstance("//process_class[@name='"+ name + "']");
List listOfElement_3 = x3.selectNodes(_dom.getDoc());
if(!listOfElement_3.isEmpty()) {
SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
if(f == null)
return;
Tree tree = f.getTree();
for(int i = 0; i < tree.getItemCount(); i++) {
TreeItem item = tree.getItem(i);
//if(item.getText().equals("Process Classes")){
if(item.getText().endsWith("Process Classes")){
tree.setSelection(new TreeItem [] {item});
f.updateTreeItem(item.getText());
f.updateTree("");
break;
}
}
}
} else if(type==Editor.SCHEDULE) {
XPath x3 = XPath.newInstance("//schedule[@name='"+ name + "']");
List listOfElement_3 = x3.selectNodes(_dom.getDoc());
if(!listOfElement_3.isEmpty()) {
SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
if(f == null)
return;
Tree tree = f.getTree();
for(int i = 0; i < tree.getItemCount(); i++) {
TreeItem item = tree.getItem(i);
if(item.getText().equals(SchedulerListener.SCHEDULES)){
TreeItem[] items = item.getItems();
for(int j = 0; j < items.length; j++) {
TreeItem jItem = items[j];
//if(jItem.getText().equals(name)){
if(jItem.getText().endsWith(name)){
tree.setSelection(new TreeItem [] {jItem});
f.updateTreeItem(jItem.getText());
f.updateTree("");
break;
}
}
}
}
}
} else if(type == Editor.ORDER) {
XPath x3 = XPath.newInstance("//order[@id='"+ name + "']");
List listOfElement_3 = x3.selectNodes(_dom.getDoc());
if(listOfElement_3.isEmpty()) {
x3 = XPath.newInstance("//add_order[@id='"+ name + "']");
listOfElement_3 = x3.selectNodes(_dom.getDoc());
}
if(!listOfElement_3.isEmpty()) {
SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
if(f == null)
return;
Tree tree = f.getTree();
for(int i = 0; i < tree.getItemCount(); i++) {
TreeItem item = tree.getItem(i);
if(item.getText().equals(SchedulerListener.ORDERS)){
TreeItem[] items = item.getItems();
for(int j = 0; j < items.length; j++) {
TreeItem jItem = items[j];
//if(jItem.getText().equals("Order: " + name)){
if(jItem.getText().endsWith("Order: " + name)){
tree.setSelection(new TreeItem [] {jItem});
f.updateTreeItem(jItem.getText());
f.updateTree("");
break;
}
}
}
}
}
} else if(type == Editor.WEBSERVICE) {
XPath x3 = XPath.newInstance("//web_service[@name='"+ name + "']");
List listOfElement_3 = x3.selectNodes(_dom.getDoc());
if(!listOfElement_3.isEmpty()) {
SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
if(f == null)
return;
Tree tree = f.getTree();
for(int i = 0; i < tree.getItemCount(); i++) {
TreeItem item = tree.getItem(i);
if(item.getText().equals(SchedulerListener.HTTP_SERVER)){
for(int k = 0; k < item.getItemCount(); k++) {
TreeItem httpItem = item.getItem(k);
if(httpItem.getText().equals(SchedulerListener.WEB_SERVICES)){
TreeItem[] items = httpItem.getItems();
for(int j = 0; j < items.length; j++) {
TreeItem jItem = items[j];
if(jItem.getText().equals("Web Service: " + name)){
tree.setSelection(new TreeItem [] {jItem});
f.updateTreeItem(jItem.getText());
f.updateTree("");
break;
}
}
}
}
}
}
}
} else if (type == Editor.ACTIONS) {
XPath x3 = XPath.newInstance("//action[@name='"+ name + "']");
List listOfElement_3 = x3.selectNodes(_dom.getDoc());
if(!listOfElement_3.isEmpty()) {
ActionsForm f = (ActionsForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
if(f == null)
return;
Tree tree = f.getTree();
for(int i = 0; i < tree.getItemCount(); i++) {
TreeItem item = tree.getItem(i);
if(item.getText().equals("Actions")){
TreeItem[] jobsItem = item.getItems();
for(int j = 0; j < jobsItem.length; j++) {
TreeItem jItem = jobsItem[j];
//if(jItem.getText().equals("Job Chain: "+ name)){
if(jItem.getText().endsWith(sos.scheduler.editor.actions.listeners.ActionsListener.ACTION_PREFIX + name)){
tree.setSelection(new TreeItem [] {jItem});
f.updateTreeItem(jItem.getText());
f.updateTree("");
break;
}
}
}
}
}
} else if(type == Editor.EVENTS) {
//<event_group logic="or" group="1">
XPath x3 = XPath.newInstance("//event_group[@group='"+ name + "']");
List listOfElement_3 = x3.selectNodes(_dom.getDoc());
if(!listOfElement_3.isEmpty()) {
ActionsForm f = (ActionsForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
if(f == null)
return;
Tree tree = f.getTree();
if(tree.getSelectionCount() > 0) {
TreeItem itemp = tree.getSelection()[0];
for(int i = 0; i < itemp.getItemCount(); i++) {
TreeItem item = itemp.getItem(i);
if(item.getText().endsWith(sos.scheduler.editor.actions.listeners.ActionsListener.GROUP_PREFIX + name)){
tree.setSelection(new TreeItem [] {item});
f.updateTreeItem(item.getText());
f.updateTree("");
break;
}
}
}
}
} else if(type == Editor.ACTION_COMMANDS) {
XPath x3 = XPath.newInstance("//command[@name='"+ name + "']");
List listOfElement_3 = x3.selectNodes(_dom.getDoc());
if(!listOfElement_3.isEmpty()) {
ActionsForm f = (ActionsForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
if(f == null)
return;
Tree tree = f.getTree();
if(tree.getSelectionCount() > 0) {
TreeItem itemp = tree.getSelection()[0];
for(int i = 0; i < itemp.getItemCount(); i++) {
TreeItem item = itemp.getItem(i);
if(item.getText().endsWith(sos.scheduler.editor.actions.listeners.ActionsListener.COMMAND_PREFIX + name)){
tree.setSelection(new TreeItem [] {item});
f.updateTreeItem(item.getText());
f.updateTree("");
break;
}
}
}
}
} else if (type == Editor.JOB_COMMAND_EXIT_CODES &&
sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor() instanceof ActionsForm){
XPath x3 = null;
String job = "";
if(name.startsWith("start_job")) {
job = name.substring("start_job: ".length());
x3 = XPath.newInstance("//command/start_job[@job='"+ job + "']");
} else {
String child = name.substring(0, name.indexOf(": "));
job = name.substring(child.length() + 2);
x3 = XPath.newInstance("//command/"+child+"[@job_chain='"+ job + "']");
}
List listOfElement_3 = x3.selectNodes(_dom.getDoc());
if(!listOfElement_3.isEmpty()) {
ActionsForm f = (ActionsForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
if(f == null)
return;
Tree tree = f.getTree();
if(tree.getSelectionCount() > 0) {
TreeItem itemp = tree.getSelection()[0];
for(int i = 0; i < itemp.getItemCount(); i++) {
TreeItem item = itemp.getItem(i);
if(item.getText().equals(name)){
tree.setSelection(new TreeItem [] {item});
f.updateTreeItem(item.getText());
f.updateTree("");
break;
}
}
}
}
} else if (type == Editor.JOB_COMMAND_EXIT_CODES &&
sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor() instanceof SchedulerForm){
XPath x3 = null;
String job = "";
if(name.startsWith("start_job")) {
job = name.substring("start_job: ".length());
x3 = XPath.newInstance("//commands/start_job[@job='"+ job + "']");
} else {
String child = name.substring(0, name.indexOf(": "));
job = name.substring(child.length() + 2);
x3 = XPath.newInstance("//commands/"+child+"[@job_chain='"+ job + "']");
}
List listOfElement_3 = x3.selectNodes(_dom.getDoc());
if(!listOfElement_3.isEmpty()) {
SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
if(f == null)
return;
Tree tree = f.getTree();