@Override public void update(ViewerCell cell) { CeylonHierarchyNode n = (CeylonHierarchyNode) cell.getElement(); if (n.isMultiple()) { cell.setText("multiple supertypes" + getViewInterfacesShortcut()); cell.setStyleRanges(new StyleRange[0]); cell.setImage(MULTIPLE_TYPES_IMAGE); } else { StyledString styledText = getStyledText(n); cell.setText(styledText.toString()); cell.setStyleRanges(styledText.getStyleRanges()); cell.setImage(getImageForDeclaration(getDisplayedDeclaration(n), n.isFocus())); } super.update(cell); }
Declaration getDisplayedDeclaration(CeylonHierarchyNode node) { Declaration declaration = node.getDeclaration(); if (declaration != null && isShowingRefinements() && declaration.isClassOrInterfaceMember()) { declaration = (ClassOrInterface) declaration.getContainer(); } return declaration; }
private StyledString getStyledText(CeylonHierarchyNode n) { Declaration dec = getDisplayedDeclaration(n); if (dec == null) { return new StyledString(); } IPreferenceStore prefs = getPreferences(); StyledString result = getQualifiedDescriptionFor( dec, prefs.getBoolean(TYPE_PARAMS_IN_OUTLINES), prefs.getBoolean(PARAMS_IN_OUTLINES), prefs.getBoolean(PARAM_TYPES_IN_OUTLINES), prefs.getBoolean(RETURN_TYPES_IN_OUTLINES), getPrefix(), getFont()); /*if (d.isClassOrInterfaceMember()) { Declaration container = (Declaration) d.getContainer(); result.append(" in ") .append(container.getName(), Highlights.TYPE_ID_STYLER); }*/ result.append(" - ", PACKAGE_STYLER).append(getPackageLabel(dec), PACKAGE_STYLER); if (n.isNonUnique()) { result.append(" - and other supertypes").append(getViewInterfacesShortcut()); } return result; }