use of org.talend.designer.esb.runcontainer.ui.wizard.AddRuntimeWizard in project tesb-studio-se by Talend.
the class RunContainerPreferencePage method createPageContents.
/**
* Create contents of the preference page.
*
* @param parent
*/
@Override
public Control createPageContents(Composite parent) {
serverFieldEditors = new ArrayList<FieldEditor>();
optionFieldEditors = new ArrayList<FieldEditor>();
runtimeEnable = getPreferenceStore().getBoolean(RunContainerPreferenceInitializer.P_ESB_IN_OSGI);
GridLayout gridLayoutDefault = new GridLayout(1, false);
Composite body = new Composite(parent, SWT.NONE);
body.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
body.setLayout(gridLayoutDefault);
getPreferenceStore().getBoolean(RunContainerPreferenceInitializer.P_ESB_IN_OSGI);
useOSGiEditor = new BooleanFieldEditor(RunContainerPreferenceInitializer.P_ESB_IN_OSGI, "ESB Studio Runtime - Use Local Talend Runtime (OSGi Container)", body);
addField(useOSGiEditor);
Label lblNote = new Label(body, SWT.WRAP);
lblNote.setText("Note: It will be only taken into account for an ESB Artifact:\n" + " · A Route (Any Route)\n" + " · A DataService (SOAP/REST)\n" + " · A Job contains tRESTClient or tESBConsumer component");
Group groupServer = new Group(body, SWT.NONE);
//$NON-NLS-1$
groupServer.setText(RunContainerMessages.getString("RunContainerPreferencePage.Group1"));
groupServer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
groupServer.setLayout(new GridLayout(2, false));
compositeServerBody = new Composite(groupServer, SWT.BORDER);
compositeServerBody.setLayout(gridLayoutDefault);
compositeServerBody.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
StringFieldEditor locationEditor = new StringFieldEditor(RunContainerPreferenceInitializer.P_ESB_RUNTIME_LOCATION, RunContainerMessages.getString("RunContainerPreferencePage.Location"), //$NON-NLS-1$
compositeServerBody);
addField(locationEditor);
serverFieldEditors.add(locationEditor);
StringFieldEditor hostFieldEditor = new StringFieldEditor(RunContainerPreferenceInitializer.P_ESB_RUNTIME_HOST, RunContainerMessages.getString("RunContainerPreferencePage.Host"), compositeServerBody);
addField(hostFieldEditor);
// only support local runtime server, if need support remote server ,enable this editor
hostFieldEditor.setEnabled(false, compositeServerBody);
StringFieldEditor userFieldEditor = new StringFieldEditor(RunContainerPreferenceInitializer.P_ESB_RUNTIME_USERNAME, RunContainerMessages.getString("RunContainerPreferencePage.Username"), //$NON-NLS-1$
compositeServerBody);
addField(userFieldEditor);
serverFieldEditors.add(userFieldEditor);
StringFieldEditor passwordFieldEditor = new StringFieldEditor(RunContainerPreferenceInitializer.P_ESB_RUNTIME_PASSWORD, RunContainerMessages.getString("RunContainerPreferencePage.Password"), //$NON-NLS-1$
compositeServerBody);
addField(passwordFieldEditor);
serverFieldEditors.add(passwordFieldEditor);
StringFieldEditor instanceFieldEditor = new StringFieldEditor(RunContainerPreferenceInitializer.P_ESB_RUNTIME_INSTANCE, RunContainerMessages.getString("RunContainerPreferencePage.Instance"), //$NON-NLS-1$
compositeServerBody);
addField(instanceFieldEditor);
serverFieldEditors.add(instanceFieldEditor);
IntegerFieldEditor portFieldEditor = new IntegerFieldEditor(RunContainerPreferenceInitializer.P_ESB_RUNTIME_PORT, RunContainerMessages.getString("RunContainerPreferencePage.Port"), //$NON-NLS-1$
compositeServerBody);
addField(portFieldEditor);
serverFieldEditors.add(portFieldEditor);
StringFieldEditor jmxPortFieldEditor = new StringFieldEditor(RunContainerPreferenceInitializer.P_ESB_RUNTIME_JMX_PORT, RunContainerMessages.getString("RunContainerPreferencePage.JMXPort"), //$NON-NLS-1$
compositeServerBody);
addField(jmxPortFieldEditor);
serverFieldEditors.add(jmxPortFieldEditor);
Composite compBtn = new Composite(groupServer, SWT.NONE);
GridData gridDataBtn = new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1);
gridDataBtn.widthHint = 100;
compBtn.setLayoutData(gridDataBtn);
GridLayout layoutCompBtn = new GridLayout(1, false);
layoutCompBtn.marginWidth = 0;
layoutCompBtn.marginHeight = 0;
compBtn.setLayout(layoutCompBtn);
buttonAddServer = new Button(compBtn, SWT.NONE);
buttonAddServer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
buttonAddServer.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
AddRuntimeWizard dirWizard = new AddRuntimeWizard(locationEditor.getStringValue());
dirWizard.setNeedsProgressMonitor(true);
WizardDialog wizardDialog = new WizardDialog(getShell(), dirWizard);
if (wizardDialog.open() == Window.OK) {
locationEditor.setStringValue(dirWizard.getTarget());
}
}
});
//$NON-NLS-1$
buttonAddServer.setText(RunContainerMessages.getString("RunContainerPreferencePage.ServerButton"));
// Button btnTestConnection = new Button(compBtn, SWT.NONE);
// btnTestConnection.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
// btnTestConnection.setText("Server Info...");
buttonInitalizeServer = new Button(compBtn, SWT.NONE);
buttonInitalizeServer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
//$NON-NLS-1$
buttonInitalizeServer.setText(RunContainerMessages.getString("RunContainerPreferencePage.InitalizeButton"));
buttonInitalizeServer.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (initalizeRuntime(locationEditor.getStringValue(), hostFieldEditor.getStringValue())) {
try {
new InitFinishMessageDialog(getShell(), JMXUtil.getBundlesName()).open();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
});
Group groupOption = new Group(body, SWT.NONE);
groupOption.setLayout(gridLayoutDefault);
groupOption.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
//$NON-NLS-1$
groupOption.setText(RunContainerMessages.getString("RunContainerPreferencePage.Group2"));
compositeOptionBody = new Composite(groupOption, SWT.NONE);
compositeOptionBody.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
BooleanFieldEditor filterLogEditor = new BooleanFieldEditor(RunContainerPreferenceInitializer.P_ESB_RUNTIME_SYS_LOG, RunContainerMessages.getString("RunContainerPreferencePage.FilterLogs"), //$NON-NLS-1$
compositeOptionBody);
addField(filterLogEditor);
optionFieldEditors.add(filterLogEditor);
manager = ProcessManager.getInstance();
return body;
}
Aggregations