use of org.apache.sling.ide.eclipse.ui.internal.SlingLaunchpadCombo in project sling by apache.
the class SetupServerWizardPage method createControl.
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
container.setLayout(layout);
layout.numColumns = 3;
layout.verticalSpacing = 9;
layout.marginBottom = 10;
GridDataFactory singleRowGridDataFactory = GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).span(layout.numColumns, 1);
useExistingServer = new Button(container, SWT.RADIO);
useExistingServer.setText("Add to existing server");
singleRowGridDataFactory.applyTo(useExistingServer);
Label existingServerLabel = new Label(container, SWT.NONE);
GridData locationLabelData = new GridData();
locationLabelData.horizontalIndent = HORIZONTAL_INDENT;
existingServerLabel.setLayoutData(locationLabelData);
existingServerLabel.setText("Location:");
existingServerLabel.setEnabled(true);
existingServerCombo = new SlingLaunchpadCombo(container, null);
existingServerCombo.getWidget().addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
dialogChanged();
}
});
existingServerCombo.refreshRepositoryList(new NullProgressMonitor());
existingServerCombo.getWidget().setEnabled(true);
{
startExistingServerButton = new Button(container, SWT.CHECK);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
gd.horizontalIndent = HORIZONTAL_INDENT;
startExistingServerButton.setLayoutData(gd);
startExistingServerButton.setText("Start server after project creation (if server not yet started).");
startExistingServerButton.setSelection(true);
}
skipServerConfiguration = new Button(container, SWT.RADIO);
skipServerConfiguration.setText("Don't deploy on a server");
singleRowGridDataFactory.applyTo(skipServerConfiguration);
setupNewServer = new Button(container, SWT.RADIO);
setupNewServer.setText("Setup new server");
singleRowGridDataFactory.applyTo(setupNewServer);
newLabel(container, "Server name:");
newServerName = newText(container);
newLabel(container, "Host name:");
newServerHostnameName = newText(container);
newServerHostnameName.setText("localhost");
newLabel(container, "Port:");
newServerPort = newText(container);
newServerPort.setText(Integer.toString(config.getPort()));
newLabel(container, "Username:");
newServerUsername = newText(container);
newServerUsername.setText(config.getUsername());
newLabel(container, "Password:");
newServerPassword = newText(container);
newServerPassword.setText(config.getPassword());
newLabel(container, "Debug Port:");
newServerDebugPort = newText(container);
newServerDebugPort.setText(Integer.toString(config.getDebugPort()));
SelectionAdapter radioListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateEnablements();
dialogChanged();
}
};
useExistingServer.addSelectionListener(radioListener);
setupNewServer.addSelectionListener(radioListener);
ModifyListener ml = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
dialogChanged();
}
};
KeyListener kl = new KeyListener() {
@Override
public void keyReleased(KeyEvent e) {
dialogChanged();
}
@Override
public void keyPressed(KeyEvent e) {
dialogChanged();
}
};
newServerName.addModifyListener(ml);
newServerName.addKeyListener(kl);
newServerHostnameName.addModifyListener(ml);
newServerHostnameName.addKeyListener(kl);
newServerPort.addModifyListener(ml);
newServerPort.addKeyListener(kl);
newServerDebugPort.addModifyListener(ml);
newServerDebugPort.addKeyListener(kl);
useExistingServer.setSelection(existingServerCombo.hasServers());
existingServerCombo.getWidget().setEnabled(existingServerCombo.hasServers());
startExistingServerButton.setEnabled(existingServerCombo.hasServers());
setupNewServer.setSelection(!existingServerCombo.hasServers());
updateEnablements();
setPageComplete(false);
setControl(container);
// allow the selection to proceed in case we have a preselected server
if (useExistingServer.getSelection()) {
if (existingServerCombo.getErrorMessage(SKIP_SERVER_STARTED) == null) {
updateStatus(null);
}
}
}
Aggregations