@Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { final ErrorTreeElement element = getElement(value); if (element != null) { final CustomizeColoredTreeCellRenderer leftSelfRenderer = element.getLeftSelfRenderer(); final CustomizeColoredTreeCellRenderer rightSelfRenderer = element.getRightSelfRenderer(); if (leftSelfRenderer != null || rightSelfRenderer != null) { myColoredTreeCellRenderer.setCurrentCallback(leftSelfRenderer); myRightCellRenderer.setCurrentCallback(rightSelfRenderer); return myWrapperRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); } } return super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); }
public FixedHotfixGroupElement(String name, Object data, VirtualFile file) { super(name, data, file); myCustomizeColoredTreeCellRenderer = new CustomizeColoredTreeCellRenderer() { public void customizeCellRenderer(SimpleColoredComponent renderer, JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { renderer.setIcon(AllIcons.General.Information); renderer.append("Fixed: ", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES); final String[] text = getText(); final String checkedText = ((text != null) && (text.length > 0)) ? text[0] : ""; renderer.append(checkedText, SimpleTextAttributes.REGULAR_ATTRIBUTES); } }; }
public HotfixGroupElement(final String name, final Object data, final VirtualFile file, final Consumer<HotfixGate> hotfix, final String fixDescription, final MutableErrorTreeView view) { super(name, data, file); myHotfix = hotfix; myFixDescription = fixDescription; myView = view; myLeftTreeCellRenderer = new CustomizeColoredTreeCellRenderer() { public void customizeCellRenderer(SimpleColoredComponent renderer, JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { renderer.setIcon(AllIcons.General.Error); final String[] text = getText(); final String errorText = ((text != null) && (text.length > 0)) ? text[0] : ""; renderer.append("Error: " + errorText, SimpleTextAttributes.REGULAR_ATTRIBUTES); } }; myRightTreeCellRenderer = new MyRightRenderer(); }
private MyNavigatableWithDataElement(final Project project, @NotNull ErrorTreeElementKind kind, GroupingElement parent, String[] message, @NotNull final VirtualFile vf, String exportText, String rendererTextPrefix) { super(kind, parent, message, new OpenFileDescriptor(project, vf, -1, -1), exportText, rendererTextPrefix); myVf = vf; myCustomizeColoredTreeCellRenderer = new CustomizeColoredTreeCellRenderer() { @Override public void customizeCellRenderer(SimpleColoredComponent renderer, JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { final Icon icon = myVf.getFileType().getIcon(); renderer.setIcon(icon); final String[] messages = getText(); final String text = messages == null || messages.length == 0 ? vf.getPath() : messages[0]; renderer.append(text); } }; }
@Override public Component getTreeCellEditorComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row) { final ErrorTreeElement element = getElement(value); if (element instanceof EditableMessageElement) { EditableMessageElement editableMessageElement = (EditableMessageElement)element; final CustomizeColoredTreeCellRenderer leftSelfRenderer = editableMessageElement.getLeftSelfRenderer(); final TreeCellEditor rightSelfEditor = editableMessageElement.getRightSelfEditor(); myColoredTreeCellRenderer.setCurrentCallback(leftSelfRenderer); myRightCellRenderer.setCurrentCallback(rightSelfEditor); return myWrapperEditor.getTreeCellEditorComponent(tree, value, selected, expanded, leaf, row); } return myTree.getCellRenderer().getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, true); }
private MyNavigatableWithDataElement(final Project project, @Nonnull ErrorTreeElementKind kind, GroupingElement parent, String[] message, @Nonnull final VirtualFile vf, String exportText, String rendererTextPrefix) { super(kind, parent, message, new OpenFileDescriptor(project, vf, -1, -1), exportText, rendererTextPrefix); myVf = vf; myCustomizeColoredTreeCellRenderer = new CustomizeColoredTreeCellRenderer() { @Override public void customizeCellRenderer(SimpleColoredComponent renderer, JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { final Icon icon = myVf.getFileType().getIcon(); renderer.setIcon(icon); final String[] messages = getText(); final String text = messages == null || messages.length == 0 ? vf.getPath() : messages[0]; renderer.append(text); } }; }
@Nullable @Override public CustomizeColoredTreeCellRenderer getRightSelfRenderer() { return myRightTreeCellRenderer; }
@Nullable @Override public CustomizeColoredTreeCellRenderer getLeftSelfRenderer() { return myLeftTreeCellRenderer; }
public void setCurrentCallback(final CustomizeColoredTreeCellRenderer currentCallback) { myCurrentCallback = currentCallback; }
@Nullable CustomizeColoredTreeCellRenderer getLeftSelfRenderer();
@Override public CustomizeColoredTreeCellRenderer getLeftSelfRenderer() { return myCustomizeColoredTreeCellRenderer; }
@Override public CustomizeColoredTreeCellRenderer getLeftSelfRenderer() { return myLeftTreeCellRenderer; }
@Override public CustomizeColoredTreeCellRenderer getRightSelfRenderer() { return myRightTreeCellRenderer; }
@Nullable public CustomizeColoredTreeCellRenderer getLeftSelfRenderer() { return null; }
@Nullable public CustomizeColoredTreeCellRenderer getRightSelfRenderer() { return null; }
@javax.annotation.Nullable @Override public CustomizeColoredTreeCellRenderer getRightSelfRenderer() { return myRightTreeCellRenderer; }
@javax.annotation.Nullable @Override public CustomizeColoredTreeCellRenderer getLeftSelfRenderer() { return myLeftTreeCellRenderer; }