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

The following examples show how to use org.eclipse.jface.text.source.ISourceViewer#configure() . 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: DefaultContentViewer.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void configureSourceViewer(ISourceViewer sourceViewer) {
	sourceViewer.setEditable(false);
	sourceViewer.configure(sourceViewerConfiguration);
	if (sourceViewer instanceof ITextViewerExtension6) {
		ITextViewerExtension6 textViewerExtension6 = (ITextViewerExtension6) sourceViewer;
		textViewerExtension6.setHyperlinkDetectors(null,
				sourceViewerConfiguration.getHyperlinkStateMask(sourceViewer));
	}
	if (sourceViewer instanceof ITextViewerExtension2) {
		ITextViewerExtension2 textViewerExtension2 = (ITextViewerExtension2) sourceViewer;
		String[] configuredContentTypes = sourceViewerConfiguration.getConfiguredContentTypes(sourceViewer);
		for (String contentType : configuredContentTypes) {
			textViewerExtension2.removeTextHovers(contentType);
		}
	}
}
 
Example 2
Source File: JavaScriptLightWeightEditor.java    From typescript.java with MIT License 6 votes vote down vote up
@Override
protected void doSetInput(IEditorInput input) throws CoreException {
	ISourceViewer sourceViewer = getSourceViewer();
	if (!(sourceViewer instanceof ISourceViewerExtension2)) {
		setPreferenceStore(createCombinedPreferenceStore(input));
		internalDoSetInput(input);
		return;
	}

	// uninstall & unregister preference store listener
	getSourceViewerDecorationSupport(sourceViewer).uninstall();
	((ISourceViewerExtension2) sourceViewer).unconfigure();

	setPreferenceStore(createCombinedPreferenceStore(input));

	// install & register preference store listener
	sourceViewer.configure(getSourceViewerConfiguration());
	getSourceViewerDecorationSupport(sourceViewer).install(getPreferenceStore());

	internalDoSetInput(input);
}
 
Example 3
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void doSetInput(IEditorInput input) throws CoreException {
	ISourceViewer sourceViewer= getSourceViewer();
	if (!(sourceViewer instanceof ISourceViewerExtension2)) {
		setPreferenceStore(createCombinedPreferenceStore(input));
		internalDoSetInput(input);
		return;
	}

	// uninstall & unregister preference store listener
	getSourceViewerDecorationSupport(sourceViewer).uninstall();
	((ISourceViewerExtension2)sourceViewer).unconfigure();

	setPreferenceStore(createCombinedPreferenceStore(input));

	// install & register preference store listener
	sourceViewer.configure(getSourceViewerConfiguration());
	getSourceViewerDecorationSupport(sourceViewer).install(getPreferenceStore());

	internalDoSetInput(input);
}
 
Example 4
Source File: ContentAssistProcessorTestBuilder.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected ISourceViewer getSourceViewer(Shell shell, final IXtextDocument xtextDocument,
		XtextSourceViewerConfiguration configuration) {
	XtextSourceViewer.Factory factory = get(XtextSourceViewer.Factory.class);
	ISourceViewer sourceViewer = factory.createSourceViewer(shell, null, null, false, 0);
	sourceViewer.configure(configuration);
	sourceViewer.setDocument(xtextDocument);
	return sourceViewer;
}
 
Example 5
Source File: ContentAssistProcessorTestBuilder.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected ISourceViewer getSourceViewer(Shell shell, final IXtextDocument xtextDocument,
		XtextSourceViewerConfiguration configuration) {
	XtextSourceViewer.Factory factory = get(XtextSourceViewer.Factory.class);
	ISourceViewer sourceViewer = factory.createSourceViewer(shell, null, null, false, 0);
	sourceViewer.configure(configuration);
	sourceViewer.setDocument(xtextDocument);
	return sourceViewer;
}
 
Example 6
Source File: DotProposalProviderDelegator.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
private ISourceViewer getSourceViewer(Shell shell,
		final IXtextDocument xtextDocument,
		XtextSourceViewerConfiguration configuration) {
	XtextSourceViewer.Factory factory = get(
			XtextSourceViewer.Factory.class);
	ISourceViewer sourceViewer = factory.createSourceViewer(shell, null,
			null, false, 0);
	sourceViewer.configure(configuration);
	sourceViewer.setDocument(xtextDocument);
	return sourceViewer;
}