@Override public Image getImage(Object element) { Image image = super.getImage(element); if (this.decorator == null) { return image; } Image decorated = null; if (this.decorator instanceof LabelDecorator) { decorated = ((LabelDecorator) this.decorator).decorateImage(image, element, getDecorationContext()); } else { decorated = this.decorator.decorateImage(image, element); } if (decorated != null) return decorated; return image; }
private boolean waitForPendingDecoration(ViewerCell cell) { if (this.decorator == null) return false; Object element = cell.getElement(); String oldText = cell.getText(); boolean isDecorationPending = false; if (this.decorator instanceof LabelDecorator) { isDecorationPending = !((LabelDecorator) this.decorator) .prepareDecoration(element, oldText, getDecorationContext()); } else if (this.decorator instanceof IDelayedLabelDecorator) { isDecorationPending = !((IDelayedLabelDecorator) this.decorator) .prepareDecoration(element, oldText); } if (isDecorationPending && oldText.length() == 0) { // item is empty: is shown for the first time: don't wait return false; } return isDecorationPending; }
@Override public Image getImage(Object element) { Image image = super.getImage(element); if (this.decorator == null) { return image; } Image decorated = null; if (this.decorator instanceof LabelDecorator) { decorated = ((LabelDecorator) this.decorator).decorateImage(image, element, getDecorationContext()); } else { decorated = this.decorator.decorateImage(image, element); } if (decorated != null) return decorated; return image; }
private boolean waitForPendingDecoration(ViewerCell cell) { if (this.decorator == null) return false; Object element = cell.getElement(); String oldText = cell.getText(); boolean isDecorationPending = false; if (this.decorator instanceof LabelDecorator) { isDecorationPending = !((LabelDecorator) this.decorator) .prepareDecoration(element, oldText, getDecorationContext()); } else if (this.decorator instanceof IDelayedLabelDecorator) { isDecorationPending = !((IDelayedLabelDecorator) this.decorator) .prepareDecoration(element, oldText); } if (isDecorationPending && oldText.length() == 0) { // item is empty: is shown for the first time: don't wait return false; } return isDecorationPending; }
/** * Returns the styled text for the label of the given element. * * @param element * the element for which to provide the styled label text * @return the styled text string used to label the element */ @Override protected StyledString getStyledText(Object element) { StyledString styledString = super.getStyledText(element); if (this.decorator == null) { return styledString; } String label = styledString.getString(); String decorated; if (this.decorator instanceof LabelDecorator) { decorated = ((LabelDecorator) this.decorator).decorateText(label, element, getDecorationContext()); } else { decorated = this.decorator.decorateText(label, element); } if (decorated == null) return styledString; Styler style = getDecorationStyle(element); return StyledCellLabelProvider.styleDecoratedString(decorated, style, styledString); }
/** * Returns the styled text for the label of the given element. * * @param element * the element for which to provide the styled label text * @return the styled text string used to label the element */ @Override protected StyledString getStyledText(Object element) { StyledString styledString = super.getStyledText(element); if (this.decorator == null) { return styledString; } String label = styledString.getString(); String decorated; if (this.decorator instanceof LabelDecorator) { decorated = ((LabelDecorator) this.decorator).decorateText(label, element, getDecorationContext()); } else { decorated = this.decorator.decorateText(label, element); } if (decorated == null) return styledString; Styler style = getDecorationStyle(element); return StyledCellLabelProvider.styleDecoratedString(decorated, style, styledString); }