private void setResourceInformation ( ) { String sitePath = m_cms . getSitePath ( m_resource ) ; int pathEnd = sitePath . lastIndexOf ( ' ' ) + 1 ; String baseName = sitePath . substring ( pathEnd ) ; m_sitepath = sitePath . substring ( 0 , pathEnd ) ; switch ( CmsMessageBundleEditorTypes . BundleType . toBundleType ( OpenCms . getResourceManager ( ) . getResourceType ( m_resource ) . getTypeName ( ) ) ) { case PROPERTY : String localeSuffix = CmsStringUtil . getLocaleSuffixForName ( baseName ) ; if ( ( null != localeSuffix ) && ! localeSuffix . isEmpty ( ) ) { baseName = baseName . substring ( 0 , baseName . lastIndexOf ( localeSuffix ) - ( 1 /* cut off trailing underscore, too*/ ) ) ; m_locale = CmsLocaleManager . getLocale ( localeSuffix ) ; } if ( ( null == m_locale ) || ! m_locales . contains ( m_locale ) ) { m_switchedLocaleOnOpening = true ; m_locale = m_locales . iterator ( ) . next ( ) ; } break ; case XML : m_locale = OpenCms . getLocaleManager ( ) . getBestAvailableLocaleForXmlContent ( m_cms , m_resource , m_xmlBundle ) ; break ; case DESCRIPTOR : m_basename = baseName . substring ( 0 , baseName . length ( ) - CmsMessageBundleEditorTypes . Descriptor . POSTFIX . length ( ) ) ; m_locale = new Locale ( "en" ) ; break ; default : throw new IllegalArgumentException ( Messages . get ( ) . container ( Messages . ERR_UNSUPPORTED_BUNDLE_TYPE_1 , CmsMessageBundleEditorTypes . BundleType . toBundleType ( OpenCms . getResourceManager ( ) . getResourceType ( m_resource ) . getTypeName ( ) ) ) . toString ( ) ) ; } m_basename = baseName ; }
Extract site path base name and locale from the resource opened with the editor .