Search in sources :

Example 31 with ComboViewer

use of org.eclipse.jface.viewers.ComboViewer in project tdi-studio-se by Talend.

the class HL7OutputLinkUI method createCombo.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.hl7.ui.HL7UI#createCombo(org.eclipse.swt.widgets.Composite)
     */
@Override
protected void createCombo(Composite mainComposite) {
    metaTableViewer = new ComboViewer(mainComposite, SWT.NONE | SWT.READ_ONLY);
    metaTableViewer.setContentProvider(new ArrayContentProvider());
    metaTableViewer.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof IConnection) {
                return ((IConnection) element).getUniqueName();
            }
            return super.getText(element);
        }
    });
    List<? extends IConnection> incomingConnections = NodeUtil.getIncomingConnections(externalNode, IConnectionCategory.FLOW);
    metaTableViewer.setInput(incomingConnections);
    final Combo combo = metaTableViewer.getCombo();
    combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    combo.select(0);
    combo.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (hl7Manager != null) {
                ((HL7OutputManager) hl7Manager).setCurrentSchema(combo.getText());
            }
            IStructuredSelection selection = (IStructuredSelection) metaTableViewer.getSelection();
            Object obj = selection.getFirstElement();
            xmlViewer.refresh();
            xmlViewer.expandAll();
            schemaViewer.setInput(((IConnection) obj).getMetadataTable().getListColumns());
            initlinkers();
        }
    });
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) IConnection(org.talend.core.model.process.IConnection) Combo(org.eclipse.swt.widgets.Combo) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ComboViewer(org.eclipse.jface.viewers.ComboViewer) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Example 32 with ComboViewer

use of org.eclipse.jface.viewers.ComboViewer in project tdi-studio-se by Talend.

the class FOXMultiSchemaUI method createCombo.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.fileoutputxml.ui.FOXUI#createCombo(org.eclipse.swt.widgets.Composite)
     */
@Override
protected void createCombo(Composite parent) {
    metaTableViewer = new ComboViewer(parent, SWT.NONE);
    metaTableViewer.setContentProvider(new ArrayContentProvider());
    metaTableViewer.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof IConnection) {
                return ((IConnection) element).getUniqueName();
            }
            return super.getText(element);
        }
    });
    List<? extends IConnection> incomingConnections = NodeUtil.getIncomingConnections(externalNode, IConnectionCategory.FLOW);
    metaTableViewer.setInput(incomingConnections);
    final Combo combo = metaTableViewer.getCombo();
    combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    combo.select(0);
    combo.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) metaTableViewer.getSelection();
            Object obj = selection.getFirstElement();
            if (obj instanceof IConnection) {
                foxManager.setCurrentSchema(combo.getText());
                // xmlViewer.setInput(foxManager.getTreeData());
                xmlViewer.refresh();
                schemaViewer.setInput(((IConnection) obj).getMetadataTable().getListColumns());
                // record the schema
                // refreshXMLViewer(null);
                redrawLinkers();
            }
        }
    });
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) IConnection(org.talend.core.model.process.IConnection) Combo(org.eclipse.swt.widgets.Combo) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ComboViewer(org.eclipse.jface.viewers.ComboViewer) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Example 33 with ComboViewer

use of org.eclipse.jface.viewers.ComboViewer in project tdi-studio-se by Talend.

the class DeploymentComposite method createControl.

private void createControl() {
    setLayout(new GridLayout());
    setBackground(getParent().getBackground());
    Composite composite = new Composite(this, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.horizontalSpacing = 10;
    layout.verticalSpacing = 10;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    groupIdCheckbox = //$NON-NLS-1$
    widgetFactory.createButton(//$NON-NLS-1$
    composite, //$NON-NLS-1$
    Messages.getString("DeploymentComposite.gourpIdLabel"), SWT.CHECK);
    groupIdCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    groupIdText = new Text(composite, SWT.BORDER);
    GridData groupIdTextData = new GridData(GridData.FILL_HORIZONTAL);
    groupIdTextData.widthHint = 200;
    groupIdText.setLayoutData(groupIdTextData);
    versionCheckbox = //$NON-NLS-1$
    widgetFactory.createButton(//$NON-NLS-1$
    composite, //$NON-NLS-1$
    Messages.getString("DeploymentComposite.versionLabel"), SWT.CHECK);
    versionCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    versionText = new Text(composite, SWT.BORDER);
    GridData versionTextData = new GridData(GridData.FILL_HORIZONTAL);
    versionTextData.widthHint = 200;
    versionText.setLayoutData(versionTextData);
    //$NON-NLS-1$
    buildTypeLabel = widgetFactory.createLabel(composite, Messages.getString("DeploymentComposite.buildTypeLabel"));
    buildTypeLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    buildTypeCombo = new ComboViewer(widgetFactory.createCCombo(composite, SWT.READ_ONLY | SWT.BORDER));
    final Control buildTypeControl = buildTypeCombo.getControl();
    GridData buildTypeComboData = new GridData(GridData.FILL_HORIZONTAL);
    buildTypeComboData.widthHint = 200;
    buildTypeControl.setLayoutData(buildTypeComboData);
    buildTypeCombo.setContentProvider(ArrayContentProvider.getInstance());
    buildTypeCombo.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof BuildType) {
                return ((BuildType) element).getLabel();
            }
            return super.getText(element);
        }
    });
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) ComboViewer(org.eclipse.jface.viewers.ComboViewer) GridData(org.eclipse.swt.layout.GridData) BuildType(org.talend.core.runtime.repository.build.BuildType) Text(org.eclipse.swt.widgets.Text) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Example 34 with ComboViewer

