public CommandNamesCompleter(CommandSession session) { this.session = session; try { new CommandTracker(); } catch (Throwable t) { // Ignore in case we're not in OSGi } }
public void dispose() { if (tracker != null) { tracker.dispose(); } }
@Override public int complete(final String buffer, final int cursor, final List candidates) { StringsCompleter delegate = new StringsCompleter(kinds); return delegate.complete(buffer, cursor, candidates); } }
public int complete(String buffer, int cursor, List<String> candidates) { if (session == null) { session = CommandSessionHolder.getSession(); } checkData(); int res = new StringsCompleter(commands).complete(buffer, cursor, candidates); Collections.sort(candidates); return res; }
@SuppressWarnings("rawtypes") public int complete(final String buffer, final int cursor, final List candidates) { return delegate.complete(buffer, cursor, candidates); }
public StringsCompleter(final Collection<String> strings, boolean caseSensitive) { this(caseSensitive); assert strings != null; getStrings().addAll(strings); }
public ArgumentList delimit(final String buffer, final int cursor) { Parser parser = new Parser(buffer, cursor); try { List<List<List<String>>> program = parser.program(); List<String> pipe = program.get(parser.c0).get(parser.c1); return new ArgumentList(pipe.toArray(new String[pipe.size()]), parser.c2, parser.c3, cursor); } catch (Throwable t) { return new ArgumentList(new String[] { buffer }, 0, cursor, cursor); } }
public ArgumentList delimit(final String buffer, final int cursor) { Parser parser = new Parser(buffer, cursor); try { List<List<List<String>>> program = parser.program(); List<String> pipe = program.get(parser.c0).get(parser.c1); return new ArgumentList(pipe.toArray(new String[pipe.size()]), parser.c2, parser.c3, cursor); } catch (Throwable t) { return new ArgumentList(new String[] { buffer }, 0, cursor, cursor); } }
/** * Return true if the specified character is a whitespace * parameter. Check to ensure that the character is not * escaped and returns true from * {@link #isDelimiterChar}. * * @param buffer The complete command buffer. * @param pos The index of the character in the buffer. * @return True if the character should be a delimiter, false else. */ public boolean isDelimiter(final String buffer, final int pos) { return !isEscaped(buffer, pos) && isDelimiterChar(buffer, pos); }
/** * Return true if the specified character is a whitespace * parameter. Check to ensure that the character is not * escaped and returns true from * {@link #isDelimiterChar}. * * @param buffer The complete command buffer. * @param pos The index of the character in the buffer. * @return True if the character should be a delimiter, false else. */ public boolean isDelimiter(final String buffer, final int pos) { return !isEscaped(buffer, pos) && isDelimiterChar(buffer, pos); }
char peek() { return peek(false); }
public CommandsCompleter(CommandSession session) { this.session = session; try { tracker = new CommandTracker(); } catch (Throwable t) { // Ignore in case we're not in OSGi } }
public String toString() { return "..." + context(current) + "..."; }
@Override public int complete(final String buffer, final int cursor, final List candidates) { StringsCompleter delegate = new StringsCompleter(mainClasses); return delegate.complete(buffer, cursor, candidates); } }
public int complete(final String buffer, final int cursor, final List candidates) { return delegate.complete(buffer, cursor, candidates); }
char next() { return peek(true); }