final String currentWord = this.getCurrentWord(textDocument, cursorPosition);
final int cwLength = currentWord.length();
final List<Item> returnList = new ArrayList<Item>();
ArrayList<Item> possibilitiesList = null;
Item element_i;
//prueft das aktuelle Dokument bis zur (Text)cursorPosition auf Fehler
final String exception = this.handleException(textDocument.substring(0, cursorPosition));
if (exception.substring(0,2).equals("PE")) {
possibilitiesList = this.testforTokensPE(exception, textDocument, this.getTokenMap(),cursorPosition);
}else if (exception.substring(0,2).equals("LE")) {
possibilitiesList = this.testForTokensLE(exception, textDocument, this.getTokenMap(), cursorPosition);
} else {
possibilitiesList = this.testforTokensNE(textDocument, this.getTokenMap(), cursorPosition);
}
if (possibilitiesList!=null) {
//hier werden unpassende Vorschlaege aussortiert
for (int i = 0; i < possibilitiesList.size(); i++) {
element_i = possibilitiesList.get(i);
if (currentWord.equals("")||currentWord.equals(" ")) {
returnList.add(element_i);
} else if (cwLength <= element_i.getValue().length()) {
if (element_i.getCaseSensitiv()) {
if (currentWord.substring(0, cwLength).equals(
element_i.getValue().substring(0, cwLength))) {
returnList.add(element_i);
}
//Wenn nicht case Sensitiv equalsIgnoreCase-Methode statt equals
} else {
if (currentWord.substring(0, cwLength).equalsIgnoreCase(
element_i.getValue().substring(0, cwLength))) {
returnList.add(element_i);
}
}
}