use of org.eclipse.jface.viewers.LabelProvider in project tdi-studio-se by Talend.
the class HL7MultiSchemaUI method createCombo.
@Override
protected void createCombo(Composite parent) {
createLabel(parent);
metaTableViewer = new ComboViewer(parent, SWT.NONE);
metaTableViewer.setContentProvider(new ArrayContentProvider());
metaTableViewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof SegmentModel) {
return ((SegmentModel) element).getSeg().getName();
}
return super.getText(element);
}
});
final Combo combo = metaTableViewer.getCombo();
GridData data = new GridData();
data.widthHint = 60;
combo.setLayoutData(data);
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateCurrentMetadataTable();
linker.removeAllLinks();
linker.getMainui().redrawLinkers();
linker.getBackgroundRefresher().refreshBackground();
}
});
}
use of org.eclipse.jface.viewers.LabelProvider in project tdi-studio-se by Talend.
the class ImportItemWizardPage method createErrorsList.
private void createErrorsList(Composite workArea) {
Composite composite = new Composite(workArea, SWT.NONE);
GridLayout layout = new GridLayout();
layout.makeColumnsEqualWidth = false;
layout.marginWidth = 0;
composite.setLayout(layout);
GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
gridData.heightHint = 100;
composite.setLayoutData(gridData);
Label title = new Label(composite, SWT.NONE);
//$NON-NLS-1$
title.setText(Messages.getString("ImportItemWizardPage.ErrorsAndWarnings"));
title.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
errorsList = new TableViewer(composite, SWT.BORDER);
errorsList.getControl().setLayoutData(gridData);
errorsList.setContentProvider(new IStructuredContentProvider() {
@Override
public void dispose() {
}
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
@Override
public Object[] getElements(Object inputElement) {
return errors.toArray();
}
});
errorsList.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
return element.toString();
}
});
errorsList.setInput(this);
errorsList.setSorter(new ViewerSorter());
}
use of org.eclipse.jface.viewers.LabelProvider in project tdi-studio-se by Talend.
the class LoadChartSetDialog method createChartSetViewer.
/**
* Creates the chart set viewer.
*
* @param parent The parent composite
* @return The chart set viewer
*/
private TableViewer createChartSetViewer(Composite parent) {
final 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() {
@Override
public String getText(Object element) {
if (element.equals(defaultChartSet)) {
return NLS.bind(Messages.defaultChartSet, defaultChartSet);
}
return super.getText(element);
}
});
viewer.setInput(chartSets.toArray(new String[chartSets.size()]));
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
Object element = ((StructuredSelection) selection).getFirstElement();
if (deleteButton != null) {
deleteButton.setEnabled(!selection.isEmpty() && !predefinedChartSets.contains(element));
}
if (element != null) {
chartSet = element.toString();
} else {
viewer.setSelection(new StructuredSelection(chartSet));
}
}
});
viewer.setSelection(new StructuredSelection(defaultChartSet));
return viewer;
}
use of org.eclipse.jface.viewers.LabelProvider in project tesb-studio-se by Talend.
the class InitFinishMessageDialog method createMessageArea.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.IconAndMessageDialog#createMessageArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createMessageArea(Composite composite) {
// create image
Image image = getImage();
if (image != null) {
imageLabel = new Label(composite, SWT.NULL);
image.setBackground(imageLabel.getBackground());
imageLabel.setImage(image);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel);
}
Link link = new Link(composite, SWT.WRAP);
link.setText("Local runtime serview has been started, totally installed bundles: <a href=\"#\">" + bundlesName.length + "</a>.");
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ElementListSelectionDialog report = new ElementListSelectionDialog(getShell(), new LabelProvider());
report.setTitle("Installed bundles:");
report.setMessage("Search bundle (? = any character, * = any string):");
report.setElements(bundlesName);
report.open();
}
});
return composite;
}
use of org.eclipse.jface.viewers.LabelProvider in project translationstudio8 by heartsome.
the class NewTermDbBaseInfoPage method createControl.
/**
* Create contents of the wizard.
* @param parent
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
container.setLayout(new GridLayout(1, false));
setControl(container);
int labelWidth = 100;
GridData gdLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gdLabel.widthHint = labelWidth;
Group dbGroup1 = new Group(container, SWT.NONE);
dbGroup1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
dbGroup1.setLayout(new GridLayout(2, false));
dbGroup1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));
dbGroup1.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.dbGroup1"));
Label label = new Label(dbGroup1, SWT.RIGHT);
label.setLayoutData(gdLabel);
label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.lblType"));
dbTypeComboViewer = new ComboViewer(dbGroup1, SWT.READ_ONLY);
Combo combo = dbTypeComboViewer.getCombo();
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
// //
label = new Label(dbGroup1, SWT.RIGHT);
label.setLayoutData(gdLabel);
label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.dbNameText"));
dbNameText = new Text(dbGroup1, SWT.BORDER);
dbNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
label = new Label(dbGroup1, SWT.RIGHT);
label.setLayoutData(gdLabel);
label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.instanceText"));
instanceText = new Text(dbGroup1, SWT.BORDER);
instanceText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
dbTypeComboViewer.setContentProvider(new ArrayContentProvider());
dbTypeComboViewer.setInput(dbTypeList);
dbTypeComboViewer.setLabelProvider(new LabelProvider() {
public String getText(Object element) {
SystemDBOperator dbOp = (SystemDBOperator) element;
String dbType = dbOp.getDBConfig().getDefaultType();
if (dbType.equals(Constants.DBTYPE_MYSQL)) {
dbType = Constants.DBTYPE_MYSQL_FOR_UI;
} else if (dbType.equals(Constants.DBTYPE_MSSQL2005)) {
dbType = Constants.DBTYPE_MSSQL2005_FOR_UI;
} else if (dbType.equals(Constants.DBTYPE_SQLITE)) {
dbType = Messages.getString("tb.dbtype.sqlite");
}
return dbType;
}
});
dbTypeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
if (selection != null && selection instanceof IStructuredSelection) {
IStructuredSelection sel = (IStructuredSelection) selection;
Object selObj = sel.getFirstElement();
if (selObj != null && selObj instanceof SystemDBOperator) {
SystemDBOperator selDbOp = (SystemDBOperator) selObj;
dbTypeChangeEvent(selDbOp);
}
}
}
});
Group dbGroup = new Group(container, SWT.NONE);
dbGroup.setLayout(new GridLayout(5, false));
dbGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));
dbGroup.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.dbGroup"));
label = new Label(dbGroup, SWT.RIGHT);
label.setLayoutData(gdLabel);
label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.hostText"));
hostText = new Text(dbGroup, SWT.BORDER);
hostText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
label = new Label(dbGroup, SWT.RIGHT);
label.setLayoutData(gdLabel);
label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.portText"));
portText = new Text(dbGroup, SWT.BORDER);
new Label(dbGroup, SWT.NONE);
label = new Label(dbGroup, SWT.RIGHT);
label.setLayoutData(gdLabel);
label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.locationText"));
locationText = new Text(dbGroup, SWT.BORDER);
locationText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
locationText.setEnabled(false);
borwserBtn = new Button(dbGroup, SWT.NONE);
borwserBtn.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.borwserBtn"));
borwserBtn.setEnabled(false);
borwserBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
DirectoryDialog dlg = new DirectoryDialog(getShell());
String path = dlg.open();
if (path != null) {
locationText.setText(path);
}
}
});
Group authorityGroup = new Group(container, SWT.NONE);
authorityGroup.setLayout(new GridLayout(2, false));
authorityGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1));
authorityGroup.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.authorityGroup"));
label = new Label(authorityGroup, SWT.RIGHT);
label.setLayoutData(gdLabel);
label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.usernameText"));
usernameText = new Text(authorityGroup, SWT.BORDER);
usernameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
label = new Label(authorityGroup, SWT.RIGHT);
label.setLayoutData(gdLabel);
label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.passwordText"));
passwordText = new Text(authorityGroup, SWT.BORDER | SWT.PASSWORD);
passwordText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
initDataBindings();
if (this.dbOp != null) {
dbTypeComboViewer.setSelection(new StructuredSelection(this.dbOp));
} else {
dbTypeComboViewer.setSelection(new StructuredSelection(dbTypeList.get(0)));
}
IStatus state = validator();
if (!state.isOK()) {
setErrorMessage(state.getMessage());
setPageComplete(false);
}
}
Aggregations