org.eclipse.jface.text.TextEvent Java Examples
The following examples show how to use
org.eclipse.jface.text.TextEvent.
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: FixedXtextSourceViewer.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * Informs all registered text listeners about the change specified by the * widget command. This method does not use a robust iterator. * * @param cmd * the widget command translated into a text event sent to all text listeners */ @Override protected void updateTextListeners(final WidgetCommand cmd) { List<ITextListener> textListeners = fTextListeners; if (textListeners != null) { textListeners = new ArrayList<ITextListener>(textListeners); DocumentEvent event = cmd.event; if (event instanceof SlaveDocumentEvent) { event = ((SlaveDocumentEvent) event).getMasterEvent(); } TextEvent e = new TextEvent(cmd.start, cmd.length, cmd.text, cmd.preservedText, event, redraws()) {}; for (int i = 0; i < textListeners.size(); i++) { ITextListener l = textListeners.get(i); l.textChanged(e); } } }
Example #2
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 #3
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 #4
Source File: XMLEditor.java From uima-uimaj with Apache License 2.0 | 5 votes |
@Override public void textChanged(TextEvent event) { if (!m_bIgnoreTextEvent) { editor.sourceChanged = true; editor.setFileDirty(); } }
Example #5
Source File: TMPresentationReconciler.java From tm4e with Eclipse Public License 1.0 | 5 votes |
/** * Translates the given text event into the corresponding range of the viewer's * document. * * @param e * the text event * @return the widget region corresponding the region of the given event or * <code>null</code> if none * @since 2.1 */ private IRegion widgetRegion2ModelRegion(TextEvent e) { String text = e.getText(); int length = text == null ? 0 : text.length(); if (viewer instanceof ITextViewerExtension5) { ITextViewerExtension5 extension = (ITextViewerExtension5) viewer; return extension.widgetRange2ModelRange(new Region(e.getOffset(), length)); } IRegion visible = viewer.getVisibleRegion(); return new Region(e.getOffset() + visible.getOffset(), length); }
Example #6
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 #7
Source File: PatternExpressionViewer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createTextViewer() { viewer = createViewer(mc); viewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); configureTextViewer(); addLineStyleListener(); helpDecoration = new ControlDecoration(viewer.getControl(), SWT.TOP | SWT.RIGHT, this); helpDecoration.setImage(JFaceResources.getImage(Dialog.DLG_IMG_HELP)); helpDecoration.setDescriptionText(Messages.patternViewerHint); helpDecoration.setMarginWidth(2); helpDecoration.hide(); hintDecoration = new ControlDecoration(viewer.getControl(), SWT.TOP | SWT.LEFT, this); hintDecoration.setImage(Pics.getImage(PicsConstants.hint)); hintDecoration.setMarginWidth(2); hintDecoration.setShowHover(true); hintDecoration.setShowOnlyOnFocus(true); hintDecoration.hide(); viewer.addTextListener(new ITextListener() { @Override public void textChanged(final TextEvent event) { viewer.getTextWidget().notifyListeners(SWT.Modify, new Event()); } }); helpDecoration.show(); }
Example #8
Source File: BookmarkRulerColumn.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
public void textChanged(TextEvent event) { fCachedRedrawState= event.getViewerRedrawState(); if (!fCachedRedrawState) return; postRedraw(); }
Example #9
Source File: EditorListener.java From saros with GNU General Public License v2.0 | 5 votes |
@Override public void textChanged(TextEvent event) { String text = event.getText(); String replaced = event.getReplacedText(); if ((text != null && text.indexOf('\n') != -1) || (replaced != null && replaced.indexOf('\n') != -1)) { generateViewport(); } }
Example #10
Source File: RenameInformationPopup.java From typescript.java with MIT License | 5 votes |
@Override public void textChanged(TextEvent event) { if (!event.getViewerRedrawState()) return; updatePopupLocation(false); updateVisibility(); //only for hiding outside editor area }
Example #11
Source File: WizardPreviewProvider.java From n4js with Eclipse Public License 1.0 | 5 votes |
private void configureSourceViewer(SourceViewer viewer) { viewer.setEditable(false); viewer.addTextListener(new ITextListener() { @Override public void textChanged(TextEvent event) { updateHighlighting(); sourceViewer.getTextWidget().setFont(editorFont); } }); }
Example #12
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 #13
Source File: TypingRunDetector.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void textChanged(TextEvent event) { handleTextChanged(event); }
Example #14
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(); }
Example #15
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 #16
Source File: UniversalMinibuffer.java From e4macs with Eclipse Public License 1.0 | 4 votes |
public void textChanged(TextEvent event) { // During execution of sub-command, text can change if (!isExecuting()) { super.textChanged(event); } }
Example #17
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 #18
Source File: ReportXMLSourceEditorFormPage.java From birt with Eclipse Public License 1.0 | 4 votes |
public void createPartControl( Composite parent ) { reportXMLEditor.createPartControl( parent ); Control[] children = parent.getChildren( ); control = children[children.length - 1]; ModuleHandle model = getModel( ); // suport the mediator SessionHandleAdapter.getInstance( ) .getMediator( model ) .addColleague( this ); // Add Command Stack Listener if ( model != null && model.getCommandStack( ) != null ) { getCommandStack( model ).addCommandStackListener( getCommandStackListener( ) ); hookModelEventManager( model ); } reportXMLEditor.getTextViewer( ).addTextListener( new ITextListener( ) { public void textChanged( TextEvent event ) { if ( !isTextModified( ) && event.getOffset( ) != 0 ) { markDirty( ); } } } ); reportXMLEditor.getTextViewer( ) .getTextWidget( ) .addModifyListener( new ModifyListener( ) { public void modifyText( ModifyEvent e ) { markDirty( ); } } ); }
Example #19
Source File: RenameInformationPopup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void textChanged(TextEvent event) { if (!event.getViewerRedrawState()) return; updatePopupLocation(false); updateVisibility(); //only for hiding outside editor area }
Example #20
Source File: DirtyMarkingListener.java From tlaplus with MIT License | 4 votes |
public void textChanged(TextEvent event) { perform(); }
Example #21
Source File: SootResourceManager.java From JAADAS with GNU General Public License v3.0 | 4 votes |
public void textChanged(TextEvent e){ }
Example #22
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 #23
Source File: TypingRunDetector.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 2 votes |
/** * Handles an incoming text event. * * @param event the text event that describes the text modification */ void handleTextChanged(TextEvent event) { Change type= computeChange(event); handleChange(type); }