allow to initialize class without Application (for upsource)

This commit is contained in:
Alexey Kudravtsev
2015-03-12 14:34:14 +03:00
parent 0ccb0b8071
commit 99d607e446
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.json.codeinsight;
import com.intellij.json.JsonBundle;
@@ -23,7 +38,9 @@ public class JsonLiteralAnnotator implements Annotator {
private static final Pattern VALID_ESCAPE = Pattern.compile("\\\\([\"\\\\/bfnrt]|u[0-9a-fA-F]{4})");
private static final Pattern VALID_NUMBER_LITERAL = Pattern.compile("-?(0|[1-9][0-9]*)(\\.[0-9]+)?([eE][+-]?[0-9]+)?");
private static final boolean DEBUG = ApplicationManager.getApplication().isUnitTestMode();
private static class Holder {
private static final boolean DEBUG = ApplicationManager.getApplication().isUnitTestMode();
}
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
@@ -32,7 +49,7 @@ public class JsonLiteralAnnotator implements Annotator {
final JsonStringLiteral stringLiteral = (JsonStringLiteral)element;
final int elementOffset = element.getTextOffset();
if (JsonPsiUtil.isPropertyKey(element)) {
holder.createInfoAnnotation(element, DEBUG ? "property key" : null).setTextAttributes(JsonSyntaxHighlighterFactory.JSON_PROPERTY_KEY);
holder.createInfoAnnotation(element, Holder.DEBUG ? "property key" : null).setTextAttributes(JsonSyntaxHighlighterFactory.JSON_PROPERTY_KEY);
}
final int length = text.length();