private void addTypeMessages(CmsExplorerTypeSettings setting, String moduleFolder)
    throws CmsException, UnsupportedEncodingException {

        Map<String, String> messages = new HashMap<String, String>();
        CmsObject cms = getCms();
        // check if any messages to set
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_resInfo.getNiceName())) {
            String key = KEY_PREFIX_NAME + m_resInfo.getName();
            messages.put(key, m_resInfo.getNiceName());
            setting.setKey(key);
        }
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_resInfo.getDescription())) {
            String key = KEY_PREFIX_DESCRIPTION + m_resInfo.getName();
            messages.put(key, m_resInfo.getDescription());
            setting.setInfo(key);
        }
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_resInfo.getTitle())) {
            String key = KEY_PREFIX_TITLE + m_resInfo.getName();
            messages.put(key, m_resInfo.getTitle());
            setting.setTitleKey(key);
        }
        if (!messages.isEmpty()) {
            // add the messages to the module's workplace bundle

            //1. check if the bundle exists as raw Java bundle
            String workplacePropertiesFile = CmsStringUtil.joinPaths(
                moduleFolder,
                CmsModulesEditBase.PATH_CLASSES,
                m_resInfo.getModuleName().replace(".", "/"),
                PROPERTIES_FILE_NAME);
            if (cms.existsResource(workplacePropertiesFile)) {
                addMessagesToPropertiesFile(messages, cms.readFile(workplacePropertiesFile), true);
            } else {
                //2. check if the bundle exists as XML bundle
                String vfsBundleFileName = CmsStringUtil.joinPaths(
                    moduleFolder,
                    PATH_I18N,
                    m_resInfo.getModuleName() + SUFFIX_BUNDLE_FILE);
                OpenCms.getLocaleManager();
                if (cms.existsResource(vfsBundleFileName)) {
                    addMessagesToVfsBundle(messages, cms.readFile(vfsBundleFileName));
                } else {
                    //3. check if the bundle exists as property bundle
                    // we always write to the default locale
                    String propertyBundleFileName = vfsBundleFileName + "_" + CmsLocaleManager.getDefaultLocale();
                    if (!cms.existsResource(propertyBundleFileName)) {
                        //if non of the checked bundles exist, create one.
                        String bundleFolder = CmsStringUtil.joinPaths(moduleFolder, PATH_I18N);
                        if (!cms.existsResource(bundleFolder)) {
                            cms.createResource(
                                bundleFolder,
                                OpenCms.getResourceManager().getResourceType(
                                    CmsResourceTypeFolder.getStaticTypeName()));
                        }
                        CmsResource res = cms.createResource(
                            propertyBundleFileName,
                            OpenCms.getResourceManager().getResourceType(CmsVfsBundleManager.TYPE_PROPERTIES_BUNDLE),
                            null,
                            null);
                        cms.writeResource(res);
                    }
                    addMessagesToPropertiesFile(messages, cms.readFile(propertyBundleFileName), false);
                }

            }
        }
    }
private void addTypeMessages ( CmsExplorerTypeSettings setting , String moduleFolder ) throws CmsException , UnsupportedEncodingException { Map < String , String > messages = new HashMap < String , String > ( ) ; CmsObject cms = getCms ( ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( m_resInfo . getNiceName ( ) ) ) { String key = KEY_PREFIX_NAME + m_resInfo . getName ( ) ; messages . put ( key , m_resInfo . getNiceName ( ) ) ; setting . setKey ( key ) ; } if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( m_resInfo . getDescription ( ) ) ) { String key = KEY_PREFIX_DESCRIPTION + m_resInfo . getName ( ) ; messages . put ( key , m_resInfo . getDescription ( ) ) ; setting . setInfo ( key ) ; } if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( m_resInfo . getTitle ( ) ) ) { String key = KEY_PREFIX_TITLE + m_resInfo . getName ( ) ; messages . put ( key , m_resInfo . getTitle ( ) ) ; setting . setTitleKey ( key ) ; } if ( ! messages . isEmpty ( ) ) { String workplacePropertiesFile = CmsStringUtil . joinPaths ( moduleFolder , CmsModulesEditBase . PATH_CLASSES , m_resInfo . getModuleName ( ) . replace ( "." , "/" ) , PROPERTIES_FILE_NAME ) ; if ( cms . existsResource ( workplacePropertiesFile ) ) { addMessagesToPropertiesFile ( messages , cms . readFile ( workplacePropertiesFile ) , true ) ; } else { String vfsBundleFileName = CmsStringUtil . joinPaths ( moduleFolder , PATH_I18N , m_resInfo . getModuleName ( ) + SUFFIX_BUNDLE_FILE ) ; OpenCms . getLocaleManager ( ) ; if ( cms . existsResource ( vfsBundleFileName ) ) { addMessagesToVfsBundle ( messages , cms . readFile ( vfsBundleFileName ) ) ; } else { String propertyBundleFileName = vfsBundleFileName + "_" + CmsLocaleManager . getDefaultLocale ( ) ; if ( ! cms . existsResource ( propertyBundleFileName ) ) { String bundleFolder = CmsStringUtil . joinPaths ( moduleFolder , PATH_I18N ) ; if ( ! cms . existsResource ( bundleFolder ) ) { cms . createResource ( bundleFolder , OpenCms . getResourceManager ( ) . getResourceType ( CmsResourceTypeFolder . getStaticTypeName ( ) ) ) ; } CmsResource res = cms . createResource ( propertyBundleFileName , OpenCms . getResourceManager ( ) . getResourceType ( CmsVfsBundleManager . TYPE_PROPERTIES_BUNDLE ) , null , null ) ; cms . writeResource ( res ) ; } addMessagesToPropertiesFile ( messages , cms . readFile ( propertyBundleFileName ) , false ) ; } } } }
Adds the explorer type messages to the modules workplace bundle.<p>

@param setting the explorer type settings
@param moduleFolder the module folder name

@throws CmsException if writing the bundle fails
@throws UnsupportedEncodingException in case of encoding issues