use of org.netbeans.editor.EditorUI in project enclojure by EricThorsen.
the class ClojureCodeCompletion_Provider method getAllHippieMatches.
public static ArrayList<String> getAllHippieMatches(JTextComponent target) {
ArrayList<String> ret = new ArrayList<String>();
EditorUI editorUI = Utilities.getEditorUI(target);
Caret caret = target.getCaret();
int dotPos = caret.getDot();
WordMatch m = editorUI.getWordMatch();
if (m != null) {
String s = null;
String searchWord = "";
int c = 0;
do {
c += 1;
s = m.getMatchWord(dotPos, false);
if (s != null && !ret.contains(s)) {
ret.add(s);
if (c == 1)
searchWord = m.getPreviousWord();
}
} while (s != null && m.isFound());
if (searchWord == null)
searchWord = "";
do {
s = m.getMatchWord(dotPos + searchWord.length() + 2, true);
if (s != null && !ret.contains(s))
if (!s.equalsIgnoreCase(searchWord) && !ret.contains(s))
ret.add(s);
} while (s != null && m.isFound());
}
return ret;
}