diff --git a/openapi/src/com/intellij/ide/util/treeView/NodeRenderer.java b/openapi/src/com/intellij/ide/util/treeView/NodeRenderer.java index 78cef9cd80b9..12fa77ca74da 100644 --- a/openapi/src/com/intellij/ide/util/treeView/NodeRenderer.java +++ b/openapi/src/com/intellij/ide/util/treeView/NodeRenderer.java @@ -40,6 +40,7 @@ import com.intellij.navigation.ItemPresentation; import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; +import java.awt.*; public class NodeRenderer extends ColoredTreeCellRenderer { public void customizeCellRenderer(JTree tree, @@ -49,11 +50,13 @@ public class NodeRenderer extends ColoredTreeCellRenderer { boolean leaf, int row, boolean hasFocus) { + Color color = null; if (value instanceof DefaultMutableTreeNode) { DefaultMutableTreeNode node = (DefaultMutableTreeNode)value; Object userObject = node.getUserObject(); if (userObject instanceof NodeDescriptor) { NodeDescriptor descriptor = (NodeDescriptor)userObject; + color = descriptor.getColor(); if (expanded) { setIcon(descriptor.getOpenIcon()); } @@ -62,13 +65,19 @@ public class NodeRenderer extends ColoredTreeCellRenderer { } } } - String text = - tree.convertValueToText(value instanceof AbstractTreeNode - ? ((AbstractTreeNode)value).toString() - : value, - selected, expanded, leaf, row, hasFocus); + final Object valueToGetText = value instanceof AbstractTreeNode ? ((AbstractTreeNode)value).toString() : value; + String text = tree.convertValueToText(valueToGetText,selected, expanded, leaf, row, hasFocus); + if (text == null) text = ""; - append(text, getSimpleTextAttributes(value)); + + SimpleTextAttributes simpleTextAttributes = getSimpleTextAttributes(value); + if (color != null) { + final TextAttributes textAttributes = simpleTextAttributes.toTextAttributes(); + textAttributes.setForegroundColor(color); + simpleTextAttributes = SimpleTextAttributes.fromTextAttributes(textAttributes); + } + + append(text, simpleTextAttributes); if (value instanceof DefaultMutableTreeNode) { DefaultMutableTreeNode node = (DefaultMutableTreeNode)value; diff --git a/source/com/intellij/ide/CopyPasteManagerEx.java b/source/com/intellij/ide/CopyPasteManagerEx.java index 84fd9646dd44..d044c2ab86e1 100644 --- a/source/com/intellij/ide/CopyPasteManagerEx.java +++ b/source/com/intellij/ide/CopyPasteManagerEx.java @@ -194,7 +194,7 @@ public class CopyPasteManagerEx extends CopyPasteManager implements ClipboardOwn return; } for (int i = 0; i < elements.length; i++) { - if (RefactoringMessageUtil.checkReadOnlyStatusRecursively(myProject, elements[i])) return; + if (!RefactoringMessageUtil.checkReadOnlyStatusRecursively(myProject, elements[i])) return; } ((CopyPasteManagerEx)CopyPasteManager.getInstance()).setElements(elements, false); updateView();