org.eclipse.jface.text.IEditingSupport Java Examples

The following examples show how to use org.eclipse.jface.text.IEditingSupport. 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: OrganizeImportsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private IEditingSupport createViewerHelper() {
	return new IEditingSupport() {
		public boolean isOriginator(DocumentEvent event, IRegion subjectRegion) {
			return true; // assume true, since we only register while we are active
		}
		public boolean ownsFocusShell() {
			return fIsQueryShowing;
		}

	};
}
 
Example #2
Source File: OrganizeImportsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void registerHelper(IEditingSupport helper, JavaEditor editor) {
	ISourceViewer viewer= editor.getViewer();
	if (viewer instanceof IEditingSupportRegistry) {
		IEditingSupportRegistry registry= (IEditingSupportRegistry) viewer;
		registry.register(helper);
	}
}
 
Example #3
Source File: OrganizeImportsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void deregisterHelper(IEditingSupport helper, JavaEditor editor) {
	ISourceViewer viewer= editor.getViewer();
	if (viewer instanceof IEditingSupportRegistry) {
		IEditingSupportRegistry registry= (IEditingSupportRegistry) viewer;
		registry.unregister(helper);
	}
}
 
Example #4
Source File: AddImportOnSelectionAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private IEditingSupport createViewerHelper(final ITextSelection selection, final SelectTypeQuery query) {
	return new IEditingSupport() {

		public boolean isOriginator(DocumentEvent event, IRegion subjectRegion) {
			return subjectRegion.getOffset() <= selection.getOffset() + selection.getLength() &&  selection.getOffset() <= subjectRegion.getOffset() + subjectRegion.getLength();
		}

		public boolean ownsFocusShell() {
			return query.isShowing();
		}

	};
}
 
Example #5
Source File: AddImportOnSelectionAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void registerHelper(IEditingSupport helper) {
	ISourceViewer viewer= fEditor.getViewer();
	if (viewer instanceof IEditingSupportRegistry) {
		IEditingSupportRegistry registry= (IEditingSupportRegistry) viewer;
		registry.register(helper);
	}
}
 
Example #6
Source File: AddImportOnSelectionAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void deregisterHelper(IEditingSupport helper) {
	ISourceViewer viewer= fEditor.getViewer();
	if (viewer instanceof IEditingSupportRegistry) {
		IEditingSupportRegistry registry= (IEditingSupportRegistry) viewer;
		registry.unregister(helper);
	}
}
 
Example #7
Source File: ScriptConsoleViewerWrapper.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
public void register(IEditingSupport helper) {
    viewer.register(helper);
}
 
Example #8
Source File: ScriptConsoleViewerWrapper.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
public void unregister(IEditingSupport helper) {
    viewer.unregister(helper);
}
 
Example #9
Source File: ScriptConsoleViewerWrapper.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
public IEditingSupport[] getRegisteredSupports() {
    return viewer.getRegisteredSupports();
}