Search in sources :

Example 1 with AbstractRepositoryObject

use of org.knime.workbench.repository.model.AbstractRepositoryObject in project knime-core by knime.

the class RepositoryStyledLabelProvider method update.

@Override
public void update(final ViewerCell cell) {
    Object obj = cell.getElement();
    if (obj instanceof IRepositoryObject) {
        StyledString styledString = new StyledString(m_provider.getText(obj));
        if (m_appendCategory) {
            // receive the category string.
            String categoryString = getCategoryString((IRepositoryObject) obj);
            if (!categoryString.isEmpty()) {
                styledString.append(String.format("\t - %s", categoryString), StyledString.DECORATIONS_STYLER);
            }
        }
        if (m_appendAdditionalInfoKeys.length > 0) {
            if (obj instanceof AbstractRepositoryObject) {
                AbstractRepositoryObject aro = (AbstractRepositoryObject) obj;
                for (String key : m_appendAdditionalInfoKeys) {
                    if (aro.getAdditionalInfo(key) != null) {
                        styledString.append(String.format("\t [%s]", ((AbstractRepositoryObject) obj).getAdditionalInfo(key)), StyledString.QUALIFIER_STYLER);
                    }
                }
            }
        }
        cell.setText(styledString.toString());
        cell.setStyleRanges(styledString.getStyleRanges());
    } else {
        cell.setText(m_provider.getText(obj));
    }
    cell.setImage(m_provider.getImage(obj));
}
Also used : AbstractRepositoryObject(org.knime.workbench.repository.model.AbstractRepositoryObject) IRepositoryObject(org.knime.workbench.repository.model.IRepositoryObject) IContainerObject(org.knime.workbench.repository.model.IContainerObject) StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString) AbstractRepositoryObject(org.knime.workbench.repository.model.AbstractRepositoryObject) IRepositoryObject(org.knime.workbench.repository.model.IRepositoryObject)

Aggregations

StyledString (org.eclipse.jface.viewers.StyledString)1 AbstractRepositoryObject (org.knime.workbench.repository.model.AbstractRepositoryObject)1 IContainerObject (org.knime.workbench.repository.model.IContainerObject)1 IRepositoryObject (org.knime.workbench.repository.model.IRepositoryObject)1