use of org.eclipse.jface.layout.GridDataFactory in project translationstudio8 by heartsome.
the class MultiCellEditDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite panel = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, true).applyTo(panel);
GridLayout panelLayout = new GridLayout(allowIncrementDecrement ? 2 : 1, false);
panel.setLayout(panelLayout);
if (allowIncrementDecrement) {
createUpdateCombo(panel);
}
ActiveCellEditor.close();
ActiveCellEditor.activate(cellEditor, panel, originalCanonicalValue, initialEditValue, dataTypeConverter, cellStyle, dataValidator, new MultiEditHandler(), 0, 0, 0, 0);
Control editorControl = ActiveCellEditor.getControl();
// propagate the ESC event from the editor to the dialog
editorControl.addKeyListener(getEscKeyListener());
final GridDataFactory layoutData = GridDataFactory.fillDefaults().grab(true, false).hint(100, 20);
if (allowIncrementDecrement) {
layoutData.indent(5, 0);
}
layoutData.applyTo(editorControl);
return panel;
}
use of org.eclipse.jface.layout.GridDataFactory 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