/** * Creates content change listeners and set the default content model. */ void installDefaultContent() { textChangeListener = new TextChangeListener() { public void textChanging(TextChangingEvent event) { handleTextChanging(event); } public void textChanged(TextChangedEvent event) { handleTextChanged(event); } public void textSet(TextChangedEvent event) { handleTextSet(event); } }; content = new DefaultContent(); content.addTextChangeListener(textChangeListener); } /**
/** * Creates content change listeners and set the default content model. */ void installDefaultContent() { textChangeListener = new TextChangeListener() { @Override public void textChanging(TextChangingEvent event) { handleTextChanging(event); } @Override public void textChanged(TextChangedEvent event) { handleTextChanged(event); } @Override public void textSet(TextChangedEvent event) { handleTextSet(event); } }; content = new DefaultContent(); content.addTextChangeListener(textChangeListener); } /**
/** * Creates content change listeners and set the default content model. */ void installDefaultContent() { textChangeListener = new TextChangeListener() { @Override public void textChanging(TextChangingEvent event) { handleTextChanging(event); } @Override public void textChanged(TextChangedEvent event) { handleTextChanged(event); } @Override public void textSet(TextChangedEvent event) { handleTextSet(event); } }; content = new DefaultContent(); content.addTextChangeListener(textChangeListener); } /**
/** * Creates content change listeners and set the default content model. */ void installDefaultContent() { textChangeListener = new TextChangeListener() { @Override public void textChanging(TextChangingEvent event) { handleTextChanging(event); } @Override public void textChanged(TextChangedEvent event) { handleTextChanged(event); } @Override public void textSet(TextChangedEvent event) { handleTextSet(event); } }; content = new DefaultContent(); content.addTextChangeListener(textChangeListener); } /**
/** * Creates content change listeners and set the default content model. */ void installDefaultContent() { textChangeListener = new TextChangeListener() { @Override public void textChanging(TextChangingEvent event) { handleTextChanging(event); } @Override public void textChanged(TextChangedEvent event) { handleTextChanged(event); } @Override public void textSet(TextChangedEvent event) { handleTextSet(event); } }; content = new DefaultContent(); content.addTextChangeListener(textChangeListener); } /**
@Override public void install(AbstractThemedScrollBarAdapter abstractThemedScrollBarAdapter) { super.install(abstractThemedScrollBarAdapter); fStyledText.addModifyListener(this); this.fAbstractThemedScrollBarAdapter = abstractThemedScrollBarAdapter; fTextContent = fStyledText.getContent(); fTextContent.addTextChangeListener(this); if(fScrollBar != null){ fLastMax = fScrollBar.getMaximum(); fLastSelection = fScrollBar.getSelection(); } }
/** * Sets the content implementation to use for text storage. * * @param newContent StyledTextContent implementation to use for text storage. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> */ public void setContent(StyledTextContent newContent) { checkWidget(); if (newContent == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } if (content != null) { content.removeTextChangeListener(textChangeListener); } content = newContent; content.addTextChangeListener(textChangeListener); reset(); } /**
/** * Sets the content implementation to use for text storage. * * @param newContent StyledTextContent implementation to use for text storage. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> */ public void setContent(StyledTextContent newContent) { checkWidget(); if (newContent == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } if (content != null) { content.removeTextChangeListener(textChangeListener); } content = newContent; content.addTextChangeListener(textChangeListener); reset(); } /**
/** * Sets the content implementation to use for text storage. * * @param newContent StyledTextContent implementation to use for text storage. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> */ public void setContent(StyledTextContent newContent) { checkWidget(); if (newContent == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } if (content != null) { content.removeTextChangeListener(textChangeListener); } content = newContent; content.addTextChangeListener(textChangeListener); reset(); } /**
/** * Sets the content implementation to use for text storage. * * @param newContent StyledTextContent implementation to use for text storage. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> */ public void setContent(StyledTextContent newContent) { checkWidget(); if (newContent == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } if (content != null) { content.removeTextChangeListener(textChangeListener); } content = newContent; content.addTextChangeListener(textChangeListener); reset(); } /**
/** * Sets the content implementation to use for text storage. * * @param newContent StyledTextContent implementation to use for text storage. * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when listener is null</li> * </ul> */ public void setContent(StyledTextContent newContent) { checkWidget(); if (newContent == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } if (content != null) { content.removeTextChangeListener(textChangeListener); } content = newContent; content.addTextChangeListener(textChangeListener); reset(); } /**
@Override public void paintControl(GC gc, Rectangle currClientArea, Scrollable scrollable) { // At each paint, check if the content changed and keep the last // max/selection (unfortunately, it doesn't provide a reliable way // to listen such changes, so, we must poll it). if(fScrollBar != null){ fLastMax = fScrollBar.getMaximum(); fLastSelection = fScrollBar.getSelection(); } if (fTextContent != null && fStyledText.getContent() != fTextContent) { fTextContent.removeTextChangeListener(this); fTextContent = fStyledText.getContent(); fTextContent.addTextChangeListener(this); } super.paintControl(gc, currClientArea, scrollable); } }
void install() { StyledText editorTextWidget = fEditorViewer.getTextWidget(); fScaledFonts = new HashMap<>(); // Compute scaled font Font scaledFont = getScaledFont(editorTextWidget.getFont()); fMinimapTextWidget.setFont(scaledFont); // track changed content of styled text of the editor editorTextWidget.getContent().addTextChangeListener(this); // track changed styles of styled text of the editor fMinimapTextWidget.setBackground(editorTextWidget.getBackground()); fMinimapTextWidget.setForeground(editorTextWidget.getForeground()); if (fEditorViewer instanceof ITextViewerExtension4) { ((ITextViewerExtension4) fEditorViewer).addTextPresentationListener(this); } fEditorViewer.addTextInputListener(this); // track changed of vertical bar scroll to update highlight // Viewport. fEditorViewer.addViewportListener(this); editorTextWidget.addControlListener(this); synchTextAndStyles(); }
styledText.getContent().addTextChangeListener (new TextChangeListener() { @Override public void textChanged(TextChangedEvent event) {
boxText.addMouseMoveListener(boxMouseMove); boxText.addMouseTrackListener(boxMouseTrack); boxText.getContent().addTextChangeListener(boxTextChange); boxText.addMouseListener(fillMouseClick); boxText.addModifyListener(boxModify);