psi viewer: blocks tree small fixes

This commit is contained in:
kirill.safonov
2011-12-27 21:05:50 +04:00
parent 890cf6bf41
commit 8f8976dbba
2 changed files with 7 additions and 2 deletions
@@ -1004,7 +1004,7 @@ public class PsiViewerDialog extends DialogWrapper implements DataProvider, Disp
int blockStart = descriptor.getBlock().getTextRange().getStartOffset();
PsiElement currentPsiEl = InjectedLanguageUtil.findElementAtNoCommit(rootPsi.getContainingFile(), blockStart);
int blockLength = descriptor.getBlock().getTextRange().getLength();
while (currentPsiEl != null &&
while (currentPsiEl.getParent() != null &&
currentPsiEl.getTextRange().getStartOffset() == blockStart &&
currentPsiEl.getTextLength() != blockLength) {
currentPsiEl = currentPsiEl.getParent();
@@ -1,6 +1,7 @@
package com.intellij.internal.psiView.formattingblocks;
import com.intellij.formatting.Block;
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper;
import com.intellij.ide.projectView.PresentationData;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.ui.treeStructure.SimpleNode;
@@ -32,7 +33,11 @@ public class BlockTreeNode extends SimpleNode {
@Override
protected void update(PresentationData presentation) {
presentation.addText(new String(myBlock.getClass().getSimpleName()), SimpleTextAttributes.REGULAR_ATTRIBUTES);
String name = myBlock.getClass().getSimpleName();
if (myBlock instanceof DataLanguageBlockWrapper) {
name += " (" + ((DataLanguageBlockWrapper)myBlock).getOriginal().getClass().getSimpleName() + ")";
}
presentation.addText(name, SimpleTextAttributes.REGULAR_ATTRIBUTES);
if (myBlock.getIndent() != null) {
presentation.addText(" " + String.valueOf(myBlock.getIndent()).replaceAll("[<>]", " "), SimpleTextAttributes.GRAY_ATTRIBUTES);