Search in sources :

Example 1 with GridDataFactory

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;
}
Also used : GridDataFactory(org.eclipse.jface.layout.GridDataFactory) GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite)

Example 2 with GridDataFactory

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);
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) SlingLaunchpadCombo(org.apache.sling.ide.eclipse.ui.internal.SlingLaunchpadCombo) KeyEvent(org.eclipse.swt.events.KeyEvent) GridDataFactory(org.eclipse.jface.layout.GridDataFactory) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) KeyListener(org.eclipse.swt.events.KeyListener)

Aggregations

GridDataFactory (org.eclipse.jface.layout.GridDataFactory)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 SlingLaunchpadCombo (org.apache.sling.ide.eclipse.ui.internal.SlingLaunchpadCombo)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 KeyEvent (org.eclipse.swt.events.KeyEvent)1 KeyListener (org.eclipse.swt.events.KeyListener)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 Button (org.eclipse.swt.widgets.Button)1 Control (org.eclipse.swt.widgets.Control)1 Label (org.eclipse.swt.widgets.Label)1