Java Code Examples for org.jetbrains.annotations.PropertyKey

The following examples show how to use org.jetbrains.annotations.PropertyKey. These examples are extracted from open source projects. 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 Project: consulo   Source File: FindInProjectUtil.java    License: 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 Project: crud-intellij-plugin   Source File: CrudBundle.java    License: 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 3
Source Project: alibaba-rsocket-broker   Source File: RsocketErrorCode.java    License: 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 4
Source Project: Dayon   Source File: Babylon.java    License: 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 5
Source Project: intellij-haxe   Source File: HaxeCommonCompilerUtil.java    License: 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 6
Source Project: consulo   Source File: Registry.java    License: 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 7
Source Project: consulo   Source File: ActionsBundle.java    License: Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.ActionsBundle") String key) {
  return ourInstance.getMessage(key);
}
 
Example 8
Source Project: consulo   Source File: Registry.java    License: Apache License 2.0 4 votes vote down vote up
public static int intValue(@PropertyKey(resourceBundle = REGISTRY_BUNDLE) @Nonnull String key) throws MissingResourceException {
  return get(key).asInteger();
}
 
Example 9
Source Project: json2java4idea   Source File: Json2JavaBundle.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
@CheckReturnValue
public String message(@Nonnull @PropertyKey(resourceBundle = BUNDLE) String key, @Nonnull Object... objects) {
    return getMessage(key, objects);
}
 
Example 10
Source Project: consulo   Source File: LangBundle.java    License: Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.LangBundle") String key, Object... params) {
  return ourInstance.getMessage(key, params);
}
 
Example 11
Source Project: json2java4idea   Source File: SettingsPanelTest.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
@CheckReturnValue
private JTextComponentFixture findTextFieldByName(@Nonnull @PropertyKey(resourceBundle = "messages.Json2Java4IdeaBundle") String key) {
    return window.textBox(bundle.message(key));
}
 
Example 12
Source Project: consulo   Source File: FeatureStatisticsBundle.java    License: Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.FeatureStatisticsBundle") String key) {
  return ourInstance.getMessage(key);
}
 
Example 13
Source Project: CppTools   Source File: CppBundle.java    License: Apache License 2.0 4 votes vote down vote up
public static String message(@NonNls @PropertyKey(resourceBundle = BUNDLE)String key, Object... params) {
  return CommonBundle.message(getBundle(), key, params);
}
 
Example 14
Source Project: consulo   Source File: CodeEditorBundle.java    License: 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 15
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
  return CommonBundle.message(getBundle(), key, params);
}
 
Example 16
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
  return CommonBundle.message(getBundle(), key, params);
}
 
Example 17
public static String message(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) {
    return CommonBundle.message(BUNDLE, key, params);
}
 
Example 18
Source Project: ApiDebugger   Source File: ApiDebuggerBundle.java    License: Apache License 2.0 4 votes vote down vote up
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object... params) {
    if (key == null) {
        $$$reportNull$$$0(0);
    }
    return CommonBundle.message(getBundle(), key, params);
}
 
Example 19
Source Project: consulo   Source File: VfsBundle.java    License: Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.VfsBundle") String key, Object... params) {
  return ourInstance.getMessage(key, params);
}
 
Example 20
Source Project: consulo   Source File: ActionsBundle.java    License: Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.ActionsBundle") String key, Object... params) {
  return ourInstance.getMessage(key, params);
}
 
Example 21
public static String messageOrDefault(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, String defaultValue,
                                      Object... params) {
    return CommonBundle.messageOrDefault(BUNDLE, key, defaultValue, params);
}
 
Example 22
Source Project: sass-lint-plugin   Source File: SassLintBundle.java    License: 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 23
Source Project: consulo   Source File: DiffBundle.java    License: Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.DiffBundle") String key, Object... params) {
  return ourInstance.getMessage(key, params);
}
 
Example 24
Source Project: consulo   Source File: CommonBundle.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
public static String message(@Nonnull @PropertyKey(resourceBundle = BUNDLE) String key, @Nonnull Object... params) {
  return message(getCommonBundle(), key, params);
}
 
Example 25
Source Project: azure-devops-intellij   Source File: TfPluginBundle.java    License: MIT License 4 votes vote down vote up
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE_NAME) String key,
                             @NotNull Object... params) {
    return CommonBundle.message(getBundle(), key, params);
}
 
Example 26
Source Project: react-templates-plugin   Source File: RTBundle.java    License: 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 27
Source Project: consulo   Source File: ExecutionBundle.java    License: Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.ExecutionBundle") String key) {
  return ourInstance.getMessage(key);
}
 
Example 28
Source Project: consulo   Source File: LangBundle.java    License: Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.LangBundle") String key) {
  return ourInstance.getMessage(key);
}
 
Example 29
Source Project: consulo   Source File: UIBundle.java    License: Apache License 2.0 4 votes vote down vote up
public static String message(@PropertyKey(resourceBundle = "messages.UIBundle") String key) {
  return ourInstance.getMessage(key);
}
 
Example 30
Source Project: p4ic4idea   Source File: P4Bundle.java    License: Apache License 2.0 4 votes vote down vote up
@NonNls
public static String message(
        @Nls
        @PropertyKey(resourceBundle = BUNDLE) String key, Object... params) {
    return CommonBundle.message(getBundle(), key, params);
}