use of org.eclipse.jface.viewers.ComboViewer in project bndtools by bndtools.

the class RunFrameworkPart method createSection.

final void createSection(Section section, FormToolkit tk) {
    section.setText("Core Runtime");
    Composite composite = tk.createComposite(section);
    section.setClient(composite);
    Label lblFramework = new Label(composite, SWT.NONE);
    tk.adapt(lblFramework, true, true);
    lblFramework.setText("OSGi Framework:");
    cmbFramework = new Combo(composite, SWT.DROP_DOWN);
    tk.adapt(cmbFramework);
    tk.paintBordersFor(cmbFramework);
    cmbFramework.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    frameworkViewer = new ComboViewer(cmbFramework);
    frameworkViewer.setUseHashlookup(true);
    frameworkViewer.setContentProvider(fwkContentProvider);
    Label lblExecEnv = tk.createLabel(composite, "Execution Env.:");
    cmbExecEnv = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    ControlDecoration eeDecor = new ControlDecoration(cmbExecEnv, SWT.LEFT | SWT.TOP, composite);
    eeDecor.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
    eeDecor.setDescriptionText("The runtime Java Virtual Machine will be required/assumed " + "\nto support this Execution Environment");
    eeViewer = new ComboViewer(cmbExecEnv);
    eeViewer.setContentProvider(ArrayContentProvider.getInstance());
    eeViewer.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            return ((EE) element).getEEName();
        }
    });
    eeViewer.setInput(EE.values());
    // Listeners
    cmbFramework.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            lock.ifNotModifying(new Runnable() {

                @Override
                public void run() {
                    markDirty();
                    selectedFramework = cmbFramework.getText();
                }
            });
        }
    });
    frameworkViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            lock.ifNotModifying(new Runnable() {

                @Override
                public void run() {
                    Object element = ((IStructuredSelection) frameworkViewer.getSelection()).getFirstElement();
                    if (element instanceof LoadingContentElement) {
                        return;
                    }
                    markDirty();
                    if (element == null)
                        selectedFramework = null;
                    else
                        selectedFramework = element.toString();
                }
            });
        }
    });
    eeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            lock.ifNotModifying(new Runnable() {

                @Override
                public void run() {
                    markDirty();
                    selectedEE = (EE) ((IStructuredSelection) event.getSelection()).getFirstElement();
                }
            });
        }
    });
    GridLayout layout = new GridLayout(2, false);
    layout.horizontalSpacing = 10;
    composite.setLayout(layout);
    lblFramework.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
    GridData gd;
    gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd.widthHint = 20;
    gd.heightHint = 20;
    cmbFramework.setLayoutData(gd);
    lblExecEnv.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
    gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd.widthHint = 20;
    gd.heightHint = 20;
    cmbExecEnv.setLayoutData(gd);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) LoadingContentElement(bndtools.model.repo.LoadingContentElement) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) ComboViewer(org.eclipse.jface.viewers.ComboViewer) GridData(org.eclipse.swt.layout.GridData) ControlDecoration(org.eclipse.jface.fieldassist.ControlDecoration) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Example 35 with ComboViewer

use of org.eclipse.jface.viewers.ComboViewer in project bndtools by bndtools.

the class NewDSComponentWizardPage method createLifecycleMethodStubControls.

protected void createLifecycleMethodStubControls(Composite composite, int nColumns) {
    fLifecycleMethodDialogField.doFillIntoGrid(composite, nColumns - 1);
    DialogField.createEmptySpace(composite);
    Combo cmbActivateStub = fLifecycleMethodDialogField.getComboControl(composite);
    vwrActivateStub = new ComboViewer(cmbActivateStub);
    vwrActivateStub.setContentProvider(ArrayContentProvider.getInstance());
    vwrActivateStub.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            return ((ActivateSignature) element).label;
        }
    });
    vwrActivateStub.setInput(EnumSet.allOf(ActivateSignature.class));
    vwrActivateStub.setSelection(new StructuredSelection(activateSignature), true);
    vwrActivateStub.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            ISelection sel = event.getSelection();
            if (!sel.isEmpty() && sel instanceof IStructuredSelection) {
                activateSignature = (ActivateSignature) ((IStructuredSelection) sel).getFirstElement();
            } else {
                activateSignature = ActivateSignature.NoActivate;
            }
            activateSignatureStatus = activateSignatureChanged();
            handleFieldChanged("activateSignature");
        }
    });
}
Also used : ComboViewer(org.eclipse.jface.viewers.ComboViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ISelection(org.eclipse.jface.viewers.ISelection) Combo(org.eclipse.swt.widgets.Combo) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Aggregations

ComboViewer (org.eclipse.jface.viewers.ComboViewer)46 Label (org.eclipse.swt.widgets.Label)33 GridData (org.eclipse.swt.layout.GridData)30 Composite (org.eclipse.swt.widgets.Composite)30 Combo (org.eclipse.swt.widgets.Combo)26 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)22 Button (org.eclipse.swt.widgets.Button)22 GridLayout (org.eclipse.swt.layout.GridLayout)21 Text (org.eclipse.swt.widgets.Text)21 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)18 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)18 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)17 SelectionEvent (org.eclipse.swt.events.SelectionEvent)15 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)13 LabelProvider (org.eclipse.jface.viewers.LabelProvider)12 Point (org.eclipse.swt.graphics.Point)11 Group (org.eclipse.swt.widgets.Group)11 Control (org.eclipse.swt.widgets.Control)10 ISelection (org.eclipse.jface.viewers.ISelection)8 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)8