org.jetbrains.annotations.PropertyKey Java Examples

The following examples show how to use org.jetbrains.annotations.PropertyKey. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FindInProjectUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static String getPresentableName(@Nonnull FindModel.SearchContext searchContext) {
  @PropertyKey(resourceBundle = "messages.FindBundle") String messageKey = null;
  if (searchContext == FindModel.SearchContext.ANY) {
    messageKey = "find.context.anywhere.scope.label";
  }
  else if (searchContext == FindModel.SearchContext.EXCEPT_COMMENTS) {
    messageKey = "find.context.except.comments.scope.label";
  }
  else if (searchContext == FindModel.SearchContext.EXCEPT_STRING_LITERALS) {
    messageKey = "find.context.except.literals.scope.label";
  }
  else if (searchContext == FindModel.SearchContext.EXCEPT_COMMENTS_AND_STRING_LITERALS) {
    messageKey = "find.context.except.comments.and.literals.scope.label";
  }
  else if (searchContext == FindModel.SearchContext.IN_COMMENTS) {
    messageKey = "find.context.in.comments.scope.label";
  }
  else if (searchContext == FindModel.SearchContext.IN_STRING_LITERALS) {
    messageKey = "find.context.in.literals.scope.label";
  }
  return messageKey != null ? FindBundle.message(messageKey) : searchContext.toString();
}
 
Example #2
Source File: RsocketErrorCode.java    From alibaba-rsocket-broker with Apache License 2.0 5 votes vote down vote up
/**
 * get value from resource bundle
 *
 * @param key    message key
 * @param params params,MessageFormat style
 * @return message value
 */
public static String message(@PropertyKey(resourceBundle = BUNDLE_FQN) String key, Object... params) {
    String value;
    try {
        value = ourBundle.getString(key);
    } catch (MissingResourceException ignore) {
        value = "!!!" + key + "!!!";
    }
    if (params != null && params.length > 0 && value.indexOf('{') >= 0) {
        value = MessageFormat.format(value, params);
    }
    return key + ": " + value;
}
 
Example #3
Source File: Babylon.java    From Dayon with GNU General Public License v3.0 5 votes vote down vote up
public static synchronized String translate(@PropertyKey(resourceBundle = BUNDLE) String tag, Object... arguments) {
    final Locale locale = Locale.getDefault();

    final ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE, locale);

    String value;

    try {
        value = bundle.getString(tag);

        if (value.trim().length() == 0) {
            value = tag;
        }

        if (arguments != null && arguments.length > 0) {
            value = formatValue(locale, value, tag, arguments);
        }
    } catch (MissingResourceException ignored) {
        value = tag;

        if (arguments != null && arguments.length > 0) {
            value = formatValue(locale, value, tag, arguments);
        }
    }

    if (value != null) {
        value = value.trim();
    }

    return value;
}
 
Example #4
Source File: HaxeCommonCompilerUtil.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
private static boolean verifyNonEmptyString(String s, CompilationContext context,
                                            @PropertyKey(resourceBundle = HaxeCommonBundle.BUNDLE) String propertyKey) {
  if (s == null || s.isEmpty()) {
    context.errorHandler(HaxeCommonBundle.message(propertyKey, context.getModuleName()));
    return false;
  }
  return true;
}
 
Example #5
Source File: Registry.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static RegistryValue get(@PropertyKey(resourceBundle = REGISTRY_BUNDLE) @Nonnull String key) {
  final Registry registry = getInstance();

  RegistryValue value = registry.myValues.get(key);
  if (value == null) {
    value = new RegistryValue(registry, key);
    registry.myValues.put(key, value);
  }
  return value;
}
 
Example #6
Source File: CrudBundle.java    From crud-intellij-plugin with Apache License 2.0 5 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) {
		return CommonBundle.message(BUNDLE, key, params);
/*        if (!StringUtil.isEmptyOrSpaces(message)) {
            try {
                message = new String(message.getBytes("ISO-8859-1"), "UTF-8");
            } catch (UnsupportedEncodingException e) {
                throw new IllegalStateException(e.getMessage(), e);
            }
        }
        return message;*/
	}
 
Example #7
Source File: Unity3dBundle.java    From consulo-unity3d with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.Unity3dBundle") String key)
{
	return ourInstance.getMessage(key);
}
 
