use of eu.esdihumboldt.hale.ui.common.function.viewer.FunctionContentProvider in project hale by halestudio.
the class FunctionsView method createViewControl.
/**
* @see eu.esdihumboldt.hale.ui.views.properties.PropertiesViewPart#createViewControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createViewControl(Composite parent) {
viewer = new TreeViewer(parent);
viewer.setLabelProvider(new FunctionLabelProvider());
viewer.setContentProvider(new FunctionContentProvider(HaleUI.getServiceProvider()));
IToolBarManager manager = getViewSite().getActionBars().getToolBarManager();
IAction filterAction = new FilterAction("Filter incompatible functions", Action.AS_CHECK_BOX, CommonSharedImages.getImageRegistry().getDescriptor("IMG_FILTER_CLEAR"));
manager.add(filterAction);
filterAction.setChecked(true);
filterAction.run();
CompatibilityService cs = PlatformUI.getWorkbench().getService(CompatibilityService.class);
cs.addListener(compListener = new ExclusiveExtensionListener<CompatibilityMode, CompatibilityModeFactory>() {
@Override
public void currentObjectChanged(CompatibilityMode current, CompatibilityModeFactory definition) {
// refresh the viewer when the compatibility mode is
// changed
final Display display = PlatformUI.getWorkbench().getDisplay();
display.syncExec(new Runnable() {
@Override
public void run() {
viewer.refresh();
}
});
}
});
AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
as.addListener(alignListener = new AlignmentServiceAdapter() {
@Override
public void alignmentCleared() {
customFunctionsChanged();
}
@Override
public void customFunctionsChanged() {
// refresh the viewer when the compatibility mode is changed
final Display display = PlatformUI.getWorkbench().getDisplay();
display.syncExec(new Runnable() {
@Override
public void run() {
viewer.refresh();
}
});
}
});
// no input needed, but we have to set something
viewer.setInput(Boolean.TRUE);
new ViewerMenu(getSite(), viewer);
getSite().setSelectionProvider(viewer);
}
Aggregations