String pathFromHotFolderDirectory = new File(hotFolderfilename).getParent();
if(tab.getFilelist() != null &&
(tab.getFilelist().contains(hotFolderfilename) ||
tab.getFilelist().contains(pathFromHotFolderDirectory) )) {
//Hot Folder oder Hot Folder Element ist in einem Tabraiter offen oder
SchedulerForm form = null;
if(tab.getFilelist().contains(hotFolderfilename)) {
form = (SchedulerForm)tab.getEditor(hotFolderfilename);//hot folder element
x2 = XPath.newInstance("//job/monitor/script[@java_class='sos.scheduler.managed.configuration.ConfigurationOrderMonitor']");
} else {
form = (SchedulerForm)tab.getEditor(pathFromHotFolderDirectory);//hot folder
x2 = XPath.newInstance("//job[@name='"+new File(jobname).getName()+"']/monitor/script[@java_class='sos.scheduler.managed.configuration.ConfigurationOrderMonitor']");
}
SchedulerDom currdom = (SchedulerDom)form.getDom();
listOfElement2 = x2.selectNodes(currdom.getDoc());
if(listOfElement2.isEmpty()) {
XPath x3 = null;
XPath x4 = null;
if(tab.getFilelist().contains(hotFolderfilename)) {
x3 = XPath.newInstance("//job/monitor/script[@java_class='sos.scheduler.managed.configuration.ConfigurationOrderMonitor']");
x4 = XPath.newInstance("//job");;
} else {
x3 = XPath.newInstance("//job[@name='"+new File(jobname).getName()+"']/monitor/script[@java_class='sos.scheduler.managed.configuration.ConfigurationOrderMonitor']");
x4 = XPath.newInstance("//job[@name='"+new File(jobname).getName()+"']");
}
List listOfElement3 = x3.selectNodes(currdom.getDoc());
if(listOfElement3.isEmpty()) {
List listOfElement4 = x4.selectNodes(currdom.getDoc());
Element job = (Element)listOfElement4.get(0);
addMonitoring(job, currdom);
if(currdom.isLifeElement())
form.getTree().setSelection(new org.eclipse.swt.widgets.TreeItem[] { form.getTree().getItem(0) });
else if(currdom.isDirectory())
form.selectTreeItem(SchedulerListener.JOBS , SchedulerListener.JOB + new File(jobname).getName());
currdom.setChanged(true);
if(form != null) {
form.updateJob(job);
form.updateJob();
form.update();
}
currdom.setChanged(true);
form.dataChanged();
dom.setChanged(true);
if(tab.getFilelist().contains(hotFolderfilename)) {
form.dataChanged(tab.getFolderTab(hotFolderfilename));
} else {
form.dataChanged(tab.getFolderTab(pathFromHotFolderDirectory));
}
}
}