Java Code Examples for org.eclipse.jface.text.TextEvent#getViewerRedrawState()

The following examples show how to use org.eclipse.jface.text.TextEvent#getViewerRedrawState() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommonLineNumberRulerColumn.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
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;
		}
 
Example 2
Source File: BookmarkRulerColumn.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
public void textChanged(TextEvent event) {

            fCachedRedrawState= event.getViewerRedrawState();
            if (!fCachedRedrawState)
                return;

            postRedraw();
        }
 
Example 3
Source File: RenameInformationPopup.java    From typescript.java with MIT License 5 votes vote down vote up
@Override
public void textChanged(TextEvent event) {
	if (!event.getViewerRedrawState())
		return;
	updatePopupLocation(false);
	updateVisibility(); //only for hiding outside editor area
}
 
Example 4
Source File: CopiedOverviewRuler.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void textChanged(TextEvent e) {
    if (fTextViewer != null && e.getDocumentEvent() == null && e.getViewerRedrawState()) {
        // handle only changes of visible document
        redraw();
    }
}
 
Example 5
Source File: TMPresentationReconciler.java    From tm4e with Eclipse Public License 1.0 4 votes vote down vote up
@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);
	}
}
 
Example 6
Source File: RenameInformationPopup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void textChanged(TextEvent event) {
	if (!event.getViewerRedrawState())
		return;
	updatePopupLocation(false);
	updateVisibility(); //only for hiding outside editor area
}