Search in sources :

Example 1 with InitFinishMessageDialog

use of org.talend.designer.esb.runcontainer.ui.dialog.InitFinishMessageDialog 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;
}
Also used : IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) FieldEditor(org.eclipse.jface.preference.FieldEditor) StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) InitFinishMessageDialog(org.talend.designer.esb.runcontainer.ui.dialog.InitFinishMessageDialog) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) InvocationTargetException(java.lang.reflect.InvocationTargetException) IOException(java.io.IOException) StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) AddRuntimeWizard(org.talend.designer.esb.runcontainer.ui.wizard.AddRuntimeWizard) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 BooleanFieldEditor (org.eclipse.jface.preference.BooleanFieldEditor)1 FieldEditor (org.eclipse.jface.preference.FieldEditor)1 IntegerFieldEditor (org.eclipse.jface.preference.IntegerFieldEditor)1 StringFieldEditor (org.eclipse.jface.preference.StringFieldEditor)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 Group (org.eclipse.swt.widgets.Group)1 Label (org.eclipse.swt.widgets.Label)1 InitFinishMessageDialog (org.talend.designer.esb.runcontainer.ui.dialog.InitFinishMessageDialog)1 AddRuntimeWizard (org.talend.designer.esb.runcontainer.ui.wizard.AddRuntimeWizard)1