Example #8
Source File: Registry.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static boolean is(@PropertyKey(resourceBundle = REGISTRY_BUNDLE) @Nonnull String key) throws MissingResourceException {
  return get(key).asBoolean();
}
 
Example #9
Source File: DupLocatorBundle.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String message(@Nonnull @PropertyKey(resourceBundle = BUNDLE) String key, @Nonnull Object... params) {
  return CommonBundle.message(getBundle(), key, params);
}
 
Example #10
Source File: AnalysisScopeBundle.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.AnalysisScopeBundle") String key) {
  return ourInstance.getMessage(key);
}
 
Example #11
Source File: DaemonBundle.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.DaemonBundle") String key, Object... params) {
  return ourInstance.getMessage(key, params);
}
 
Example #12
Source File: ProjectBundle.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.ProjectBundle") String key) {
  return ourInstance.getMessage(key);
}
 
Example #13
Source File: StdArrangementSettingsToken.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public static StdArrangementSettingsToken tokenByBundle(@Nonnull String id,
                                                        @Nonnull @PropertyKey(resourceBundle = ApplicationBundle.BUNDLE) String key,
                                                        @Nonnull StdArrangementTokenType tokenType) {
  return new StdArrangementSettingsToken(id, ApplicationBundle.message(key), tokenType);
}
 
Example #14
Source File: LombokBundle.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) {
  return AbstractBundle.message(BUNDLE, key, params);
}
 
Example #15
Source File: HaxeCommonBundle.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = BUNDLE) String key, Object... params) {
  return CommonBundle.message(getBundle(), key, params);
}
 
Example #16
Source File: PsiBundle.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.PsiBundle") String key) {
  return ourInstance.getMessage(key);
}
 
Example #17
Source File: XDebuggerBundle.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.XDebuggerBundle") String key) {
  return ourInstance.getMessage(key);
}
 
Example #18
Source File: ExecutionBundle.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.ExecutionBundle") String key, Object... params) {
  return ourInstance.getMessage(key, params);
}
 
Example #19
Source File: VcsBundle.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.VcsBundle") String key) {
  return ourInstance.getMessage(key);
}
 
Example #20
Source File: CSharpHighlightUtil.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Nullable
public static HighlightInfo createError(PsiElement element, @PropertyKey(resourceBundle = "messages.CSharpErrorBundle") String b)
{
	return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).descriptionAndTooltip(b).range(element).create();
}
 
Example #21
Source File: CSharpErrorBundle.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.CSharpErrorBundle") String key, Object... params)
{
	return ourInstance.getMessage(key, params);
}
 
Example #22
Source File: CSharpErrorBundle.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.CSharpErrorBundle") String key)
{
	return ourInstance.getMessage(key);
}
 
Example #23
Source File: CSharpInspectionBundle.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.CSharpInspectionBundle") String key, Object... params)
{
	return ourInstance.getMessage(key, params);
}
 
Example #24
Source File: StdArrangementTokens.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static StdArrangementSettingsToken token(@Nonnull String id, @Nonnull @PropertyKey(resourceBundle = ApplicationBundle.BUNDLE) String key,
                                                 @Nonnull StdArrangementTokenType type) {
  StdArrangementSettingsToken result = StdArrangementSettingsToken.tokenByBundle(id, key, type);
  TOKENS_BY_ID.put(id, result);
  return result;
}
 
Example #25
Source File: CSharpBundle.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.CSharpBundle") String key, Object... params)
{
	return ourInstance.getMessage(key, params);
}
 
Example #26
Source File: CSharpBundle.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.CSharpBundle") String key)
{
	return ourInstance.getMessage(key);
}
 
Example #27
Source File: VcsBundle.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.VcsBundle") String key, Object... params) {
  return ourInstance.getMessage(key, params);
}
 
Example #28
Source File: ESLintBundle.java    From eslint-plugin with MIT License 4 votes vote down vote up
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
    return CommonBundle.message(getBundle(), key, params);
}
 
Example #29
Source File: FileTypesBundle.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.FileTypesBundle") String key, Object... params) {
  return ourInstance.getMessage(key, params);
}
 
Example #30
Source File: DiffBundle.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.DiffBundle") String key) {
  return ourInstance.getMessage(key);
}