private ITextListener getTextListener() { return new ITextListener() { @Override public void textChanged(final TextEvent event) { if (bookmark == null || !getSourceViewer().isEditable()) { return; } final String newComment = getDocument().get(); try { SetBookmarkCommentOperation operation = new SetBookmarkCommentOperation(bookmarkDatabase); operation.setComment(bookmark.getId(), newComment); } catch (BookmarksException e) { // never happen } } }; }
/** * 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); } } }
protected OperationHistoryListener installUndoRedoSupport(SourceViewer viewer, IDocument document, final EmbeddedEditorActions actions) { IDocumentUndoManager undoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(document); final IUndoContext context = undoManager.getUndoContext(); // XXX cp uncommented // IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory(); OperationHistoryListener operationHistoryListener = new OperationHistoryListener(context, new IUpdate() { public void update() { actions.updateAction(ITextEditorActionConstants.REDO); actions.updateAction(ITextEditorActionConstants.UNDO); } }); viewer.addTextListener(new ITextListener() { public void textChanged(TextEvent event) { actions.updateAction(ITextEditorActionConstants.REDO); actions.updateAction(ITextEditorActionConstants.UNDO); } }); // // operationHistory.addOperationHistoryListener(operationHistoryListener); return operationHistoryListener; }
/** * When the editor is graphically created then add a text change listener * to the viewer */ @Override public void createPartControl(Composite parent) { super.createPartControl(parent); getSourceViewer().addTextListener(new ITextListener() { @Override public void textChanged(TextEvent event) { if (outlinePage != null) { String text = getSourceViewer().getTextWidget().getText(); try{ outlinePage.setInput(text); }catch(Exception ex){ } } } }); }
private void configureSourceViewer(SourceViewer viewer) { viewer.setEditable(false); viewer.addTextListener(new ITextListener() { @Override public void textChanged(TextEvent event) { updateHighlighting(); sourceViewer.getTextWidget().setFont(editorFont); } }); }
public void addTextListener(ITextListener listener) { originalTextViewer.addTextListener(listener); }
public void removeTextListener(ITextListener listener) { originalTextViewer.removeTextListener(listener); }
@Override public void addTextListener(ITextListener listener) { }
@Override public void removeTextListener(ITextListener listener) { }
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( ); } } ); }
@Override public void addTextListener(ITextListener listener) { viewer.addTextListener(listener); }
@Override public void removeTextListener(ITextListener listener) { viewer.removeTextListener(listener); }