Java Code Examples for org.eclipse.jface.text.source.ISourceViewer#addTextListener()

The following examples show how to use org.eclipse.jface.text.source.ISourceViewer#addTextListener() . 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: RenameInformationPopup.java    From typescript.java with MIT License 5 votes vote down vote up
public void start() {
			fEditor.getSite().getWorkbenchWindow().getPartService().addPartListener(this);
			final ISourceViewer viewer= fEditor.getViewer();
			final StyledText textWidget= viewer.getTextWidget();
			textWidget.addControlListener(this);
			textWidget.addMouseListener(this);
			textWidget.addKeyListener(this);
			fEditor.getSite().getShell().addControlListener(this);
			viewer.addTextListener(this);
			viewer.addViewportListener(this);
			fPopup.addDisposeListener(new DisposeListener() {
				@Override
				public void widgetDisposed(DisposeEvent e) {
					fEditor.getSite().getWorkbenchWindow().getPartService().removePartListener(PopupVisibilityManager.this);
					if (! textWidget.isDisposed()) {
						textWidget.removeControlListener(PopupVisibilityManager.this);
						textWidget.removeMouseListener(PopupVisibilityManager.this);
						textWidget.removeKeyListener(PopupVisibilityManager.this);
					}
					fEditor.getSite().getShell().removeControlListener(PopupVisibilityManager.this);
					viewer.removeTextListener(PopupVisibilityManager.this);
					viewer.removeViewportListener(PopupVisibilityManager.this);
//					if (fMenuImage != null) {
//						fMenuImage.dispose();
//						fMenuImage= null;
//					}
					if (fMenuManager != null) {
						fMenuManager.dispose();
						fMenuManager= null;
					}
					fRenameLinkedMode.cancel();
				}
			});
		}
 
Example 2
Source File: RenameInformationPopup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void start() {
	fEditor.getSite().getWorkbenchWindow().getPartService().addPartListener(this);
	final ISourceViewer viewer= fEditor.getViewer();
	final StyledText textWidget= viewer.getTextWidget();
	textWidget.addControlListener(this);
	textWidget.addMouseListener(this);
	textWidget.addKeyListener(this);
	fEditor.getSite().getShell().addControlListener(this);
	viewer.addTextListener(this);
	viewer.addViewportListener(this);
	fPopup.addDisposeListener(new DisposeListener() {
		public void widgetDisposed(DisposeEvent e) {
			fEditor.getSite().getWorkbenchWindow().getPartService().removePartListener(PopupVisibilityManager.this);
			if (! textWidget.isDisposed()) {
				textWidget.removeControlListener(PopupVisibilityManager.this);
				textWidget.removeMouseListener(PopupVisibilityManager.this);
				textWidget.removeKeyListener(PopupVisibilityManager.this);
			}
			fEditor.getSite().getShell().removeControlListener(PopupVisibilityManager.this);
			viewer.removeTextListener(PopupVisibilityManager.this);
			viewer.removeViewportListener(PopupVisibilityManager.this);
			if (fMenuImage != null) {
				fMenuImage.dispose();
				fMenuImage= null;
			}
			if (fMenuManager != null) {
				fMenuManager.dispose();
				fMenuManager= null;
			}
			fRenameLinkedMode.cancel();
		}
	});
}
 
Example 3
Source File: SootPlugin.java    From JAADAS with GNU General Public License v3.0 4 votes vote down vote up
public void addEditorViewer(ISourceViewer viewer) {
	viewer.addTextListener(getManager());
	getEditorViewers().add(viewer);
}