Fix incorrect message bundle loading

This commit is contained in:
Roman Shevchenko
2011-12-26 18:47:14 +01:00
parent bda988d0e0
commit e34d1f5214
3 changed files with 42 additions and 36 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -15,31 +15,23 @@
*/
package com.intellij.codeInsight.daemon;
import com.intellij.CommonBundle;
import com.intellij.AbstractBundle;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.PropertyKey;
import java.util.ResourceBundle;
/**
* @author max
*/
public class JavaErrorMessages {
public class JavaErrorMessages extends AbstractBundle {
public static final JavaErrorMessages INSTANCE = new JavaErrorMessages();
@NonNls public static final String BUNDLE = "messages.JavaErrorMessages";
private JavaErrorMessages() {
super(BUNDLE);
}
public static String message(@PropertyKey(resourceBundle = BUNDLE)String key, Object... params) {
return CommonBundle.message(getBundle(), key, params);
}
private static class ResourceBundleHolder {
private static final ResourceBundle ourBundle = ResourceBundle.getBundle(BUNDLE);
}
private static ResourceBundle getBundle() {
return ResourceBundleHolder.ourBundle;
return INSTANCE.getMessage(key, params);
}
}
@@ -15,7 +15,7 @@
*/
package com.intellij.lang.java.parser;
import com.intellij.CommonBundle;
import com.intellij.AbstractBundle;
import com.intellij.codeInsight.daemon.JavaErrorMessages;
import com.intellij.lang.PsiBuilder;
import com.intellij.openapi.util.Pair;
@@ -27,8 +27,6 @@ import com.intellij.psi.tree.TokenSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ResourceBundle;
import static com.intellij.lang.PsiBuilderUtil.expect;
import static com.intellij.lang.java.parser.JavaParserUtil.*;
@@ -52,14 +50,17 @@ public class FileParser {
}
public void parse(final PsiBuilder builder) {
parseFile(builder, IMPORT_LIST_STOPPER_SET, JavaErrorMessages.BUNDLE, "expected.class.or.interface");
parseFile(builder, IMPORT_LIST_STOPPER_SET, JavaErrorMessages.INSTANCE, "expected.class.or.interface");
}
private static String error(@NotNull String bundle, @NotNull String errorMessageKey) {
return CommonBundle.message(ResourceBundle.getBundle(bundle), errorMessageKey);
private static String error(@NotNull AbstractBundle bundle, @NotNull String errorMessageKey) {
return bundle.getMessage(errorMessageKey);
}
public void parseFile(final PsiBuilder builder, final TokenSet importListStoppers, @NotNull String bundle, @NotNull String errorMessageKey) {
public void parseFile(@NotNull final PsiBuilder builder,
@NotNull final TokenSet importListStoppers,
@NotNull final AbstractBundle bundle,
@NotNull final String errorMessageKey) {
parsePackageStatement(builder);
final Pair<PsiBuilder.Marker, Boolean> impListInfo = parseImportList(builder, importListStoppers);