use of org.eclipse.jface.text.ITextInputListener in project xtext-eclipse by eclipse.
the class OutlinePage method configureTextInputListener.
/**
* @since 2.0
*/
protected void configureTextInputListener() {
textInputListener = new ITextInputListener() {
@Override
public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
try {
if (xtextDocument != null && modelListener != null)
xtextDocument.removeModelListener(modelListener);
xtextDocument = XtextDocumentUtil.get(newInput);
if (xtextDocument != null && modelListener != null) {
xtextDocument.addModelListener(modelListener);
scheduleRefresh();
}
} catch (Throwable t) {
LOG.error("Error refreshing outline", t);
}
}
@Override
public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
}
};
sourceViewer.addTextInputListener(textInputListener);
}
use of org.eclipse.jface.text.ITextInputListener in project eclipse.platform.text by eclipse.
the class AnnotationPainter method addAnnotationType.
/**
* Adds the given annotation type to the list of annotation types whose annotations should be
* painted by this painter using the given strategy. If the annotation type is already in this
* list, the old strategy gets replaced.
*
* @param annotationType the annotation type
* @param strategyID the id of the drawing or text style strategy that should be used for this
* annotation type
* @since 3.0
*/
public void addAnnotationType(Object annotationType, Object strategyID) {
fAnnotationType2PaintingStrategyId.put(annotationType, strategyID);
fCachedAnnotationType2PaintingStrategy.clear();
if (fTextInputListener == null) {
fTextInputListener = new ITextInputListener() {
@Override
public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
fInputDocumentAboutToBeChanged = true;
}
@Override
public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
fInputDocumentAboutToBeChanged = false;
}
};
fSourceViewer.addTextInputListener(fTextInputListener);
}
}
Aggregations