private boolean customize(Object value) { final Object userObject = ((DefaultMutableTreeNode) value).getUserObject(); if (!(userObject instanceof TreeElementWrapper)) { return false; } final TreeElement treeElement = ((TreeElementWrapper) userObject).getValue(); if (treeElement == null) { return false; } final ItemPresentation presentation = treeElement.getPresentation(); if (presentation instanceof TextAttributesPresentation) { final TextAttributesPresentation textAttributesPresentation = (TextAttributesPresentation) presentation; final String text = textAttributesPresentation.getPresentableText(); if (text != null) { final SimpleTextAttributes attr = SimpleTextAttributes.fromTextAttributes( textAttributesPresentation.getTextAttributes(getColorsScheme())); append( text, new SimpleTextAttributes( attr.getBgColor(), attr.getFgColor(), attr.getWaveColor(), attr.getStyle() | SimpleTextAttributes.STYLE_OPAQUE)); return true; } } return false; }
@Override protected void renderRawValue(@NotNull String value, @NotNull TextAttributesKey key) { TextAttributes textAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(key); SimpleTextAttributes attributes = SimpleTextAttributes.fromTextAttributes(textAttributes); myText.append(value, attributes); }
@Override protected boolean customizeNonPsiElementLeftRenderer( ColoredListCellRenderer renderer, JList list, Object value, int index, boolean selected, boolean hasFocus) { if (!(value instanceof NavigationItem)) return false; NavigationItem item = (NavigationItem) value; TextAttributes attributes = getNavigationItemAttributes(item); SimpleTextAttributes nameAttributes = attributes != null ? SimpleTextAttributes.fromTextAttributes(attributes) : null; Color color = list.getForeground(); if (nameAttributes == null) nameAttributes = new SimpleTextAttributes(Font.PLAIN, color); renderer.append(item + " ", nameAttributes); ItemPresentation itemPresentation = item.getPresentation(); assert itemPresentation != null; renderer.setIcon(itemPresentation.getIcon(true)); String locationString = itemPresentation.getLocationString(); if (!StringUtil.isEmpty(locationString)) { renderer.append(locationString, new SimpleTextAttributes(Font.PLAIN, JBColor.GRAY)); } return true; }
@Override public void renderStringValue( @NotNull String value, @Nullable String additionalSpecialCharsToHighlight, int maxLength) { TextAttributes textAttributes = DebuggerUIUtil.getColorScheme().getAttributes(DefaultLanguageHighlighterColors.STRING); SimpleTextAttributes attributes = SimpleTextAttributes.fromTextAttributes(textAttributes); myText.append("\"", attributes); XValuePresentationUtil.renderValue( value, myText, attributes, maxLength, additionalSpecialCharsToHighlight); myText.append("\"", attributes); }
protected void customizeCellRenderer( JList list, Object value, int index, boolean selected, boolean hasFocus) { if (value instanceof VirtualFile) { VirtualFile virtualfile = (VirtualFile) value; String fileName = virtualfile.getName(); setIcon(IconUtilEx.getIcon(virtualfile, 2, project)); FileStatus filestatus = FileStatusManager.getInstance(project).getStatus(virtualfile); TextAttributes textattributes = new TextAttributes(filestatus.getColor(), null, null, EffectType.LINE_UNDERSCORE, 0); append(fileName, SimpleTextAttributes.fromTextAttributes(textattributes)); } }
@Override protected void renderRawValue(@NotNull String value, @NotNull TextAttributesKey key) { TextAttributes textAttributes = DebuggerUIUtil.getColorScheme().getAttributes(key); SimpleTextAttributes attributes = SimpleTextAttributes.fromTextAttributes(textAttributes); myText.append(value, attributes); }