in plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorKarafShellSection.java [55:188]
public void createSection(Composite parent) {
super.createSection(parent);
FormToolkit toolkit = getFormToolkit(parent.getDisplay());
Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE
| ExpandableComposite.EXPANDED
| ExpandableComposite.TITLE_BAR
| Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
section.setText(Messages.editorSectionKarafShellTitle);
section.setDescription(Messages.editorSectionKarafShellDescription);
section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
Composite composite = toolkit.createComposite(section);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.marginHeight = 5;
layout.marginWidth = 10;
layout.verticalSpacing = 5;
layout.horizontalSpacing = 15;
composite.setLayout(layout);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
section.setClient(composite);
Composite subComp0 = toolkit.createComposite(composite);
layout = new GridLayout();
layout.numColumns = 1;
layout.marginHeight = 5;
layout.marginWidth = 10;
layout.verticalSpacing = 5;
layout.horizontalSpacing = 15;
subComp0.setLayout(layout);
subComp0.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
Composite subComp1 = toolkit.createComposite(composite);
layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 5;
layout.marginWidth = 10;
layout.verticalSpacing = 5;
layout.horizontalSpacing = 15;
subComp1.setLayout(layout);
subComp1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
enable = toolkit.createButton(subComp0, Messages.enableKarafShell, SWT.CHECK);
final GeronimoServerDelegate gsdCopy = (GeronimoServerDelegate) server.getAdapter(GeronimoServerDelegate.class);
boolean karafShell = gsdCopy.isKarafShell();
enable.setSelection(karafShell);
enable.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
int serverState = server.getOriginal().getServerState();
if(serverState != IServer.STATE_STOPPED && serverState != IServer.STATE_STOPPING) {
if(MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), Messages.karafShellChangeEnableProblem,
Messages.karafShellMustChangeBeforeServerStart + "\r\n\r\n" + Messages.wantToContinue)) {
executeAndEnableWidgets();
} else {
enable.setSelection(! enable.getSelection());
}
} else {
executeAndEnableWidgets();
}
}
public void widgetDefaultSelected(SelectionEvent e) {
}
private void executeAndEnableWidgets() {
if (enable.getData() == null) {
execute(new CheckSetPropertyCommand(server, "KarafShell", enable));
} else {
enable.setData(null);
}
timeout.setEnabled(enable.getSelection());
keepAlive.setEnabled(enable.getSelection());
port.setEnabled(enable.getSelection());
}
});
// create timeout field
createLabel(subComp1, Messages.karafShellTimeout, toolkit);
timeout = toolkit.createText(subComp1, Integer.toString(gsdCopy.getKarafShellTimeout()), SWT.BORDER);
timeout.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
timeout.setToolTipText(Messages.karafShellTimeout);
timeout.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (timeout.getData() == null) {
int value = Integer.parseInt(timeout.getText());
execute(new TextSetPropertyCommand(server, "KarafShellTimeout", int.class, value, timeout));
} else {
timeout.setData(null);
}
}
});
timeout.addVerifyListener(new NumericVerifyListener());
// create keep alive field
createLabel(subComp1, Messages.karafShellkeepAlive, toolkit);
keepAlive = toolkit.createText(subComp1, Integer.toString(gsdCopy.getKarafShellKeepAlive()), SWT.BORDER);
keepAlive.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
keepAlive.setToolTipText(Messages.karafShellkeepAlive);
keepAlive.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (keepAlive.getData() == null) {
int value = Integer.parseInt(keepAlive.getText());
execute(new TextSetPropertyCommand(server, "KarafShellKeepAlive", int.class, value, keepAlive));
} else {
keepAlive.setData(null);
}
}
});
keepAlive.addVerifyListener(new NumericVerifyListener());
// create port field
createLabel(subComp1, Messages.karafShellPort, toolkit);
port = toolkit.createText(subComp1, Integer.toString(gsdCopy.getKarafShellPort()), SWT.BORDER);
port.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
port.setToolTipText(Messages.karafShellPort);
port.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (port.getData() == null) {
int value = Integer.parseInt(port.getText());
execute(new TextSetPropertyCommand(server, "KarafShellPort", int.class, value, port));
} else {
port.setData(null);
}
}
});
port.addVerifyListener(new NumericVerifyListener());
}