Java 类org.eclipse.jface.text.ITextListener 实例源码

项目:mesfavoris    文件:BookmarkCommentArea.java   
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
            }
        }
    };
}
项目:dsl-devkit    文件:FixedXtextSourceViewer.java   
/**
 * 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);
    }
  }
}
项目:bts    文件:EmbeddedEditorFactory.java   
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;
        }
项目:PDFReporter-Studio    文件:XMLEditor.java   
/**
 * 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){

                }
            }
        }
    });
}
项目:n4js    文件:WizardPreviewProvider.java   
private void configureSourceViewer(SourceViewer viewer) {
    viewer.setEditable(false);

    viewer.addTextListener(new ITextListener() {
        @Override
        public void textChanged(TextEvent event) {
            updateHighlighting();
            sourceViewer.getTextWidget().setFont(editorFont);
        }
    });

}
项目:gwt-eclipse-plugin    文件:DelegatingTextViewer.java   
public void addTextListener(ITextListener listener) {
  originalTextViewer.addTextListener(listener);
}
项目:gwt-eclipse-plugin    文件:DelegatingTextViewer.java   
public void removeTextListener(ITextListener listener) {
  originalTextViewer.removeTextListener(listener);
}
项目:strutsclipse    文件:MockTextViewer.java   
@Override
public void addTextListener(ITextListener listener) {
}
项目:strutsclipse    文件:MockTextViewer.java   
@Override
public void removeTextListener(ITextListener listener) {
}
项目:birt    文件:ReportXMLSourceEditorFormPage.java   
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( );
                }
            } );
}
项目:Pydev    文件:ScriptConsoleViewerWrapper.java   
@Override
public void addTextListener(ITextListener listener) {
    viewer.addTextListener(listener);
}
项目:Pydev    文件:ScriptConsoleViewerWrapper.java   
@Override
public void removeTextListener(ITextListener listener) {
    viewer.removeTextListener(listener);
}