Package com.nomagic.magicdraw.resources
Class ResourceManager
java.lang.Object
com.nomagic.magicdraw.resources.ResourceManager
This class is used to retrieve the resources from
the resource bundle files
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Creates Available language.static void
fillAvailableLanguagesFromBundleInJar
(Collection<String> languages, URL location) static String
formatMessage
(Object[] messageArguments, String message) static String
formatMessage
(String message, String... arguments) getEntriesUnderPath
(JarFile jar, Predicate<JarEntry> pred) static Locale
Gets set locale.static LocaleInfo
static String
getMetaModelResource
(MDElement presentationElement) Returns meta model resource.static String
getMetaModelResource
(Class type) Returns meta model resource.static String
getMetaModelResource
(javax.jmi.reflect.RefObject element) Returns meta model resource.static String
getStringFor
(String key, int bundle) Get string according to key and bundle id.static String
getStringFor
(String key, int bundle, Object[] messageArguments) Get string according to key and bundle id.static String
getStringFor
(String key, int bundle, String messageArguments) Get string according to key and bundle id.static String
getStringFor
(String key, String bundleName, ClassLoader loader) Get string according to key and bundle id.static String
getStringOrElse
(String key, String bundleName, ClassLoader loader, Supplier<String> alternative) Get string according to key and bundle id.static void
setLocale
(LocaleInfo localeInfo) Sets locale.static void
-
Field Details
-
DIALOG_RESOURCE
public static final int DIALOG_RESOURCE- See Also:
-
PROPERTY_RESOURCE
public static final int PROPERTY_RESOURCE- See Also:
-
METAMODEL_RESOURCE
public static final int METAMODEL_RESOURCE- See Also:
-
EXTENSION
- See Also:
-
DEFAULT
Deprecated.replaced withSYSTEM
- See Also:
-
SYSTEM
- See Also:
-
ENGLISH
-
RESOURCES_CLASS_NAMES
-
DIALOG_RESOURCE_BUNDLE
- See Also:
-
-
Constructor Details
-
ResourceManager
public ResourceManager()
-
-
Method Details
-
getMetaModelResource
Returns meta model resource. -
getMetaModelResource
Returns meta model resource. -
getMetaModelResource
Returns meta model resource. -
getStringFor
Get string according to key and bundle id. If there are no such - returns key.- Parameters:
key
- Key to fetch stringbundle
- Bundle ID- Returns:
- String for key from given bundle.
-
getStringFor
Get string according to key and bundle id. If there are no such - returns key.- Parameters:
key
- Key to fetch stringbundleName
- Bundle nameloader
- loader to load resources- Returns:
- String for key from given bundle.
-
getStringOrElse
public static String getStringOrElse(String key, String bundleName, @CheckForNull ClassLoader loader, Supplier<String> alternative) Get string according to key and bundle id. If there is no such - returns alternative from the passed in supplier.- Parameters:
key
- Key to fetch stringbundleName
- Bundle nameloader
- loader to load resourcesalternative
- result to be returned in case key or bundle is not found- Returns:
- String for key from given bundle, or alternative if the key or bundle is not found
-
getStringFor
Get string according to key and bundle id. If there are no such - returns key. Can retrieve customizable message bundles.- Parameters:
key
- Key to fetch stringbundle
- Bundle IDmessageArguments
- Set of the message bundle arguments.- Returns:
- String for key from given bundle.
-
getStringFor
Get string according to key and bundle id. If there are no such - returns key. Can retrieve customizable message bundles.- Parameters:
key
- Key to fetch stringbundle
- Bundle idmessageArguments
- Set of the message bundle arguments.- Returns:
- String for key from given bundle.
-
formatMessage
-
formatMessage
-
getLocale
Gets set locale. If there are no such - creates default.- Returns:
- locale, which is used for bundles
-
getLocaleInfo
-
setLocale
-
setLocale
Sets locale. This operation is called only when is read environment options- Parameters:
localeInfo
- Bundles will be chosen according this locale
-
getAvailableLanguages
-
createAvailableLanguages
public static void createAvailableLanguages()Creates Available language. -
fillAvailableLanguagesFromBundleInJar
public static void fillAvailableLanguagesFromBundleInJar(Collection<String> languages, URL location) -
getEntriesUnderPath
-
SYSTEM