You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TabCompleter.java 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (c) 2006-2015 DMDirc Developers
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. package com.dmdirc.ui.input;
  23. import javax.annotation.Nullable;
  24. import java.util.List;
  25. /**
  26. * The tab completer handles a user's request to tab complete some word.
  27. */
  28. public interface TabCompleter {
  29. /**
  30. * Attempts to complete the partial string.
  31. *
  32. * @param partial The string to tab complete
  33. * @param additionals A list of additional strings to use
  34. *
  35. * @return A TabCompleterResult containing any matches found
  36. */
  37. List<String> complete(String partial, @Nullable AdditionalTabTargets additionals);
  38. /**
  39. * Adds a new entry to this tab completer's list.
  40. *
  41. * @param type The type of the entry that's being added
  42. * @param entry The new entry to be added
  43. */
  44. void addEntry(TabCompletionType type, String entry);
  45. /**
  46. * Adds multiple new entries to this tab completer's list.
  47. *
  48. * @param type The type of the entries that're being added
  49. * @param newEntries Entries to be added
  50. */
  51. void addEntries(TabCompletionType type, Iterable<String> newEntries);
  52. /**
  53. * Removes a specified entry from this tab completer's list.
  54. *
  55. * @param type The type of the entry that should be removed
  56. * @param entry The entry to be removed
  57. */
  58. void removeEntry(TabCompletionType type, String entry);
  59. /**
  60. * Clears all entries in this tab completer.
  61. */
  62. void clear();
  63. /**
  64. * Clears all entries of the specified type in this tab completer.
  65. *
  66. * @param type The type of entry to clear
  67. */
  68. void clear(TabCompletionType type);
  69. }