Java Code Examples for org.eclipse.jface.text.TextEvent#getDocumentEvent()
The following examples show how to use
org.eclipse.jface.text.TextEvent#getDocumentEvent() .
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 |
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: TypingRunDetector.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Computes the change abstraction given a text event. * * @param event the text event to analyze * @return a change object describing the event */ private Change computeChange(TextEvent event) { DocumentEvent e= event.getDocumentEvent(); if (e == null) return new Change(TypingRun.NO_CHANGE, -1); int start= e.getOffset(); int end= e.getOffset() + e.getLength(); String newText= e.getText(); if (newText == null) newText= new String(); if (start == end) { // no replace / delete / overwrite if (newText.length() == 1) return new Change(TypingRun.INSERT, end + 1); } else if (start == end - 1) { if (newText.length() == 1) return new Change(TypingRun.OVERTYPE, end); if (newText.length() == 0) return new Change(TypingRun.DELETE, start); } return new Change(TypingRun.UNKNOWN, -1); }
Example 3
Source File: TMPresentationReconcilerTestGenerator.java From tm4e with Eclipse Public License 1.0 | 5 votes |
@Override public void textChanged(TextEvent event) { if (event.getDocumentEvent() != null) { return; } String command = "viewer.invalidateTextPresentation(" + event.getOffset() + ", " + event.getLength() + ");"; write("\t\t" + command, true); //commands.add(new Command(command)); }
Example 4
Source File: CopiedOverviewRuler.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@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 |
@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: WithMinibuffer.java From e4macs with Eclipse Public License 1.0 | 4 votes |
public void textChanged(TextEvent event) { if (event.getDocumentEvent() != null) leave(true); }
Example 7
Source File: SearchMinibuffer.java From e4macs with Eclipse Public License 1.0 | 4 votes |
public void textChanged(TextEvent event) { if (event.getDocumentEvent() != null) { // leave(); } }
Example 8
Source File: OfflineActionTarget.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public void textChanged(TextEvent event) { if (event.getDocumentEvent() != null) leave(); }