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;
}