Package org.jboss.aesh.util

Examples of org.jboss.aesh.util.FileLister$PosixFileNameComparator


            String word = Parser.findWordClosestToCursor(completeOperation.getBuffer(),
                    completeOperation.getCursor());
            completeOperation.setOffset(completeOperation.getCursor());
            //FileUtils.listMatchingDirectories(completeOperation, word,
            //        new File(System.getProperty("user.dir")));
            new FileLister(word, new File(System.getProperty("user.dir"))).findMatchingDirectories(completeOperation);
        }
    }
View Full Code Here


    public void complete(CompleterInvocation completerData) {

        CompleteOperation completeOperation =
                new CompleteOperation(completerData.getAeshContext(), completerData.getGivenCompleteValue(), 0);
        if (completerData.getGivenCompleteValue() == null)
            new FileLister("", completerData.getAeshContext().getCurrentWorkingDirectory(), filter)
                    .findMatchingDirectories(completeOperation);
        else
            new FileLister(completerData.getGivenCompleteValue(),
                    completerData.getAeshContext().getCurrentWorkingDirectory(), filter)
                    .findMatchingDirectories(completeOperation);

        if (completeOperation.getCompletionCandidates().size() > 1) {
            completeOperation.removeEscapedSpacesFromCompletionCandidates();
View Full Code Here

        else if(completeOperation.getBuffer().startsWith("less ")) {

            String word = Parser.findWordClosestToCursor(completeOperation.getBuffer(),
                    completeOperation.getCursor());
            completeOperation.setOffset(completeOperation.getCursor());
            new FileLister(word, new File(System.getProperty("user.dir"))).findMatchingDirectories(completeOperation);
        }
    }
View Full Code Here

      else
      {
         // TODO: Use ConverterFactory ?
         cwd = new File(value.toString());
      }
      FileLister fileLister = new FileLister(typedValue == null ? "" : typedValue, cwd,
               directory ? FileLister.Filter.DIRECTORY
                        : FileLister.Filter.ALL);
      fileLister.findMatchingDirectories(completeOperation);
   }
View Full Code Here

            completeOperation.setOffset(completeOperation.getCursor());
            if (completeObject.getValue() == null) {
                //use default value if its set
                if(inputOption.getValueType() == SingleValued.class &&
                        ((SingleValued) inputOption).getValue() != null) {
                    new FileLister("", new File(((SingleValued) inputOption).getValue().toString()))
                            .findMatchingDirectories(completeOperation);
                }
                else
                    new FileLister("", new File(System.getProperty("user.dir")))
                        .findMatchingDirectories(completeOperation);
            }
            else
                new FileLister(completeObject.getValue(), new File(System.getProperty("user.dir")))
                        .findMatchingDirectories(completeOperation);
        }
        else if(inputOption != null && inputOption.getValueType() == DirectoryResource.class) {
                completeOperation.setOffset(completeOperation.getCursor());
                if (completeObject.getValue() == null) {

                    if(((SingleValued) inputOption).getValue() != null) {
                        new FileLister("", new File(((SingleValued) inputOption).getValue().toString()),
                                FileLister.Filter.DIRECTORY).findMatchingDirectories(completeOperation);
                    }
                    else
                        new FileLister("", new File(System.getProperty("user.dir")), FileLister.Filter.DIRECTORY)
                                .findMatchingDirectories(completeOperation);
                }
                else
                    new FileLister(completeObject.getValue(), new File(System.getProperty("user.dir")),
                            FileLister.Filter.DIRECTORY).findMatchingDirectories(completeOperation);
        }

        if(inputOption != null && (inputOption instanceof SingleValued &&
                ((SingleValued) inputOption).getValue() != null)) {
View Full Code Here

        else if (inputOption != null && inputOption.getValueType() == File.class)
        {
            completeOperation.setOffset(completeOperation.getCursor());
            if (completeObject.getValue() == null)
                new FileLister("", new File(System.getProperty("user.dir")))
                        .findMatchingDirectories(completeOperation);
            else
                new FileLister(completeObject.getValue(), new File(System.getProperty("user.dir")))
                        .findMatchingDirectories(completeOperation);
        }
        else if (inputOption != null && inputOption.getValueType() == Boolean.class)
        {
            // TODO
View Full Code Here

                    completeOperation.getBuffer(), completeOperation.getCursor());

            String word = Parser.findWordClosestToCursor(completeOperation.getBuffer().substring(redirectPos, completeOperation.getCursor()), completeOperation.getCursor()-redirectPos);

            completeOperation.setOffset(completeOperation.getCursor());
            new FileLister(word, new File(System.getProperty("user.dir"))).findMatchingDirectories(completeOperation);
            //if we only have one complete candidate, leave the escaped space be
            if(completeOperation.getCompletionCandidates().size() > 1)
                completeOperation.removeEscapedSpacesFromCompletionCandidates();
        }
    }
