Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.ide.resourcebundle
Class ResourceBundleUtils

java.lang.Object
  extended by oracle.javatools.resourcebundle.ResourceBundleUtils
      extended by oracle.ide.resourcebundle.ResourceBundleUtils


public final class ResourceBundleUtils
extends ResourceBundleUtils

ResourceBundleUtils provides utility routines needed by the ResourceBundleManager and ResourceBundleKeyChooser. Methods in this class should not be used by others.


Field Summary
protected static java.lang.String RESBUNDLE_DT_EXTENSION_ID
           

 

Fields inherited from class oracle.javatools.resourcebundle.ResourceBundleUtils
ADF_CONFIG, ADF_CONFIG_CHILD, ADF_NAMESPACE, APP_BUNDLE_NODE, BUNDLE_ID_NODE, BUNDLE_LIST_NODE, EXPIRE_SECONDS, EXPIRE_TIME, INITIAL_SIZE_ATTRIBUTE, LOAD_FACTOR_ATTRIBUTE, MAX_SIZE_ATTRIBUTE, OVERRIDE_ATTRIBUTE, RESOURCE_BUNDLE_CACHE_NODE, XMLNS, XMLNS_RESBUNDLE

 

Method Summary
static boolean alwaysPromptForDescription(PropertyStorage propStorage)
          Gets whether the project is set to always prompt for a description
static java.lang.String buildQualifiedName(PropertyStorage propStorage, java.lang.String baseName)
          Builds a qualified bundle name by using the default package name for the project and adding that to the base name
static java.lang.String deriveBundleId(PropertyStorage propStorage, java.net.URL bundleURL)
          Attempts to derive a bundleId for the specified URL based on it being part of the specified project
static java.lang.String deriveBundleId(PropertyStorage propStorage, java.net.URL bundleURL, boolean bProjectOnly)
           
static java.lang.String deriveBundleIdForJAR(java.net.URL libraryURL, java.net.URL selectedBundleURL)
          Derives a bundleId for a bundle selected from an ADF Library Package-protected only so that unit tests can access, no other code should use this
static ResourceBundleWrapper findBundleInADFLibrary(PropertyStorage propStorage, java.net.URL libraryURL, java.lang.String bundleId)
          Finds the ResourceBundleWrapper for the specified bundleId in the specified ADF library
static java.util.List<java.net.URL> findExistingBundles(PropertyStorage propStorage, java.lang.String bundleId)
          Finds URLS that already exist for the specified bundle id.
static int getBundleCreationPolicy(PropertyStorage propStorage)
          Gets the bundle creation policy for the specified project
static java.lang.String getBundleId(ResourceBundleWrapper bundle)
          Gets the bundle id from this bundle.
static java.util.List<java.lang.String> getDefaultBundleNameForProject(PropertyStorage project)
          Returns the bundle names that may be used for a project.
static java.util.List<java.lang.String> getDefaultBundleNameForWorkspace(PropertyStorage workspace)
          Returns the default bundle name that may be used for a workspace.
static ResourceBundleType getDefaultResourceBundleType(PropertyStorage propStorage)
          Gets the default resource bundle type for the specified project
static java.awt.Dialog getParentDialog(java.awt.Component parentComponent)
           
static ResourceBundleConstants.BundleTypes getTypeFromBundle(ResourceBundleWrapper bundle)
          Gets the type of the specified ResourceBundleWrapper
static java.net.URL getURL(NodeResourceBundle bundle)
          Used to determine the URL that stores the resources.
static java.lang.String getUserHomeDir()
           
static boolean isAutomaticallySynchronized(PropertyStorage propStorage)
          Gets whether the project is set to automatically synchronize strings into resource bundles
static boolean isBundleReadOnly(NodeResourceBundle bundle)
          Returns whether the bundle should be treated as read-only.
static boolean isBundleReadOnly(NodeResourceBundle bundle, boolean bCheckout)
           
static boolean isDefaultBundleForProject(PropertyStorage project, java.lang.String bundleId)
           
static boolean isRoleSettingBundlesReadOnly()
           
protected static boolean isSourceControlled(java.net.URL url)
           
static java.lang.String replaceNewLines(java.lang.String string)
          Replaces new lines in the string with an escape of the new line
static java.lang.String replaceWhitespace(java.lang.String string)
          Replaces whitespace in the string with an underline character
static ResourceBundleKey showEditDialog(java.awt.Component owner, NodeResourceBundle bundle, java.lang.String key, PropertyStorage project, java.lang.String bundleDisplayString)
          Shows a dialog for editing a resource
