public void spellingError(SpellCheckEvent event) {
    List<String> suggestions = new ArrayList<String>();

    Iterator<Word> itr = event.getSuggestions().iterator();

    while (itr.hasNext()) {
      Word word = itr.next();

      suggestions.add(word.getWord());
    }

    int pos = event.getWordContextPosition();

    if (pos >= 0) {
      if ((pos == 0)
          || ((pos > 0)
              &&
              // (_text.charAt(pos - 1) != '<') &&
              (!_isInsideHtmlTag(pos))
              && (_text.charAt(pos - 1) != '&')
              && (event.getInvalidWord().length() > 1))) {

        _invalidWords.add(
            new InvalidWord(
                event.getInvalidWord(), suggestions,
                event.getWordContext(), pos));
      }
    }
  }
  @Override
  public void spellingError(SpellCheckEvent event) {
    List<String> suggestions = new ArrayList<String>();

    for (Word word : (List<Word>) event.getSuggestions()) {
      suggestions.add(word.getWord());
    }

    int pos = event.getWordContextPosition();

    if (pos >= 0) {
      if ((pos == 0)
          || ((pos > 0)
              &&
              // (_text.charAt(pos - 1) != '<') &&
              (!_isInsideHtmlTag(pos))
              && (_text.charAt(pos - 1) != '&')
              && (event.getInvalidWord().length() > 1))) {

        _invalidWords.add(
            new InvalidWord(
                event.getInvalidWord(), suggestions,
                event.getWordContext(), pos));
      }
    }
  }
Пример #3
0
 public void fillMenu(IMenuManager menu) {
   SpellCheckEvent range = getCurrentRange();
   if (range != null) {
     List list = range.getSuggestions();
     if (list.isEmpty()) {
       menu.add(new NoSuggestionAction());
     } else {
       for (Object o : list) {
         String suggestion = o.toString();
         menu.add(new SuggestionAction(range, suggestion));
       }
     }
     menu.add(new Separator());
     menu.add(new NewWordAction(range));
   }
 }