use of eu.esdihumboldt.cst.functions.groovy.helper.HelperFunction in project hale by halestudio.
the class HelperFunctionLabelProvider method update.
/**
* @see org.eclipse.jface.viewers.StyledCellLabelProvider#update(org.eclipse.jface.viewers.ViewerCell)
*/
@Override
public void update(ViewerCell cell) {
Object element = cell.getElement();
String elementName = null;
if (element instanceof Category) {
cell.setText(((Category) element).getName());
cell.setImage(CommonSharedImages.getImageRegistry().get(CommonSharedImagesConstants.IMG_DEFINITION_GROUP));
} else if (element instanceof HelperFunctionOrCategory) {
HelperFunctionSpecification hfs = null;
elementName = ((HelperFunctionOrCategory) element).getName();
StyledString text = new StyledString(elementName);
try {
HelperFunction<?> helper = ((HelperFunctionOrCategory) element).asFunction();
hfs = (HelperFunctionSpecification) helper.getSpec(elementName);
text.append(PageFunctions.getStyledParameters(hfs));
} catch (Exception e) {
//
}
cell.setText(text.getString());
cell.setImage(CommonSharedImages.getImageRegistry().get(CommonSharedImagesConstants.IMG_FUNCTION));
cell.setStyleRanges(text.getStyleRanges());
}
super.update(cell);
}
Aggregations