static Pair splitFileFromPath(java.lang.String bundleId)
          Takes a bundle id (which is a fully-qualified name of a bundle) and splits it into the file name and the path.
static boolean warnAboutHardcodedNontranslatedStrings(PropertyStorage propStorage)
          Gets whether the project is set to report nontranslatable strings as violations

 

Methods inherited from class oracle.javatools.resourcebundle.ResourceBundleUtils
addUnicodeEscapes, convertMetadataToDisplayString, convertMetadataToString, convertStringToMetadata, createConfigMap, createNewParentList, getADFConfig, getADFContext, getAppBundleInfo, getAppBundleInfoForLocale, getSystemProperty, getTextString, isMetadataEqual, stripUnicodeEscapes

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

RESBUNDLE_DT_EXTENSION_ID

protected static final java.lang.String RESBUNDLE_DT_EXTENSION_ID
See Also:
Constant Field Values

Method Detail

getBundleCreationPolicy

public static int getBundleCreationPolicy(PropertyStorage propStorage)
Gets the bundle creation policy for the specified project
Parameters:
propStorage - The current PropertyStorage's Data that owns this file.
Returns:
int that represents the bundle creation policy, will be either ResourceBundleManager.ONE_BUNDLE_PER_PROJECT, ResourceBundleManager.ONE_BUNDLE_PER_ARTIFACT, or ResourceBundleManager.MULTIPLE_SHARED_BUNDLES

isAutomaticallySynchronized

public static boolean isAutomaticallySynchronized(PropertyStorage propStorage)
Gets whether the project is set to automatically synchronize strings into resource bundles
Parameters:
propStorage - The current PropertyStorage's Data that owns this file.
Returns:
true if the is automatically synchronzied; false otherwise

warnAboutHardcodedNontranslatedStrings

public static boolean warnAboutHardcodedNontranslatedStrings(PropertyStorage propStorage)
Gets whether the project is set to report nontranslatable strings as violations
Parameters:
propStorage - The current PropertyStorage's Data that owns this file.
Returns:
true if the is set to report nontranslated strings as violations; false otherwise

alwaysPromptForDescription

public static boolean alwaysPromptForDescription(PropertyStorage propStorage)
Gets whether the project is set to always prompt for a description
Parameters:
propStorage - The current PropertyStorage's data that owns this file
Returns:
true if the is set to always prompt for a description; false otherwise

getDefaultResourceBundleType

public static ResourceBundleType getDefaultResourceBundleType(PropertyStorage propStorage)
Gets the default resource bundle type for the specified project
Parameters:
propStorage - The current PropertyStorage's Data that owns this file.
Returns:
the resource bundle type to use when a new bundle is created for the project

getBundleId

public static java.lang.String getBundleId(ResourceBundleWrapper bundle)
Gets the bundle id from this bundle. Takes a ResourceBundleWrapper but really expects a NodeResourceBundle any other type will return a null bundle Id.
Parameters:
bundle - The bundle to get the id for
Returns:
the string that identifies the bundle

splitFileFromPath

public static Pair splitFileFromPath(java.lang.String bundleId)
Takes a bundle id (which is a fully-qualified name of a bundle) and splits it into the file name and the path. For example, a bundle id of package1.package1.fileName will be split into a file name of fileName and put into the first element of the Pair, and the path portion will be converted to package1/package2 and put into the second element of the Pair.
Parameters:
bundleId - string representing the fully-qualified name of the bundle
Returns:
a Pair where the first element represents the file name and the second element represents the path

findExistingBundles

public static java.util.List<java.net.URL> findExistingBundles(PropertyStorage propStorage,
                                                               java.lang.String bundleId)
Finds URLS that already exist for the specified bundle id. Searches for URLs for any supported resource bundle type since the default bundle type may change during the life of a project
Parameters:
propStorage - The current PropertyStorage's Data that owns this file.
bundleId - fully-qualified name of the bundle
Returns:
a list of URLs that already exist in the project for the specified bundleId

findBundleInADFLibrary

public static ResourceBundleWrapper findBundleInADFLibrary(PropertyStorage propStorage,
                                                           java.net.URL libraryURL,
                                                           java.lang.String bundleId)
Finds the ResourceBundleWrapper for the specified bundleId in the specified ADF library
Parameters:
project - the project
libraryURL - the URL of the ADF Library
bundleId - fully-qualifief bundle name
Returns:
the bundle or null if none can be found

getTypeFromBundle

