/** * Create a new event * * @param source * the source * @param offset * the offset * @param replaceCharCount * the number of replaced chars * @param replaceLineCount * the number of replaced lines * @param newText * the new text * @param newCharCount * the new char count * @param newLineCount * the new line count * @return the event */ public static TextChangingEvent textChanging(StyledTextContent source, int offset, int replaceCharCount, int replaceLineCount, String newText, int newCharCount, int newLineCount) { return new TextChangingEvent(source, offset, replaceCharCount, replaceLineCount, newText, newCharCount, newLineCount); }
/** * Sends the text changing event to all registered listeners. */ private void fireTextChanging() { if (!fIsForwarding) return; try { IDocument document= fEvent.getDocument(); if (document == null) return; TextChangingEvent event= TextChangingEvent.textChanging(this, fEvent.fOffset, fEvent.fLength, document.getNumberOfLines(fEvent.fOffset, fEvent.fLength) - 1, fEvent.fText, (fEvent.fText == null ? 0 : fEvent.fText.length()), (fEvent.fText == null ? 0 : document.computeNumberOfLines(fEvent.fText))); if (fTextChangeListeners != null && fTextChangeListeners.size() > 0) { Iterator e= new ArrayList(fTextChangeListeners).iterator(); while (e.hasNext()) ((TextChangeListener) e.next()).textChanging(event); } } catch (BadLocationException e) { } }
TextChangingEvent event = TextChangingEvent.textChanging(this, start, replaceLength, lineCount(start, replaceLength), newText, newText.length(), lineCount(newText)); for (TextChangeListener l : this.textListeners) { l.textChanging(event);
TextChangingEvent event = TextChangingEvent.textChanging(this, start, replaceLength, lineCount(start, replaceLength), newText, newText.length(), lineCount(newText)); for (TextChangeListener l : this.textListeners) { l.textChanging(event);
/** * Create a new event * * @param source * the source * @param offset * the offset * @param replaceCharCount * the number of replaced chars * @param replaceLineCount * the number of replaced lines * @param newText * the new text * @param newCharCount * the new char count * @param newLineCount * the new line count * @return the event */ public static TextChangingEvent textChanging(StyledTextContent source, int offset, int replaceCharCount, int replaceLineCount, String newText, int newCharCount, int newLineCount) { return new TextChangingEvent(source, offset, replaceCharCount, replaceLineCount, newText, newCharCount, newLineCount); } }