in plugins/org.apache.karaf.eik.ui/src/main/java/org/apache/karaf/eik/ui/KarafConfigurationTab.java [565:647]
private void createConsoleBlock(final Composite parent) {
final Composite comp = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, true);
comp.setLayout(layout);
comp.setFont(parent.getFont());
final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
comp.setLayoutData(gd);
final Group group = new Group(comp, SWT.NONE);
layout = new GridLayout(1, false);
group.setLayout(layout);
group.setLayoutData(new GridData(GridData.FILL_BOTH));
group.setText("Console");
localConsole = createCheckButton(group, "Local console");
localConsole.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(final SelectionEvent e) {
scheduleUpdateJob();
}
@Override
public void widgetSelected(final SelectionEvent e) {
scheduleUpdateJob();
}
});
final KeyListener keyListener = new KeyListener() {
@Override
public void keyPressed(final KeyEvent e) {
scheduleUpdateJob();
}
@Override
public void keyReleased(final KeyEvent e) {
scheduleUpdateJob();
}
};
remoteConsole = createCheckButton(group, "Remote console");
final Composite credentialsBlock = new Composite(group, SWT.NONE);
credentialsBlock.setLayout(new GridLayout(2, true));
Label l = new Label(credentialsBlock, SWT.NONE);
l.setText("Username");
remoteConsoleUsername = new Text(credentialsBlock, SWT.BORDER);
remoteConsoleUsername.setText("karaf");
remoteConsoleUsername.setLayoutData(new GridData(175, 20));
remoteConsoleUsername.addKeyListener(keyListener);
l = new Label(credentialsBlock, SWT.NONE);
l.setText("Password");
remoteConsolePassword = new Text(credentialsBlock, SWT.BORDER|SWT.PASSWORD);
remoteConsolePassword.setText("karaf");
remoteConsolePassword.setLayoutData(new GridData(175, 20));
remoteConsolePassword.addKeyListener(keyListener);
remoteConsole.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(final SelectionEvent e) {
updateRemoteConsoleControls();
}
@Override
public void widgetSelected(final SelectionEvent e) {
updateRemoteConsoleControls();
}
private void updateRemoteConsoleControls() {
final boolean enable = remoteConsole.getSelection();
remoteConsoleUsername.setEnabled(enable);
remoteConsolePassword.setEnabled(enable);
scheduleUpdateJob();
}
});
}