private void createToolBar() {
final ToolBar toolBar = new ToolBar(groupmain, SWT.NONE);
toolBar.setLayoutData(new GridData(GridData.BEGINNING, GridData.FILL, true, false));
final ToolItem butNew = new ToolItem(toolBar, SWT.NONE);
butNew.setImage(ResourceManager.getImageFromResource("/sos/scheduler/editor/icon_new.gif"));
final Menu menu = new Menu(toolBar);
butNew.setToolTipText("New Configuration");
MenuItem itemConfig = new MenuItem(menu, SWT.PUSH);
itemConfig.setText("Configuration");
itemConfig.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
if (container.newScheduler() != null)
setSaveStatus();
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
MenuItem itemDoc = new MenuItem(menu, SWT.PUSH);
itemDoc.setText("Documentation");
itemDoc.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
if (container.newDocumentation() != null)
setSaveStatus();
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
/*MenuItem itemDetails = new MenuItem(menu, SWT.PUSH);
itemDetails.setText("Details");
itemDetails.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
if (container.newDetails() != null)
setSaveStatus();
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
*/
MenuItem itemActions = new MenuItem(menu, SWT.PUSH);
itemActions.setText("Event Handler");
itemActions.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
if (container.newActions() != null)
setSaveStatus();
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
MenuItem itemHFEJob = new MenuItem(menu, SWT.PUSH);
itemHFEJob.setText("Hot Folder Element - Job");
itemHFEJob.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
if (container.newScheduler(SchedulerDom.LIFE_JOB) != null)
setSaveStatus();
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
MenuItem itemHFEJobChain = new MenuItem(menu, SWT.PUSH);
itemHFEJobChain.setText("Hot Folder Element - Job Chain");
itemHFEJobChain.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
if (container.newScheduler(SchedulerDom.LIFE_JOB_CHAIN) != null)
setSaveStatus();
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
MenuItem itemHFEProcessClass = new MenuItem(menu, SWT.PUSH);
itemHFEProcessClass.setText("Hot Folder Element - Process Class");
itemHFEProcessClass.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
if (container.newScheduler(SchedulerDom.LIFE_PROCESS_CLASS) != null)
setSaveStatus();
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
MenuItem itemHFELock = new MenuItem(menu, SWT.PUSH);
itemHFELock.setText("Hot Folder Element - Lock");
itemHFELock.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
if (container.newScheduler(SchedulerDom.LIFE_LOCK) != null)
setSaveStatus();
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
MenuItem itemHFEOrder = new MenuItem(menu, SWT.PUSH);
itemHFEOrder.setText("Hot Folder Element - Order");
itemHFEOrder.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
if (container.newScheduler(SchedulerDom.LIFE_ORDER) != null)
setSaveStatus();
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
MenuItem itemHFEScheduler = new MenuItem(menu, SWT.PUSH);
itemHFEScheduler.setText("Hot Folder Element - Schedule");
itemHFEScheduler.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
if (container.newScheduler(SchedulerDom.LIFE_SCHEDULE) != null)
setSaveStatus();
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
addDropDown(butNew, menu);
final ToolItem butOpen = new ToolItem(toolBar, SWT.PUSH);
butOpen.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
if (container.openQuick() != null)
setSaveStatus();
}
});
butOpen.setImage(ResourceManager
.getImageFromResource("/sos/scheduler/editor/icon_open.gif"));
butOpen.setToolTipText("Open Configuration File");
final ToolItem butOpenHotFolder = new ToolItem(toolBar, SWT.PUSH);
butOpenHotFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
if (container.openDirectory(null) != null)
setSaveStatus();
}
});
butOpenHotFolder.setImage(ResourceManager
.getImageFromResource("/sos/scheduler/editor/icon_open_hot_folder.gif"));
butOpenHotFolder.setToolTipText("Open Hot Folder");
butSave = new ToolItem(toolBar, SWT.PUSH);
butSave.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
save();
}
});
butSave.setImage(ResourceManager
.getImageFromResource("/sos/scheduler/editor/save.gif"));
butSave.setToolTipText("Save Configuration");
butShowAsSML = new ToolItem(toolBar, SWT.PUSH);
butShowAsSML.setEnabled(container != null && container.getCurrentEditor() instanceof SchedulerForm);
butShowAsSML.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
try {
if(container.getCurrentEditor()== null)
return;
DomParser currDomParser = getSpecifiedDom();
Utils.showClipboard(Utils.getElementAsString(currDomParser.getRoot()), getSShell(), false, null, false, null, false);
} catch (Exception ex) {
try {
new ErrorLog("error in " + sos.util.SOSClassUtil.getMethodName() + " cause: " + ex.toString(), ex);
} catch(Exception ee) {
//tu nichts
}
}
}
});
butShowAsSML.setImage(ResourceManager
.getImageFromResource("/sos/scheduler/editor/icon_view_as_xml.gif"));
butShowAsSML.setToolTipText("Show Configuration as XML");
final ToolItem butFTP = new ToolItem(toolBar, SWT.NONE);
final Menu menuFTP = new Menu(toolBar);
addDropDown(butFTP, menuFTP);
butFTP.setImage(ResourceManager.getImageFromResource("/sos/scheduler/editor/icon_open_ftp.gif"));
butFTP.setToolTipText("FTP");
MenuItem itemFTPOpen = new MenuItem(menuFTP, SWT.PUSH);
itemFTPOpen.setText("Open By FTP");
itemFTPOpen.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(final SelectionEvent e) {
FTPDialog ftp = new FTPDialog(main);
ftp.showForm(FTPDialog.OPEN);
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
MenuItem itemFTPOpenHotFolder = new MenuItem(menuFTP, SWT.PUSH);
itemFTPOpenHotFolder.setText("Open Hot Folder By FTP");
itemFTPOpenHotFolder.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(final SelectionEvent e) {
FTPDialog ftp = new FTPDialog(main);
ftp.showForm(FTPDialog.OPEN_HOT_FOLDER);
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
MenuItem itemFTPSave = new MenuItem(menuFTP, SWT.PUSH);
itemFTPSave.setText("Save As By FTP");
itemFTPSave.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(final SelectionEvent e) {
saveByFTP();
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
final ToolItem itemReset = new ToolItem(toolBar, SWT.PUSH);
//itemReset.setEnabled(container != null && (container.getCurrentEditor() instanceof sos.scheduler.editor.actions.forms.ActionsForm || container.getCurrentEditor() instanceof SchedulerForm ));
itemReset.setImage(ResourceManager
.getImageFromResource("/sos/scheduler/editor/icon_reset.gif"));
itemReset.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(final SelectionEvent e) {
int c = MainWindow.message("Do you want to reload the configuration and loose the changes?", SWT.ICON_INFORMATION | SWT.YES | SWT.NO);
if(c != SWT.YES)
return;
if(container.getCurrentEditor() instanceof SchedulerForm) {
SchedulerForm form =(SchedulerForm)container.getCurrentEditor();
SchedulerDom currdom = (SchedulerDom)form.getDom();
if(currdom.isLifeElement())
sos.scheduler.editor.app.Utils.reset( currdom.getRoot(), form, currdom);
else
sos.scheduler.editor.app.Utils.reset( currdom.getRoot().getChild("config"), form, currdom);
} else if(container.getCurrentEditor() instanceof sos.scheduler.editor.actions.forms.ActionsForm) {
sos.scheduler.editor.actions.forms.ActionsForm form =( sos.scheduler.editor.actions.forms.ActionsForm)container.getCurrentEditor();
sos.scheduler.editor.actions.ActionsDom currdom = ( sos.scheduler.editor.actions.ActionsDom)form.getDom();
sos.scheduler.editor.app.Utils.reset( currdom.getRoot(),form, currdom);
} else if(container.getCurrentEditor() instanceof sos.scheduler.editor.doc.forms.DocumentationForm) {
sos.scheduler.editor.doc.forms.DocumentationForm form =( sos.scheduler.editor.doc.forms.DocumentationForm)container.getCurrentEditor();
sos.scheduler.editor.doc.DocumentationDom currdom = ( sos.scheduler.editor.doc.DocumentationDom)form.getDom();
sos.scheduler.editor.app.Utils.reset( currdom.getRoot(),form, currdom);
}
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
final ToolItem butWizzard = new ToolItem(toolBar, SWT.PUSH);
butWizzard.setToolTipText("Wizzard");
butWizzard.setImage(ResourceManager
.getImageFromResource("/sos/scheduler/editor/icon_wizzard.gif"));
butWizzard.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(final SelectionEvent e) {
startWizzard();
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
final ToolItem butHelp = new ToolItem(toolBar, SWT.PUSH);
butHelp.setImage(ResourceManager
.getImageFromResource("/sos/scheduler/editor/icon_help.gif"));
butHelp.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(final SelectionEvent e) {
if (container.getCurrentEditor() != null) {
listener.openHelp(container.getCurrentEditor().getHelpKey());
}else {
String msg = "Help is available after documentation or configuration is opened";