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));
}
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();
}
});
}
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();
}
}
});
}
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());
}
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;
}
Aggregations