public void complete(final Completer completer, final String buffer, final int cursor) { checkNotNull(completer); this.cursor = completer.complete(buffer, cursor, candidates); } }
public int complete(String buf, int pos, List cand) { if (buf != null && buf.startsWith(BeeLine.COMMAND_PREFIX) && !buf.startsWith(BeeLine.COMMAND_PREFIX + "all") && !buf.startsWith(BeeLine.COMMAND_PREFIX + "sql")) { return beeLine.getCommandCompletor().complete(buf, pos, cand); } else { if (beeLine.getDatabaseConnection() != null && beeLine.getDatabaseConnection().getSQLCompleter() != null) { return beeLine.getDatabaseConnection().getSQLCompleter().complete(buf, pos, cand); } else { return -1; } } } }
public void complete(final Completer completer, final String buffer, final int cursor) { checkNotNull(completer); this.cursor = completer.complete(buffer, cursor, candidates); } }
protected void printCompletionCandidates() throws IOException { // debug ("tab for (" + buf + ")"); if (completers.size() == 0) { return; } List<CharSequence> candidates = new LinkedList<CharSequence>(); String bufstr = buf.buffer.toString(); int cursor = buf.cursor; for (Completer comp : completers) { if (comp.complete(bufstr, cursor, candidates) != -1) { break; } } CandidateListCompletionHandler.printCandidates(this, candidates); drawLine(); }
/** * Use the completers to modify the buffer with the appropriate completions. * * @return true if successful */ protected boolean complete() throws IOException { // debug ("tab for (" + buf + ")"); if (completers.size() == 0) { return false; } List<CharSequence> candidates = new LinkedList<CharSequence>(); String bufstr = buf.buffer.toString(); int cursor = buf.cursor; int position = -1; for (Completer comp : completers) { if ((position = comp.complete(bufstr, cursor, candidates)) != -1) { break; } } return candidates.size() != 0 && getCompletionHandler().complete(this, candidates, position); }
public void complete(final Completer completer, final String buffer, final int cursor) { checkNotNull(completer); this.cursor = completer.complete(buffer, cursor, candidates); } }
public int complete(String buffer, int cursor, List<CharSequence> candidates) { int matchStart = 0; if (buffer.startsWith(" ")) { String trimmed = buffer.trim(); matchStart += buffer.indexOf(trimmed.charAt(0)); buffer = buffer.substring(matchStart); } for (Pattern p : completers.keySet()) { Matcher matcher = p.matcher(buffer); if (matcher.matches()) { int groups = matcher.groupCount(); String lastGroup = matcher.group(groups); return matchStart + matcher.start(groups) + completers.get(p).complete(lastGroup, cursor, candidates); } } return 0; } }
String childBuffer = buffer.substring(realPrefix.length()).trim(); List<CharSequence> childCandidates = Lists.newArrayList(); int result = completer.complete(childBuffer, cursor - realPrefix.length(), childCandidates);
/** * Use the completers to modify the buffer with the appropriate completions. * * @return true if successful */ protected boolean complete() throws IOException { // debug ("tab for (" + buf + ")"); if (completers.size() == 0) { return false; } List<CharSequence> candidates = new LinkedList<CharSequence>(); String bufstr = buf.buffer.toString(); int cursor = buf.cursor; int position = -1; for (Completer comp : completers) { if ((position = comp.complete(bufstr, cursor, candidates)) != -1) { break; } } return candidates.size() != 0 && getCompletionHandler().complete(this, candidates, position); }
String childBuffer = buffer.substring(realPrefix.length()).trim(); List<CharSequence> childCandidates = Lists.newArrayList(); int result = completer.complete(childBuffer, cursor - realPrefix.length(), childCandidates);
protected void printCompletionCandidates() throws IOException { // debug ("tab for (" + buf + ")"); if (completers.size() == 0) { return; } List<CharSequence> candidates = new LinkedList<CharSequence>(); String bufstr = buf.buffer.toString(); int cursor = buf.cursor; for (Completer comp : completers) { if (comp.complete(bufstr, cursor, candidates) != -1) { break; } } CandidateListCompletionHandler.printCandidates(this, candidates); drawLine(); }
@Override public int complete(String buffer, int cursor, List<CharSequence> candidates) { int completionIndex = super.complete(buffer, cursor, candidates); int spaceIndex = buffer.indexOf(' '); String commandName = ((spaceIndex != -1) ? buffer.substring(0, spaceIndex) : ""); if (!"".equals(commandName.trim())) { for (Command command : this.commands) { if (command.getName().equals(commandName)) { if (cursor == buffer.length() && buffer.endsWith(" ")) { printUsage(command); break; } Completer completer = this.commandCompleters.get(command.getName()); if (completer != null) { completionIndex = completer.complete(buffer, cursor, candidates); break; } } } } return completionIndex; }
@Override public int complete(String buffer, int cursor, List<CharSequence> candidates) { int completionIndex = super.complete(buffer, cursor, candidates); int spaceIndex = buffer.indexOf(' '); String commandName = (spaceIndex == -1) ? "" : buffer.substring(0, spaceIndex); if (!"".equals(commandName.trim())) { for (Command command : this.commands) { if (command.getName().equals(commandName)) { if (cursor == buffer.length() && buffer.endsWith(" ")) { printUsage(command); break; } Completer completer = this.commandCompleters.get(command.getName()); if (completer != null) { completionIndex = completer.complete(buffer, cursor, candidates); break; } } } } return completionIndex; }
public int complete(String buf, int pos, List cand) { if (buf != null && buf.startsWith(BeeLine.COMMAND_PREFIX) && !buf.startsWith(BeeLine.COMMAND_PREFIX + "all") && !buf.startsWith(BeeLine.COMMAND_PREFIX + "sql")) { return beeLine.getCommandCompletor().complete(buf, pos, cand); } else { if (beeLine.getDatabaseConnection() != null && beeLine.getDatabaseConnection().getSQLCompleter() != null) { return beeLine.getDatabaseConnection().getSQLCompleter().complete(buf, pos, cand); } else { return -1; } } } }
public int complete(String buf, int pos, List cand) { if (buf != null && buf.startsWith(BeeLine.COMMAND_PREFIX) && !buf.startsWith(BeeLine.COMMAND_PREFIX + "all") && !buf.startsWith(BeeLine.COMMAND_PREFIX + "sql")) { return beeLine.getCommandCompletor().complete(buf, pos, cand); } else { if (beeLine.getDatabaseConnection() != null && beeLine.getDatabaseConnection().getSQLCompleter() != null) { return beeLine.getDatabaseConnection().getSQLCompleter().complete(buf, pos, cand); } else { return -1; } } } }
public int complete(String buf, int pos, List cand) { if (buf != null && buf.startsWith(BeeLine.COMMAND_PREFIX) && !buf.startsWith(BeeLine.COMMAND_PREFIX + "all") && !buf.startsWith(BeeLine.COMMAND_PREFIX + "sql")) { return beeLine.getCommandCompletor().complete(buf, pos, cand); } else { if (beeLine.getDatabaseConnection() != null && beeLine.getDatabaseConnection().getSQLCompleter() != null) { return beeLine.getDatabaseConnection().getSQLCompleter().complete(buf, pos, cand); } else { return -1; } } } }
return fileNameCompleter.complete(buffer, cursor, candidates); return completer.complete(buffer, cursor, candidates); } else if (CliConstants.HELP_ACTION.equals(action)) { return helpCommandCompleter.complete(buffer, cursor, candidates); logger.trace("Using Default Completer..."); return defaultCommandCompleter.complete(buffer, cursor, candidates);
@Override public int complete( String buffer, int cursor, List candidates ) { if ( buffer == null || buffer.length() == 0 ) { return cursor; } try { if ( buffer.contains( " " ) ) { TabCompletion completion = client.getServer().tabComplete( client.getId(), buffer.trim() ); cursor = completion.getCursor(); //noinspection unchecked candidates.addAll( completion.getCandidates() ); } else { // Complete the app name return getAppNameCompleter().complete( buffer, cursor, candidates ); } } catch ( RemoteException | ShellException e ) { // TODO Throw something? e.printStackTrace(); } return cursor; }