Package org.jboss.forge.resources

Examples of org.jboss.forge.resources.PropertiesFileResource$SortedProperties


         out.println();
         for (Resource<?> path : paths)
         {
            if (path instanceof PropertiesFileResource)
            {
               PropertiesFileResource propResource = (PropertiesFileResource) path;
               for (Resource<?> resource : propResource.listResources())
               {
                  EntryResource<String, String> entryResource = (EntryResource<String, String>) resource;
                  out.print(ShellColor.BOLD, entryResource.getKey() + ": ");
                  out.println(entryResource.getValue());
               }
View Full Code Here


            throws Exception
   {
      String fullBundleFile = bundleName.endsWith(".properties") ? bundleName : bundleName + ".properties";
      DirectoryResource resourceFolder = project.getFacet(ResourceFacet.class).getResourceFolder();

      PropertiesFileResource bundleFile = resourceFolder.getChildOfType(PropertiesFileResource.class, fullBundleFile);
      if (!bundleFile.exists())
      {
         bundleFile.createNewFile();
      }

      shell.setCurrentResource(bundleFile);

      out.println("Bundle " + bundleFile + " has been created !");
View Full Code Here

         propertiesFileResource.putProperty(key, value);
      }
      else
      {
         String bundleName = getBaseBundleName(propertiesFileResource.getName()) + "_" + locale + ".properties";
         PropertiesFileResource newFileResource = getOrCreate(bundleName);
         newFileResource.putProperty(key, value);
         shell.setCurrentResource(newFileResource);
      }
   }
View Full Code Here

         propertyValue = propertiesFileResource.getProperty(key);
      }
      else
      {
         String bundleName = getBaseBundleName(propertiesFileResource.getName()) + "_" + locale + ".properties";
         PropertiesFileResource newFilePropertiesResource = getOrCreate(bundleName);
         propertyValue = newFilePropertiesResource.getProperty(key);
      }
      shell.println(propertyValue);
   }
View Full Code Here

      {
         baseName = getBaseBundleName(propertiesFileResource.getName());
      }

      final String baseBundleName = (baseName + "_" + locale + ".properties");
      PropertiesFileResource newFileResource = getOrCreate(baseBundleName);
      shell.setCurrentResource(newFileResource);
   }
View Full Code Here

    */
   protected PropertiesFileResource getOrCreate(final String bundleName)
   {
      final ResourceFacet resourceFacet = project.getFacet(ResourceFacet.class);
      final BundleBaseNameResourceFilter filter = new BundleBaseNameResourceFilter(bundleName);
      PropertiesFileResource newFileResource = null;
      for (DirectoryResource directoryResource : resourceFacet.getResourceFolders())
      {
         for (Resource<?> resource : directoryResource.listResources(filter))
         {
            newFileResource = (PropertiesFileResource) resource;
            // Using the first resource found
            break;
         }
      }
      if (newFileResource == null)
      {
         newFileResource = resourceFacet.getResourceFolder().getChildOfType(PropertiesFileResource.class,
                  bundleName);
         if (!newFileResource.exists())
         {
            newFileResource.createNewFile();
         }
      }
      return newFileResource;
   }
View Full Code Here

         out.println();
         for (Resource<?> path : paths)
         {
            if (path instanceof PropertiesFileResource)
            {
               PropertiesFileResource propResource = (PropertiesFileResource) path;
               for (Resource<?> resource : propResource.listResources())
               {
                  EntryResource<String, String> entryResource = (EntryResource<String, String>) resource;
                  out.print(ShellColor.BOLD, entryResource.getKey() + ": ");
                  out.println(entryResource.getValue());
               }
View Full Code Here

         out.println();
         for (Resource<?> path : paths)
         {
            if (path instanceof PropertiesFileResource)
            {
               PropertiesFileResource propResource = (PropertiesFileResource) path;
               for (Resource<?> resource : propResource.listResources())
               {
                  out.println(resource.getName());
               }
               out.println();
            }
View Full Code Here

            throws Exception
   {
      String fullBundleFile = bundleName.endsWith(".properties") ? bundleName : bundleName + ".properties";
      DirectoryResource resourceFolder = project.getFacet(ResourceFacet.class).getResourceFolder();

      PropertiesFileResource bundleFile = resourceFolder.getChildOfType(PropertiesFileResource.class, fullBundleFile);
      if (!bundleFile.exists())
      {
         bundleFile.createNewFile();
      }

      shell.setCurrentResource(bundleFile);

      out.println("Bundle " + bundleFile + " has been created !");
View Full Code Here

         propertiesFileResource.putProperty(key, value);
      }
      else
      {
         String bundleName = getBaseBundleName(propertiesFileResource.getName()) + "_" + locale + ".properties";
         PropertiesFileResource newFileResource = getOrCreate(bundleName);
         newFileResource.putProperty(key, value);
         shell.setCurrentResource(newFileResource);
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.forge.resources.PropertiesFileResource$SortedProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.