public static ResourceBundleConstants.BundleTypes getTypeFromBundle(ResourceBundleWrapper bundle)
Gets the type of the specified ResourceBundleWrapper
Parameters:
bundle - the bundle to determine the type of
Returns:
the type of bundle; typically used to determine how an editor should construct code to access keys in the bundle (eg, use loadBundle syntax or EL-access)

getURL

public static java.net.URL getURL(NodeResourceBundle bundle)
Used to determine the URL that stores the resources.
Parameters:
bundle - the bundle to get the url for
Returns:
the url that stores the resources for this bundle or null if there is no underlying url (data may be stored in the database)

deriveBundleId

public static java.lang.String deriveBundleId(PropertyStorage propStorage,
                                              java.net.URL bundleURL)
Attempts to derive a bundleId for the specified URL based on it being part of the specified project
Parameters:
propStorage - the PropertyStorage that owns the bundle
bundleURL - the URL that stores the bundle data
Returns:
bundle Id for the bundle

deriveBundleId

public static java.lang.String deriveBundleId(PropertyStorage propStorage,
                                              java.net.URL bundleURL,
                                              boolean bProjectOnly)

isDefaultBundleForProject

public static boolean isDefaultBundleForProject(PropertyStorage project,
                                                java.lang.String bundleId)

getDefaultBundleNameForWorkspace

public static java.util.List<java.lang.String> getDefaultBundleNameForWorkspace(PropertyStorage workspace)
Returns the default bundle name that may be used for a workspace.
Parameters:
workspace -
Returns:

getDefaultBundleNameForProject

public static java.util.List<java.lang.String> getDefaultBundleNameForProject(PropertyStorage project)
Returns the bundle names that may be used for a project. If the project has a default package defined it will return 2 values, the first qualified by the default package name, the second will not be qualified with the default package name. If no default package name is set for the project only 1 entry will be returned.
Parameters:
project -
Returns:

buildQualifiedName

public static java.lang.String buildQualifiedName(PropertyStorage propStorage,
                                                  java.lang.String baseName)
Builds a qualified bundle name by using the default package name for the project and adding that to the base name
Parameters:
project -
baseName -
Returns:
qualified bundle name

isRoleSettingBundlesReadOnly

public static boolean isRoleSettingBundlesReadOnly()

isBundleReadOnly

public static boolean isBundleReadOnly(NodeResourceBundle bundle)
Returns whether the bundle should be treated as read-only. Takes into account what the role has set the shaping for resource bundle preferences as well as the bundles own setting from NodeResourceBundle.allowsCreateResource()
Parameters:
bundle -
Returns:
true if the bundle should be treated as read-only; false otherwise

isBundleReadOnly

public static boolean isBundleReadOnly(NodeResourceBundle bundle,
                                       boolean bCheckout)

isSourceControlled

protected static boolean isSourceControlled(java.net.URL url)

replaceNewLines

public static java.lang.String replaceNewLines(java.lang.String string)
Replaces new lines in the string with an escape of the new line
Parameters:
string -
Returns:
the string with any new lines escaped

showEditDialog

public static final ResourceBundleKey showEditDialog(java.awt.Component owner,
                                                     NodeResourceBundle bundle,
                                                     java.lang.String key,
                                                     PropertyStorage project,
                                                     java.lang.String bundleDisplayString)
Shows a dialog for editing a resource
Parameters:
owner - the component that should own the dialog
bundle - the bundle that contains the key (must not be null)
key - the key to be edited (must not be null)
project - the project (must not be null)
bundleDisplayString - a string to display as the bundle that is being edited. This may be null and is only necessary when the dialog is opened from the SelectTextPanel when multiple bundles are being searched.
Returns:
a ResourceBundleKey object containing the modified data or null if the user cancels the dialog

replaceWhitespace

public static java.lang.String replaceWhitespace(java.lang.String string)
Replaces whitespace in the string with an underline character
Parameters:
string -
Returns:
the string with whitespace replaced by an underline character

getParentDialog

public static java.awt.Dialog getParentDialog(java.awt.Component parentComponent)

deriveBundleIdForJAR

public static java.lang.String deriveBundleIdForJAR(java.net.URL libraryURL,
                                                    java.net.URL selectedBundleURL)
Derives a bundleId for a bundle selected from an ADF Library Package-protected only so that unit tests can access, no other code should use this
Parameters:
libraryURL - the URL of the library
selectedBundleURL - the URL of the bundle
Returns:
the string to use as the bundleId

getUserHomeDir

public static java.lang.String getUserHomeDir()

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


Copyright © 1997, 2012, Oracle. All rights reserved.