Search in sources :

Example 66 with ArrayContentProvider

use of org.eclipse.jface.viewers.ArrayContentProvider in project translationstudio8 by heartsome.

the class ConverterUtil method bindValue.

/**
	 * 对下拉列表和转换器列表进行绑定
	 * @param context
	 * @param comboViewer
	 * @param model
	 *            ;
	 */
public static void bindValue(DataBindingContext context, ComboViewer comboViewer, ConverterViewModel model) {
    // ViewerSupport.bind(comboViewer, BeansObservables.observeList(
    // model, "supportTypes", String.class),
    // Properties.selfValue(String.class));
    //		
    //
    // context.bindValue(ViewersObservables
    // .observeSingleSelection(comboViewer), BeansObservables
    // .observeValue(model,
    // "selectedType"));
    // ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider();
    comboViewer.setContentProvider(new ArrayContentProvider());
    comboViewer.setComparator(new ViewerComparator());
    // IObservableMap[] attributeMaps = BeansObservables.observeMaps(
    // viewerContentProvider.getKnownElements(),
    // ConverterBean.class, new String[] { "description" });
    // comboViewer.setLabelProvider(new ObservableMapLabelProvider(
    // attributeMaps));
    // comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class));
    comboViewer.setInput(model.getSupportTypes());
    IViewerObservableValue selection = ViewersObservables.observeSingleSelection(comboViewer);
    IObservableValue observableValue = BeansObservables.observeDetailValue(selection, PROPERTIES_NAME, null);
    context.bindValue(observableValue, BeansObservables.observeValue(model, PROPERTIES_SELECTED_TYPE));
}
Also used : ViewerComparator(org.eclipse.jface.viewers.ViewerComparator) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) IObservableValue(org.eclipse.core.databinding.observable.value.IObservableValue) IViewerObservableValue(org.eclipse.jface.databinding.viewers.IViewerObservableValue)

Example 67 with ArrayContentProvider

use of org.eclipse.jface.viewers.ArrayContentProvider 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 68 with ArrayContentProvider

use of org.eclipse.jface.viewers.ArrayContentProvider 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 69 with ArrayContentProvider

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

the class ConfigureColumnsDialog method createColumnsViewer.

/**
     * Creates the columns viewer.
     * 
     * @param parent The parent composite
     */
private void createColumnsViewer(Composite parent) {
    Label label = new Label(parent, SWT.NONE);
    label.setText(Messages.configureColumnsMessage);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    label.setLayoutData(gridData);
    columnsViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    columnsViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
    columnsViewer.setLabelProvider(new LabelProvider());
    columnsViewer.setContentProvider(new ArrayContentProvider());
}
Also used : Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Example 70 with ArrayContentProvider

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

the class SaveChartSetAsDialog method createChartSetViewer.

/**
     * Creates the chart set viewer.
     * 
     * @param parent The parent composite
     * @return The chart set viewer
     */
private TableViewer createChartSetViewer(Composite parent) {
    TableViewer viewer = new TableViewer(parent, SWT.BORDER | SWT.FULL_SELECTION);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.heightHint = 300;
    viewer.getTable().setLayoutData(gridData);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new LabelProvider());
    viewer.setInput(chartSets.toArray(new String[chartSets.size()]));
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            if (ignoreSelection) {
                return;
            }
            ISelection selection = event.getSelection();
            if (selection instanceof StructuredSelection) {
                Object element = ((StructuredSelection) selection).getFirstElement();
                if (element != null) {
                    chartSetText.setText(element.toString());
                    deleteButton.setEnabled(true);
                }
            }
        }
    });
    return viewer;
}
Also used : ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Aggregations

ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)92 GridData (org.eclipse.swt.layout.GridData)67 Composite (org.eclipse.swt.widgets.Composite)59 TableViewer (org.eclipse.jface.viewers.TableViewer)56 SelectionEvent (org.eclipse.swt.events.SelectionEvent)45 Table (org.eclipse.swt.widgets.Table)43 GridLayout (org.eclipse.swt.layout.GridLayout)41 Button (org.eclipse.swt.widgets.Button)37 Label (org.eclipse.swt.widgets.Label)36 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)32 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)32 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)30 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)30 Group (org.eclipse.swt.widgets.Group)23 ComboViewer (org.eclipse.jface.viewers.ComboViewer)21 TableColumn (org.eclipse.swt.widgets.TableColumn)21 LabelProvider (org.eclipse.jface.viewers.LabelProvider)19 Combo (org.eclipse.swt.widgets.Combo)19 Text (org.eclipse.swt.widgets.Text)19 Point (org.eclipse.swt.graphics.Point)18