下面列出了org.eclipse.jface.text.TextEvent#getViewerRedrawState ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public void textChanged(TextEvent event) {
fCachedRedrawState= event.getViewerRedrawState();
if (!fCachedRedrawState)
return;
if (updateNumberOfDigits()) {
computeIndentations();
layout(event.getViewerRedrawState());
return;
}
boolean viewerCompletelyShown= isViewerEntirelyShown();
if (viewerCompletelyShown || fSensitiveToTextChanges || event.getDocumentEvent() == null)
doPostRedraw();
fSensitiveToTextChanges= viewerCompletelyShown;
}
public void textChanged(TextEvent event) {
fCachedRedrawState= event.getViewerRedrawState();
if (!fCachedRedrawState)
return;
postRedraw();
}
@Override
public void textChanged(TextEvent event) {
if (!event.getViewerRedrawState())
return;
updatePopupLocation(false);
updateVisibility(); //only for hiding outside editor area
}
@Override
public void textChanged(TextEvent e) {
if (fTextViewer != null && e.getDocumentEvent() == null && e.getViewerRedrawState()) {
// handle only changes of visible document
redraw();
}
}
@Override
public void textChanged(TextEvent e) {
if (!e.getViewerRedrawState()) {
return;
}
// changed text: propagate previous style, which will be overridden
// later asynchronously by TM
if (e.getDocumentEvent() != null) {
int diff = e.getText().length() - e.getLength();
if (diff == 0 || e.getOffset() <= 0) {
return;
}
StyleRange range = viewer.getTextWidget().getStyleRangeAtOffset(e.getOffset() - 1);
if (range == null) {
return;
}
range.length = Math.max(0, range.length + diff);
viewer.getTextWidget().setStyleRange(range);
return;
}
// TextViewer#invalidateTextPresentation is called (because
// of validation, folding, etc)
// case 2), do the colorization.
IDocument document = viewer.getDocument();
if (document == null) {
return;
}
IRegion region = computeRegionToRedraw(e, document);
if (enabled) {
// case where there is grammar & theme -> update text presentation with the
// grammar tokens
ITMModel model = getTMModelManager().connect(document);
if (model == null) {
return;
}
try {
TMPresentationReconciler.this.colorize(region, (TMDocumentModel) model);
} catch (BadLocationException e1) {
TMUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, TMUIPlugin.PLUGIN_ID, e1.getMessage(), e1));
}
} else {
// case where there is no grammar & theme -> update text presentation with the
// default styles (ex: to support highlighting with GenericEditor)
TextPresentation presentation = new TextPresentation(region, 100);
presentation.setDefaultStyleRange(
new StyleRange(region.getOffset(), region.getLength(), null, null));
applyTextRegionCollection(presentation);
}
}
public void textChanged(TextEvent event) {
if (!event.getViewerRedrawState())
return;
updatePopupLocation(false);
updateVisibility(); //only for hiding outside editor area
}