From 796e4a13009b03857c84843a1d7f80a72ddf93d4 Mon Sep 17 00:00:00 2001 From: Sergey Vasiliev Date: Thu, 30 Mar 2006 19:25:55 +0400 Subject: [PATCH] faces highlighting --- .../com/intellij/javaee/ui/forms/CaptionComponent.form | 2 +- .../xml/highlighting/DomElementAnnotationsManagerImpl.java | 2 +- .../util/xml/highlighting/DomElementsProblemsHolderImpl.java | 4 +--- source/com/intellij/util/xml/impl/InvocationCache.java | 9 ++++++--- source/com/intellij/util/xml/tree/BaseDomElementNode.java | 12 +++++++++--- source/com/intellij/util/xml/tree/DomModelTreeView.java | 2 +- .../src/jetbrains/fabrique/ui/treeStructure/SimpleNode.java | 6 +++++- 7 files changed, 24 insertions(+), 13 deletions(-) diff --git a/J2EE/openapi/com/intellij/javaee/ui/forms/CaptionComponent.form b/J2EE/openapi/com/intellij/javaee/ui/forms/CaptionComponent.form index c4c80da722..b50feab894 100644 --- a/J2EE/openapi/com/intellij/javaee/ui/forms/CaptionComponent.form +++ b/J2EE/openapi/com/intellij/javaee/ui/forms/CaptionComponent.form @@ -26,7 +26,7 @@ - + diff --git a/source/com/intellij/util/xml/highlighting/DomElementAnnotationsManagerImpl.java b/source/com/intellij/util/xml/highlighting/DomElementAnnotationsManagerImpl.java index 9e545b8fc7..daf4268932 100644 --- a/source/com/intellij/util/xml/highlighting/DomElementAnnotationsManagerImpl.java +++ b/source/com/intellij/util/xml/highlighting/DomElementAnnotationsManagerImpl.java @@ -24,7 +24,7 @@ public class DomElementAnnotationsManagerImpl extends DomElementAnnotationsManag private Map> myCache = new HashMap>(); public List getProblems(final DomElement domElement) { - if(myCache.get(domElement.getRoot()) == null) { + if(myCache.get(domElement.getRoot()) == null) { myCache.put(domElement.getRoot(), getCachedValue(domElement)); } diff --git a/source/com/intellij/util/xml/highlighting/DomElementsProblemsHolderImpl.java b/source/com/intellij/util/xml/highlighting/DomElementsProblemsHolderImpl.java index ffbd28dd22..29deb4ff82 100644 --- a/source/com/intellij/util/xml/highlighting/DomElementsProblemsHolderImpl.java +++ b/source/com/intellij/util/xml/highlighting/DomElementsProblemsHolderImpl.java @@ -23,10 +23,8 @@ public class DomElementsProblemsHolderImpl extends SmartList getProblems(DomElement domElement) { List problems = new ArrayList(); for (DomElementProblemDescription problemDescription : this) { - - //TODO !!!! getXmlTag() - isn't proper way final DomElement domElement1 = problemDescription.getDomElement(); - if(domElement1.getXmlTag().equals(domElement.getXmlTag())) { + if(domElement1.equals(domElement)) { problems.add(problemDescription); } } diff --git a/source/com/intellij/util/xml/impl/InvocationCache.java b/source/com/intellij/util/xml/impl/InvocationCache.java index 99b61aaa11..487c01f2d9 100644 --- a/source/com/intellij/util/xml/impl/InvocationCache.java +++ b/source/com/intellij/util/xml/impl/InvocationCache.java @@ -43,10 +43,12 @@ public class InvocationCache { if ("equals".equals(method.getName())) { ourCoreInvocations.put(JavaMethodSignature.getSignature(method), new Invocation() { public Object invoke(DomInvocationHandler handler, Object[] args) throws Throwable { - final Object o = args[0]; - final DomElement proxy = handler.getProxy(); - return proxy == o || o instanceof StableElement && o.equals(((StableElement)o).getWrappedElement()); + return _equals(handler.getProxy(), args[0]); } + private boolean _equals(final DomElement proxy, final Object o) { + return proxy == o || o instanceof StableElement && _equals(proxy, ((StableElement)o).getWrappedElement()); + } + }); } else { @@ -59,6 +61,7 @@ public class InvocationCache { } } + public Invocation getInvocation(JavaMethodSignature method) { Invocation invocation = ourCoreInvocations.get(method); return invocation != null ? invocation : myInvocations.get(method); diff --git a/source/com/intellij/util/xml/tree/BaseDomElementNode.java b/source/com/intellij/util/xml/tree/BaseDomElementNode.java index 8491c3dae2..81fdd391f1 100644 --- a/source/com/intellij/util/xml/tree/BaseDomElementNode.java +++ b/source/com/intellij/util/xml/tree/BaseDomElementNode.java @@ -5,6 +5,9 @@ import com.intellij.ui.SimpleTextAttributes; import com.intellij.util.xml.DomElement; import com.intellij.util.xml.DomUtil; import com.intellij.util.xml.GenericDomValue; +import com.intellij.util.xml.ui.TooltipUtils; +import com.intellij.util.xml.highlighting.DomElementAnnotationsManager; +import com.intellij.util.xml.highlighting.DomElementProblemDescription; import com.intellij.util.xml.reflect.DomCollectionChildDescription; import com.intellij.util.xml.reflect.DomFixedChildDescription; import jetbrains.fabrique.ui.treeStructure.SimpleNode; @@ -86,10 +89,13 @@ public class BaseDomElementNode extends AbstractDomElementNode { setUniformIcon(getNodeIcon()); clearColoredText(); - if (myDomElement.getXmlTag() != null) { + + final List problems = DomElementAnnotationsManager.getInstance().getProblems(myDomElement); + if (problems.size() > 0) { + addColoredFragment(getNodeName(), TooltipUtils.getTooltipText(problems), SimpleTextAttributes.ERROR_ATTRIBUTES); + } else if (myDomElement.getXmlTag() != null) { addColoredFragment(getNodeName(), SimpleTextAttributes.REGULAR_ATTRIBUTES); - } - else { + } else { addColoredFragment(getNodeName(), SimpleTextAttributes.GRAYED_ATTRIBUTES); } diff --git a/source/com/intellij/util/xml/tree/DomModelTreeView.java b/source/com/intellij/util/xml/tree/DomModelTreeView.java index a38c82b1e2..0cb02b0696 100644 --- a/source/com/intellij/util/xml/tree/DomModelTreeView.java +++ b/source/com/intellij/util/xml/tree/DomModelTreeView.java @@ -59,7 +59,7 @@ public class DomModelTreeView extends Wrapper implements DataProvider { myDomEventListener = new DomEventListener() { public void eventOccured(DomEvent event) { - myBuilder.updateFromRoot(true); + myBuilder.updateFromRoot(false); } }; myDomManager = rootElement.getManager(); diff --git a/treeStructure/src/jetbrains/fabrique/ui/treeStructure/SimpleNode.java b/treeStructure/src/jetbrains/fabrique/ui/treeStructure/SimpleNode.java index ec58192dc8..06c72bcb3f 100644 --- a/treeStructure/src/jetbrains/fabrique/ui/treeStructure/SimpleNode.java +++ b/treeStructure/src/jetbrains/fabrique/ui/treeStructure/SimpleNode.java @@ -143,7 +143,11 @@ public abstract class SimpleNode extends NodeDescriptor implements ComparableObj } public final void addColoredFragment(String aText, SimpleTextAttributes aAttributes) { - myColoredText.add(new ColoredFragment(aText, aAttributes)); + addColoredFragment(aText, null, aAttributes); + } + + public final void addColoredFragment(String aText, String toolTip, SimpleTextAttributes aAttributes) { + myColoredText.add(new ColoredFragment(aText, toolTip, aAttributes)); } public final void addColoredFragment(ColoredFragment fragment) { -- 2.11.4.GIT