org.eclipse.jface.text.ITextListener Java Examples

The following examples show how to use org.eclipse.jface.text.ITextListener. 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 vote down vote up
/**
 * 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: WizardPreviewProvider.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private void configureSourceViewer(SourceViewer viewer) {
	viewer.setEditable(false);

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

}
 
Example #3
Source File: PatternExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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 #4
Source File: DummyTextViewer.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void addTextListener(ITextListener listener) {
	throw new UnsupportedOperationException();
}
 
Example #5
Source File: DummyTextViewer.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void removeTextListener(ITextListener listener) {
	throw new UnsupportedOperationException();
}
 
Example #6
Source File: MockableTextViewer.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void addTextListener(ITextListener listener) {
	throw new UnsupportedOperationException();
}
 
Example #7
Source File: MockableTextViewer.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void removeTextListener(ITextListener listener) {
	throw new UnsupportedOperationException();
}
 
Example #8
Source File: MockableTextViewer.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void addTextListener(ITextListener listener) {
	throw new UnsupportedOperationException();
}
 
Example #9
Source File: MockableTextViewer.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void removeTextListener(ITextListener listener) {
	throw new UnsupportedOperationException();
}
 
Example #10
Source File: DotHtmlLabelHoverFakeSourceViewer.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void addTextListener(ITextListener listener) {
	throw new UnsupportedOperationException();
}
 
Example #11
Source File: DotHtmlLabelHoverFakeSourceViewer.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void removeTextListener(ITextListener listener) {
	throw new UnsupportedOperationException();
}
 
Example #12
Source File: DelegatingTextViewer.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
public void addTextListener(ITextListener listener) {
  originalTextViewer.addTextListener(listener);
}
 
Example #13
Source File: DelegatingTextViewer.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
public void removeTextListener(ITextListener listener) {
  originalTextViewer.removeTextListener(listener);
}
 
Example #14
Source File: ReportXMLSourceEditorFormPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
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 #15
Source File: ScriptConsoleViewerWrapper.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void addTextListener(ITextListener listener) {
    viewer.addTextListener(listener);
}
 
Example #16
Source File: ScriptConsoleViewerWrapper.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void removeTextListener(ITextListener listener) {
    viewer.removeTextListener(listener);
}