diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 77a8b4a1d62..72df4056f05 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -124,7 +124,6 @@ - diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java b/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java index b4e5790d540..b26abca8fc1 100644 --- a/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java @@ -58,7 +58,8 @@ public class JetPsiChecker implements Annotator { @Override public void annotate(@NotNull PsiElement element, @NotNull final AnnotationHolder holder) { element.accept(new SoftKeywordsHighlightingVisitor(holder)); - + element.accept(new LabelsHighlightingVisitor(holder)); + if (element instanceof JetFile) { JetFile file = (JetFile)element; diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/LabelsAnnotator.java b/idea/src/org/jetbrains/jet/plugin/highlighter/LabelsHighlightingVisitor.java similarity index 50% rename from idea/src/org/jetbrains/jet/plugin/highlighter/LabelsAnnotator.java rename to idea/src/org/jetbrains/jet/plugin/highlighter/LabelsHighlightingVisitor.java index e01d16845d1..1e8ec30382c 100644 --- a/idea/src/org/jetbrains/jet/plugin/highlighter/LabelsAnnotator.java +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/LabelsHighlightingVisitor.java @@ -29,26 +29,24 @@ import org.jetbrains.jet.lang.psi.JetSimpleNameExpression; import org.jetbrains.jet.lang.psi.JetVisitorVoid; import org.jetbrains.jet.lexer.JetTokens; -public class LabelsAnnotator implements Annotator { - public void annotate(@NotNull PsiElement element, @NotNull final AnnotationHolder holder) { -// if (ApplicationManager.getApplication().isUnitTestMode()) return; - element.accept(new JetVisitorVoid() { - @Override - public void visitPrefixExpression(JetPrefixExpression expression) { - JetSimpleNameExpression operationSign = expression.getOperationReference(); - if (JetTokens.LABELS.contains(operationSign.getReferencedNameElementType())) { - holder.createInfoAnnotation(operationSign, null).setTextAttributes(JetHighlightingColors.LABEL); - } - } +class LabelsHighlightingVisitor extends HighlightingVisitor { + LabelsHighlightingVisitor(AnnotationHolder holder) { + super(holder); + } - @Override - public void visitLabelQualifiedExpression(JetLabelQualifiedExpression expression) { - JetSimpleNameExpression targetLabel = expression.getTargetLabel(); - if (targetLabel != null) { - holder.createInfoAnnotation(targetLabel, null).setTextAttributes(JetHighlightingColors.LABEL); - } - } + @Override + public void visitPrefixExpression(JetPrefixExpression expression) { + JetSimpleNameExpression operationSign = expression.getOperationReference(); + if (JetTokens.LABELS.contains(operationSign.getReferencedNameElementType())) { + holder.createInfoAnnotation(operationSign, null).setTextAttributes(JetHighlightingColors.LABEL); + } + } - }); + @Override + public void visitLabelQualifiedExpression(JetLabelQualifiedExpression expression) { + JetSimpleNameExpression targetLabel = expression.getTargetLabel(); + if (targetLabel != null) { + holder.createInfoAnnotation(targetLabel, null).setTextAttributes(JetHighlightingColors.LABEL); + } } }