View Full Code Here

            // option type == File
            if (inputOption != null && inputOption.getValueType() == File.class)
            {
               completeOperation.setOffset(completeOperation.getCursor());
               if (completeObject.getValue() == null)
                  new FileLister("", new File(System.getProperty("user.dir")))
                           .findMatchingDirectories(completeOperation);
               else
                  new FileLister(completeObject.getValue(), new File(System.getProperty("user.dir")))
                           .findMatchingDirectories(completeOperation);
            }
            else if (inputOption != null && inputOption.getValueType() == Boolean.class)
            {
               // TODO
            }
            else if (inputOption != null && inputOption.getValueType() == String.class)
            {
               // if it has a default value we can try to auto complete that
               if (inputOption instanceof UIInput)
               {
                  if (completeObject.getValue() == null || ((((UIInput) inputOption).getValue() != null) &&
                           completeObject.getValue().startsWith(((UIInput) inputOption).getValue().toString())))
                  {
                     completeOperation.addCompletionCandidate(((UIInput) inputOption).getValue().toString());
                  }
               }
            }
            // this shouldnt be needed
            if (inputOption != null && inputOption instanceof UIInput)
            {
               Iterable<String> iter = ((UIInput) inputOption).getCompleter().getCompletionProposals(inputOption,
                        completeObject.getValue());
               if (iter != null)
               {
                  for (String s : iter)
                     completeOperation.addCompletionCandidate(s);
               }
               if (completeOperation.getCompletionCandidates().size() == 1)
               {
                  completeOperation.setOffset(completeOperation.getCursor() -
                           completeObject.getOffset());
               }
            }
         }
         // try to complete a argument value
         else if (completeObject.isArgument())
         {
            InputComponent inputOption = context.findInput("arguments"); // default for arguments

            if (inputOption != null && inputOption.getValueType() == File.class)
            {
               completeOperation.setOffset(completeOperation.getCursor());
               if (completeObject.getValue() == null)
                  new FileLister("", new File(System.getProperty("user.dir")))
                           .findMatchingDirectories(completeOperation);
               else
                  new FileLister(completeObject.getValue(), new File(System.getProperty("user.dir")))
                           .findMatchingDirectories(completeOperation);
            }
            else if (inputOption != null && inputOption.getValueType() == Boolean.class)
            {
               // TODO
View Full Code Here

    public void complete(CompleterInvocation completerData) {

        CompleteOperation completeOperation =
                new CompleteOperation(completerData.getAeshContext(), completerData.getGivenCompleteValue(), 0);
        if (completerData.getGivenCompleteValue() == null)
            new FileLister("", completerData.getAeshContext().getCurrentWorkingDirectory(), filter)
                    .findMatchingDirectories(completeOperation);
        else
            new FileLister(completerData.getGivenCompleteValue(),
                    completerData.getAeshContext().getCurrentWorkingDirectory(), filter)
                    .findMatchingDirectories(completeOperation);

        if (completeOperation.getCompletionCandidates().size() > 1) {
            completeOperation.removeEscapedSpacesFromCompletionCandidates();
View Full Code Here

                    completeOperation.getBuffer(), completeOperation.getCursor());

            String word = Parser.findCurrentWordFromCursor(completeOperation.getBuffer().substring(redirectPos, completeOperation.getCursor()), completeOperation.getCursor() - redirectPos);

            completeOperation.setOffset(completeOperation.getCursor());
            FileLister lister = new FileLister(word, completeOperation.getAeshContext().getCurrentWorkingDirectory());
            lister.findMatchingDirectories(completeOperation);
            //if we only have one complete candidate, leave the escaped space be
            if(completeOperation.getCompletionCandidates().size() > 1)
                completeOperation.removeEscapedSpacesFromCompletionCandidates();
            completeOperation.setIgnoreStartsWith(true);
        }
View Full Code Here

TOP

Related Classes of org.jboss.aesh.util.FileLister$PosixFileNameComparator

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.