use of org.eclipse.ui.model.WorkbenchLabelProvider in project yamcs-studio by yamcs.
the class OPIColorDialog method createPredefinedColorsTableViewer.
/**
* Creates and configures a {@link TableViewer}.
*
* @param parent
* The parent for the table
* @return The {@link TableViewer}
*/
private TableViewer createPredefinedColorsTableViewer(final Composite parent) {
TableViewer viewer = new TableViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.SINGLE);
viewer.setContentProvider(new BaseWorkbenchContentProvider() {
@Override
public Object[] getElements(final Object element) {
return (Object[]) element;
}
});
viewer.setLabelProvider(new WorkbenchLabelProvider());
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(final SelectionChangedEvent event) {
refreshGUIOnSelection();
}
});
viewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
MenuManager menuManager = new MenuManager();
menuManager.add(new ReloadColorFileAction());
viewer.getTable().setMenu(menuManager.createContextMenu(viewer.getTable()));
viewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
okPressed();
}
});
return viewer;
}
Aggregations