public void addTextChangeListener(TextChangeListener textChangeListener) { if (textChangeListener != null) { textChangeListeners.add(textChangeListener); } }
public void setText(String newText) { delete(0, size()); insert(0, newText); TextChangedEvent evt = new TextChangedEvent(this); for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) { ((TextChangeListener) iter.next()).textSet(evt); } }
private void notifyListeners(TextChangedEvent changedEvent) { for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) { TextChangeListener element = (TextChangeListener) iter.next(); element.textChanged(changedEvent); } }
private void notifyListeners(TextChangingEvent changingEvent) { for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) { TextChangeListener element = (TextChangeListener) iter.next(); element.textChanging(changingEvent); } }
/************************************************************************** * Constructor *************************************************************************/ public TextViewContent( int capacity ) { m_listeners = new ArrayList<TextChangeListener>(); m_text = new TextViewLine[1]; m_showTimestamp = false; m_text[0] = new TextViewLine("", null, Scope.OTHER, ParagraphType.NORMAL, 0, m_showTimestamp); m_ranges = null; m_viewWindowLength = 0; m_viewWindowStart = 0; m_buffer = new TextBuffer(capacity); m_buffer.addBufferListener(this); makeLineIndex(); }
@Override /************************************************************************** * Register a text change listener *************************************************************************/ public void addTextChangeListener(TextChangeListener listener) { m_listeners.add(listener); }
@Override /************************************************************************** * De-register a text change listener *************************************************************************/ public void removeTextChangeListener(TextChangeListener listener) { m_listeners.remove(listener); }
/************************************************************************** * Fire a text-set event *************************************************************************/ private void fireTextSet() { for (TextChangeListener lst : m_listeners) { lst.textSet(new TextChangedEvent(this)); } }
/************************************************************************** * Fire a text-moved event *************************************************************************/ private void fireTextMoved() { for (TextChangeListener lst : m_listeners) { lst.textSet(new TextChangedEvent(this)); } }
/** * @see org.eclipse.swt.custom.StyledTextContent#addTextChangeListener(org.eclipse.swt.custom.TextChangeListener) */ public void addTextChangeListener(TextChangeListener textChangeListener) { if (textChangeListener != null) { textChangeListeners.add(textChangeListener); } }
/** * @see org.eclipse.swt.custom.StyledTextContent#setText(java.lang.String) */ public void setText(String newText) { delete(0, size()); insert(0, newText); TextChangedEvent evt = new TextChangedEvent(this); for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) { ((TextChangeListener) iter.next()).textSet(evt); } }
/** * @param changedEvent */ private void notifyListeners(TextChangedEvent changedEvent) { for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) { TextChangeListener element = (TextChangeListener) iter.next(); element.textChanged(changedEvent); } }
/** * @param changingEvent */ private void notifyListeners(TextChangingEvent changingEvent) { for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) { TextChangeListener element = (TextChangeListener) iter.next(); element.textChanging(changingEvent); } }
@Override public void replaceTextRange(final int inStart, final int inReplaceLength, final String inText) { if (!isValidReplace(inStart, inReplaceLength)) SWT.error(SWT.ERROR_INVALID_ARGUMENT); // inform listeners final TextChangingEvent lChanging = new TextChangingEvent(this); lChanging.start = inStart; lChanging.replaceLineCount = lineCount(inStart, inReplaceLength); lChanging.newText = inText; lChanging.newLineCount = lineCount(inText); lChanging.replaceCharCount = inReplaceLength; lChanging.newCharCount = inText.length(); final Object[] lListeners = listeners.getListeners(); for (int i = 0; i < lListeners.length; ++i) { ((TextChangeListener) lListeners[i]).textChanging(lChanging); } delete(inStart, inReplaceLength, lChanging.replaceLineCount + 1); insert(inStart, inText); // inform listeners again for (int i = 0; i < lListeners.length; ++i) { ((TextChangeListener) lListeners[i]) .textChanged(new TextChangedEvent(this)); } }
@Override public void setText(final String inText) { textStore = inText.toCharArray(); gapStart = -1; gapEnd = -1; expandExp = 1; indexLines(); final Object[] lListeners = listeners.getListeners(); for (int i = 0; i < lListeners.length; ++i) { ((TextChangeListener) lListeners[i]).textSet(new TextChangedEvent( this)); } }
public void removeTextChangeListener(TextChangeListener textChangeListener) { textChangeListeners.remove(textChangeListener); }
/** * @see org.eclipse.swt.custom.StyledTextContent#removeTextChangeListener(org.eclipse.swt.custom.TextChangeListener) */ public void removeTextChangeListener(TextChangeListener textChangeListener) { textChangeListeners.remove(textChangeListener); }
@Override public void addTextChangeListener(final TextChangeListener inListener) { if (inListener == null) error(SWT.ERROR_NULL_ARGUMENT); listeners.add(inListener); }
@Override public void removeTextChangeListener(final TextChangeListener inListener) { listeners.remove(inListener); }