Examples of PathspecParser


Examples of org.jboss.forge.addon.shell.util.PathspecParser

   public Result execute(UIExecutionContext context) throws Exception
   {
      Resource<?> currentResource = (Resource<?>) context.getUIContext().getInitialSelection().get();
      for (String path : arguments.getValue())
      {
         List<Resource<?>> resources = new PathspecParser(resourceFactory, currentResource, path).resolve();
         for (Resource<?> resource : resources)
         {
            if (resource.exists())
            {
               return Results.fail(path + ": Resource already exists.");
View Full Code Here

Examples of org.jboss.forge.addon.shell.util.PathspecParser

      Resource<?> currentResource = shell.getCurrentResource();
      Iterator<String> it = arguments.getValue() == null ? Collections.<String> emptyList().iterator() : arguments
               .getValue().iterator();

      final Resource<?> resource = (it.hasNext()) ?
               (new PathspecParser(resourceFactory, currentResource, it.next()).resolve().get(0)) : currentResource;

      if (!resource.exists())
      {
         result = Results.fail(resource.getName() + ": No such file or directory");
      }
View Full Code Here

Examples of org.jboss.forge.shell.util.PathspecParser

         values = new String[] { String.valueOf(valueMap.get(option)) };
      }

      String val = values[values.length - 1];

      for (Resource<?> r : new PathspecParser(resourceFactory, shell.getCurrentResource(), val + "*")
               .resolve())
      {
         // Add result to the results list, and append a file separator ('/' or '\\') if the
         // resource has children.
         String name = ("~".equals(val) ? "~" + File.separator : "") + r.getName()
View Full Code Here

Examples of org.jboss.forge.shell.util.PathspecParser

         pom.setParent(parent);
         mvn.setPOM(pom);
      }
      else if (relativePath != null)
      {
         PathspecParser parser = new PathspecParser(resources, shell.getCurrentProject().getProjectRoot(), relativePath);
         List<Resource<?>> resolvedResources = parser.resolve();
         if (!resolvedResources.isEmpty()
                  && factory.containsProject(resolvedResources.get(0).reify(DirectoryResource.class)))
         {
            Project parentProject = factory.findProject(resolvedResources.get(0).reify(DirectoryResource.class));
            MavenCoreFacet parentCore = parentProject.getFacet(MavenCoreFacet.class);
View Full Code Here

Examples of org.jboss.forge.shell.util.PathspecParser

         pom.setParent(parent);
         mvn.setPOM(pom);
      }
      else if (relativePath != null)
      {
         PathspecParser parser = new PathspecParser(resources, shell.getCurrentProject().getProjectRoot(), relativePath);
         List<Resource<?>> resolvedResources = parser.resolve();
         if (!resolvedResources.isEmpty()
                  && factory.containsProject(resolvedResources.get(0).reify(DirectoryResource.class)))
         {
            Project parentProject = factory.findProject(resolvedResources.get(0).reify(DirectoryResource.class));
            MavenCoreFacet parentCore = parentProject.getFacet(MavenCoreFacet.class);
View Full Code Here

Examples of org.jboss.forge.shell.util.PathspecParser

         values = new String[] { String.valueOf(valueMap.get(option)) };
      }

      String val = values[values.length - 1];

      for (Resource<?> r : new PathspecParser(resourceFactory, shell.getCurrentResource(), val + "*")
               .resolve())
      {
         // Add result to the results list, and append a '/' if the
         // resource has children.
         String name = ("~".equals(val) ? "~/" : "") + r.getName()
View Full Code Here

Examples of org.jboss.forge.shell.util.PathspecParser

         values = new String[] { String.valueOf(valueMap.get(option)) };
      }

      String val = values[values.length - 1];

      for (Resource<?> r : new PathspecParser(resourceFactory, shell.getCurrentResource(), val + "*")
               .resolve())
      {
         // Add result to the results list, and append a '/' if the
         // resource has children.
         String name = ("~".equals(val) ? "~/" : "") + r.getName()
View Full Code Here

Examples of org.jboss.forge.shell.util.PathspecParser

                   @Option(required = false, name = "find", shortName = "f") final String path)
   {

      if (path != null)
      {
         PathspecParser pathspecParser = new PathspecParser(resourceFactory, shell.getCurrentResource(), path);
         List<Resource<?>> targets = pathspecParser.search();

         if (targets.isEmpty())
         {
            shell.println("No such resource");
         }
View Full Code Here

Examples of org.jboss.forge.shell.util.PathspecParser

                      final PipeOut out)
   {
      if (source instanceof FileResource)
      {
         Resource<?> sourceTarget = source.isFlagSet(ResourceFlag.Leaf) ? source.getParent() : source;
         List<Resource<?>> results = new PathspecParser(resourceFactory, sourceTarget, target).resolve();

         if (results.size() != 1)
         {
            out.println("ambiguous target file name: " + target);
         }
View Full Code Here

Examples of org.jboss.forge.shell.util.PathspecParser

      }
   }

   private void copy(final Resource<?> source, Resource<?> directory, final String target)
   {
      List<Resource<?>> results = new PathspecParser(resourceFactory, directory, target).resolve();

      if (results.size() > 1)
      {
         throw new RuntimeException("ambiguous target file name: " + target);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.