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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCreates Available language.static voidfillAvailableLanguagesFromBundleInJar(Collection<String> languages, URL location) static StringformatMessage(Object[] messageArguments, String message) static StringformatMessage(String message, String... arguments) getEntriesUnderPath(JarFile jar, Predicate<JarEntry> pred) static LocaleGets set locale.static LocaleInfostatic StringgetMetaModelResource(MDElement presentationElement) Returns meta model resource.static StringgetMetaModelResource(Class type) Returns meta model resource.static StringgetMetaModelResource(javax.jmi.reflect.RefObject element) Returns meta model resource.static StringgetStringFor(String key, int bundle) Get string according to key and bundle id.static StringgetStringFor(String key, int bundle, Object[] messageArguments) Get string according to key and bundle id.static StringgetStringFor(String key, int bundle, String messageArguments) Get string according to key and bundle id.static StringgetStringFor(String key, String bundleName, ClassLoader loader) Get string according to key and bundle id.static StringgetStringOrElse(String key, String bundleName, ClassLoader loader, Supplier<String> alternative) Get string according to key and bundle id.static voidsetLocale(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