tClass.addFocusListener(new FocusAdapter() {
public void focusGained(final FocusEvent e) {
tClass.selectAll();
}
});
tClass.addVerifyListener(new VerifyListener() {
public void verifyText(final VerifyEvent e) {
if(e.text.length() > 0 && bJava.getSelection() && tSource.getText().length() > 0) {
MainWindow.message("Please remove first Source Code.", SWT.ICON_WARNING);
e.doit = false;
return;
}
}
});
tClass.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
tClass.addModifyListener(new org.eclipse.swt.events.ModifyListener() {
public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
if(!init) {
if (bJava.getSelection())
listener.setJavaClass(tClass.getText());
else if (bCom.getSelection())
listener.setComClass(tClass.getText());
}
}
});
butFavorite = new Button(gScript, SWT.NONE);
butFavorite.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
Options.setProperty("monitor_favorite_" + ( bCom.getSelection() ? "com" : listener.getLanguage(listener.getLanguage())) +"_" + txtName.getText(), getFavoriteValue());
Options.saveProperties();
cboFavorite.setItems(normalized(Options.getPropertiesWithPrefix("monitor_favorite_")));
}
});
butFavorite.setEnabled(false);
butFavorite.setVisible(type == Editor.MONITOR);
butFavorite.setText("Favorites");
Label lblClasspath = new Label(gScript, SWT.NONE);
lblClasspath.setText("Class_path");
Label label_1 = new Label(gScript, SWT.NONE);
label_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
tClasspath = new Text(gScript, SWT.BORDER);
tClasspath.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent arg0) {
listener.setClasspath(tClasspath.getText());
}
});
tClasspath.setEnabled(false);
tClasspath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
new Label(gScript, SWT.NONE);
label3 = new Label(gScript, SWT.NONE);
label3.setText("Filename:");
new GridData(GridData.FILL, GridData.FILL, false, true, 3, 1);
new Label(gScript, SWT.NONE);
GridData gridData2 = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1);
gridData2.widthHint = 0;
tFilename = new Text(gScript, SWT.BORDER);
tFilename.addFocusListener(new FocusAdapter() {
public void focusGained(final FocusEvent e) {
tFilename.selectAll();
}
});
tFilename.setLayoutData(gridData2);
tFilename.addModifyListener(new org.eclipse.swt.events.ModifyListener() {
public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
if(!init)
listener.setFilename(tFilename.getText());
}
});
new Label(gScript, SWT.NONE);
GridLayout gridLayout1 = new GridLayout();
gridLayout1.marginWidth = 0;
gridLayout1.marginHeight = 0;
gridLayout1.numColumns = 3;
gInclude = new Group(gScript, SWT.NONE);
gInclude.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 4, 1));
gInclude.setText("Include Files");
gInclude.setLayout(gridLayout1);
butIsLifeFile = new Button(gInclude, SWT.CHECK);
butIsLifeFile.setText("in live Folder");
tInclude = new Text(gInclude, SWT.BORDER);
tInclude.addFocusListener(new FocusAdapter() {
public void focusGained(final FocusEvent e) {
tFilename.selectAll();
}
});
tInclude.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
bAdd = new Button(gInclude, SWT.NONE);
label = new Label(gInclude, SWT.SEPARATOR | SWT.HORIZONTAL);
label.setText("Label");
label.setLayoutData(new org.eclipse.swt.layout.GridData(GridData.FILL, GridData.FILL, false, false, 3, 1));
tableIncludes = new Table(gInclude, SWT.FULL_SELECTION | SWT.BORDER);
tableIncludes.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
if(tableIncludes.getSelectionCount() > 0) {
tInclude.setText(tableIncludes.getSelection()[0].getText(0));
tInclude.setEnabled(true);
butIsLifeFile.setSelection(tableIncludes.getSelection()[0].getText(1) != null && tableIncludes.getSelection()[0].getText(1).equals("live_file"));
bRemove.setEnabled(tableIncludes.getSelectionCount() > 0);
bAdd.setEnabled(false);
}
}
});
tableIncludes.setLinesVisible(true);
tableIncludes.setHeaderVisible(true);
final GridData gridData_2 = new GridData(GridData.FILL, GridData.FILL, true, true, 2, 2);
gridData_2.heightHint = 4;
gridData_2.minimumHeight = 20;
tableIncludes.setLayoutData(gridData_2);
final TableColumn newColumnTableColumn = new TableColumn(tableIncludes, SWT.NONE);
newColumnTableColumn.setWidth(272);
newColumnTableColumn.setText("Name");
final TableColumn newColumnTableColumn_1 = new TableColumn(tableIncludes, SWT.NONE);
newColumnTableColumn_1.setWidth(81);
newColumnTableColumn_1.setText("File/Life File");
final Button butNew = new Button(gInclude, SWT.NONE);
butNew.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
tableIncludes.deselectAll();
tInclude.setText("");
tInclude.setEnabled(true);
butIsLifeFile.setSelection(false);
tInclude.setFocus();
}
});
butNew.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
butNew.setText("New");
tInclude.addModifyListener(new org.eclipse.swt.events.ModifyListener() {
public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
bAdd.setEnabled(!tInclude.getText().equals(""));
}
});
tInclude.addKeyListener(new org.eclipse.swt.events.KeyAdapter() {
public void keyPressed(org.eclipse.swt.events.KeyEvent e) {
if (e.keyCode == SWT.CR && !tInclude.getText().equals("")) {
listener.addInclude(tableIncludes, tInclude.getText(), butIsLifeFile.getSelection());
listener.fillTable(tableIncludes);
tInclude.setText("");
}
}
});
bAdd.setText("&Add File");
bAdd.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
bAdd.setEnabled(false);
bAdd.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
applyFile();
}
});
bRemove = new Button(gInclude, SWT.NONE);
bRemove.setText("Remove File");
bRemove.setEnabled(false);
bRemove.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
bRemove.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
if (tableIncludes.getSelectionCount() > 0) {
int index = tableIncludes.getSelectionIndex();
listener.removeInclude(index);
listener.fillTable(tableIncludes);
if (index >= tableIncludes.getItemCount())
index--;
//if (tableIncludes.getItemCount() > 0)
// tableIncludes.setSelection(index);
tableIncludes.deselectAll();
tInclude.setText("");
tInclude.setEnabled(false);
}
}
});
gSource = new Group(gScript, SWT.NONE);
final GridData gridData_5 = new GridData(GridData.FILL, GridData.FILL, true, true, 4, 1);
gridData_5.minimumHeight = 30;
gSource.setLayoutData(gridData_5);
final GridLayout gridLayout_2 = new GridLayout();
gridLayout_2.marginHeight = 0;
gridLayout_2.numColumns = 4;
gSource.setLayout(gridLayout_2);
gSource.setText("Source Code");
lblPrefunction = new Label(gSource, SWT.NONE);
lblPrefunction.setText("Select predefined functions:");
cboPrefunction = new Combo(gSource, SWT.READ_ONLY);
cboPrefunction.setVisibleItemCount(7);
cboPrefunction.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
if(cboPrefunction.getText().length() > 0) {
String lan = "function_" + ((type == Editor.MONITOR)? "monitor" : "job") + "_" + listener.getLanguage(listener.getLanguage()) + "_";
tSource.append(Options.getProperty(lan.toLowerCase() + cboPrefunction.getText()));
cboPrefunction.setText("");
tSource.setFocus();
//cboPrefunction.setText("-- Templates --");
}
}
});
cboPrefunction.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
Button btnFont = new Button(gSource, SWT.NONE);
btnFont.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
SchedulerEditorFontDialog fd = new SchedulerEditorFontDialog(tSource.getFont().getFontData()[0],tSource.getForeground().getRGB());
fd.show(display);
setFont(fd.getFontData(),fd.getForeGround());
}
});
btnFont.setText("Font");
button = new Button(gSource, SWT.NONE);
final GridData gridData_3 = new GridData(GridData.CENTER, GridData.BEGINNING, false, false);
gridData_3.widthHint = 30;
button.setLayoutData(gridData_3);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
String text = "";
if(type!=Editor.SCRIPT) {
String lan = "function_" + ((type == Editor.MONITOR)? "monitor" : "job") + "_" + listener.getLanguage(listener.getLanguage()) + "_";
text = sos.scheduler.editor.app.Utils.showClipboard(tSource.getText(), getShell(), true, "", true, lan, false);
} else {
text = sos.scheduler.editor.app.Utils.showClipboard(tSource.getText(), getShell(), true, "");
}
if(text != null)
tSource.setText(text);
}
});
button.setImage(ResourceManager.getImageFromResource("/sos/scheduler/editor/icon_edit.gif"));
tSource = new Text(gSource, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL);
tSource.addVerifyListener(new VerifyListener() {
public void verifyText(final VerifyEvent e) {
if(e.text.length() > 0 && e.text.trim().length() > 0 && bJava.getSelection() && tClass.getText().length() > 0) {
MainWindow.message("Please remove first Classname.", SWT.ICON_WARNING);
e.doit = false;
return;