当前位置: 首页>>代码示例>>Java>>正文


Java SourceViewerConfiguration类代码示例

本文整理汇总了Java中org.eclipse.jface.text.source.SourceViewerConfiguration的典型用法代码示例。如果您正苦于以下问题:Java SourceViewerConfiguration类的具体用法?Java SourceViewerConfiguration怎么用?Java SourceViewerConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SourceViewerConfiguration类属于org.eclipse.jface.text.source包,在下文中一共展示了SourceViewerConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handlePreferenceStoreChanged

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
/**
 * Handles a property change event describing a change of the editor's preference delta and updates
 * the preference related editor properties.
 *
 * @param event the property change event
 */
@Override
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
	String property = event.getProperty();
	try {
		SourceViewerConfiguration config = getSourceViewerConfiguration();
		if (config != null) ((FluentMkSourceViewerConfiguration) config).handlePropertyChangeEvent(event);

		if (Prefs.EDITOR_TAB_WIDTH.equals(property)) {
			StyledText textWidget = getViewer().getTextWidget();
			int tabWidth = getSourceViewerConfiguration().getTabWidth(getViewer());
			if (textWidget.getTabs() != tabWidth) {
				textWidget.setTabs(tabWidth);
			}
			uninstallTabsToSpacesConverter();
			if (isTabsToSpacesConversionEnabled()) {
				installTabsToSpacesConverter();
			} else {
				updateIndentPrefixes();
			}
			return;
		}
	} finally {
		super.handlePreferenceStoreChanged(event);
	}
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:32,代码来源:FluentMkEditor.java

示例2: installTabsToSpacesConverter

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
@Override
protected void installTabsToSpacesConverter() {
	ISourceViewer sourceViewer = getSourceViewer();
	SourceViewerConfiguration config = getSourceViewerConfiguration();
	if (config != null && sourceViewer instanceof ITextViewerExtension7) {
		int tabWidth = config.getTabWidth(sourceViewer);
		TabsToSpacesConverter tabToSpacesConverter = new TabsToSpacesConverter();
		tabToSpacesConverter.setNumberOfSpacesPerTab(tabWidth);
		IDocumentProvider provider = getDocumentProvider();
		if (provider instanceof ICompilationUnitDocumentProvider) {
			ICompilationUnitDocumentProvider cup = (ICompilationUnitDocumentProvider) provider;
			tabToSpacesConverter.setLineTracker(cup.createLineTracker(getEditorInput()));
		} else
			tabToSpacesConverter.setLineTracker(new DefaultLineTracker());
		((ITextViewerExtension7) sourceViewer).setTabsToSpacesConverter(tabToSpacesConverter);
		updateIndentPrefixes();
	}
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:19,代码来源:TypeScriptEditor.java

示例3: createViewer

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
/**
 * Creates the viewer to be used to display the pattern. Subclasses may override.
 *
 * @param parent the parent composite of the viewer
 * @return a configured <code>SourceViewer</code>
 */
protected SourceViewer createViewer(Composite parent) {
	SourceViewer viewer= new SourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	SourceViewerConfiguration configuration= new SourceViewerConfiguration() {
		@Override
		public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

			ContentAssistant assistant= new ContentAssistant();
			assistant.enableAutoActivation(true);
			assistant.enableAutoInsert(true);
			assistant.setContentAssistProcessor(fTemplateProcessor, IDocument.DEFAULT_CONTENT_TYPE);
			return assistant;
		}
	};
	viewer.configure(configuration);
	return viewer;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:23,代码来源:E4TemplatePreferencePage.java

示例4: configureSourceViewer

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
protected void configureSourceViewer(SourceViewer sourceViewer) {
	IEditorInput editorInput = getEditorInput(sourceViewer);
	SourceViewerConfiguration sourceViewerConfiguration = createSourceViewerConfiguration(sourceViewer, editorInput);
	sourceViewer.unconfigure();
	sourceViewer.configure(sourceViewerConfiguration);
	if (sourceViewer.getDocument() instanceof IXtextDocument) {
		IXtextDocument xtextDocument = (IXtextDocument) sourceViewer.getDocument();
		if (!xtextDocument.readOnly(TEST_EXISTING_XTEXT_RESOURCE)) {
			String[] configuredContentTypes = sourceViewerConfiguration.getConfiguredContentTypes(sourceViewer);
			for (String contentType : configuredContentTypes) {
				sourceViewer.removeTextHovers(contentType);
			}
			sourceViewer.setHyperlinkDetectors(null, sourceViewerConfiguration.getHyperlinkStateMask(sourceViewer));
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:17,代码来源:DefaultMergeViewer.java

示例5: createSourceViewerConfiguration

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
protected SourceViewerConfiguration createSourceViewerConfiguration(SourceViewer sourceViewer,
		IEditorInput editorInput) {
	SourceViewerConfiguration sourceViewerConfiguration = null;
	if (editorInput != null && getEditor(sourceViewer) != null) {
		DefaultMergeEditor mergeEditor = getEditor(sourceViewer);
		sourceViewerConfiguration = mergeEditor.getXtextSourceViewerConfiguration();
		try {
			mergeEditor.init((IEditorSite) mergeEditor.getSite(), editorInput);
			mergeEditor.createActions();
		} catch (PartInitException partInitException) {
			throw new WrappedException(partInitException);
		}
	} else {
		sourceViewerConfiguration = sourceViewerConfigurationProvider.get();
	}
	return sourceViewerConfiguration;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:DefaultMergeViewer.java

示例6: configure

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
@Override
public void configure(SourceViewerConfiguration configuration)
{
	super.configure(configuration);

	fSnippetContentAssistant = new SnippetsContentAssistant();
	fSnippetContentAssistant.install(this);
	fKeyListener = new ExpandSnippetVerifyKeyListener((ITextEditor) getAdapter(ITextEditor.class), this,
			fSnippetContentAssistant);
	// add listener to our viewer
	prependVerifyKeyListener(fKeyListener);

	fPreferenceStore = EclipseUtil.instanceScope().getNode(CommonEditorPlugin.PLUGIN_ID);
	if (fPreferenceStore != null)
	{
		fPreferenceStore.addPreferenceChangeListener(this);
		setSnippetProcessorEnablement();
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:20,代码来源:CommonProjectionViewer.java

示例7: installTabsToSpacesConverter

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
@Override
protected void installTabsToSpacesConverter() {
	ISourceViewer sourceViewer= getSourceViewer();
	SourceViewerConfiguration config= getSourceViewerConfiguration();
	if (config != null && sourceViewer instanceof ITextViewerExtension7) {
		int tabWidth= config.getTabWidth(sourceViewer);
		TabsToSpacesConverter tabToSpacesConverter= new TabsToSpacesConverter();
		tabToSpacesConverter.setNumberOfSpacesPerTab(tabWidth);
		IDocumentProvider provider= getDocumentProvider();
		if (provider instanceof ICompilationUnitDocumentProvider) {
			ICompilationUnitDocumentProvider cup= (ICompilationUnitDocumentProvider) provider;
			tabToSpacesConverter.setLineTracker(cup.createLineTracker(getEditorInput()));
		} else
			tabToSpacesConverter.setLineTracker(new DefaultLineTracker());
		((ITextViewerExtension7)sourceViewer).setTabsToSpacesConverter(tabToSpacesConverter);
		updateIndentPrefixes();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:CompilationUnitEditor.java

示例8: setPreferenceStore

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
@Override
protected void setPreferenceStore(IPreferenceStore store) {
	super.setPreferenceStore(store);
	SourceViewerConfiguration sourceViewerConfiguration= getSourceViewerConfiguration();
	if (sourceViewerConfiguration == null || sourceViewerConfiguration instanceof JavaSourceViewerConfiguration) {
		JavaTextTools textTools= JavaPlugin.getDefault().getJavaTextTools();
		setSourceViewerConfiguration(new JavaSourceViewerConfiguration(textTools.getColorManager(), store, this, IJavaPartitions.JAVA_PARTITIONING));
	}

	if (getSourceViewer() instanceof JavaSourceViewer)
		((JavaSourceViewer)getSourceViewer()).setPreferenceStore(store);

	fMarkOccurrenceAnnotations= store.getBoolean(PreferenceConstants.EDITOR_MARK_OCCURRENCES);
	fStickyOccurrenceAnnotations= store.getBoolean(PreferenceConstants.EDITOR_STICKY_OCCURRENCES);
	fMarkTypeOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_TYPE_OCCURRENCES);
	fMarkMethodOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_METHOD_OCCURRENCES);
	fMarkConstantOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_CONSTANT_OCCURRENCES);
	fMarkFieldOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_FIELD_OCCURRENCES);
	fMarkLocalVariableypeOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES);
	fMarkExceptions= store.getBoolean(PreferenceConstants.EDITOR_MARK_EXCEPTION_OCCURRENCES);
	fMarkImplementors= store.getBoolean(PreferenceConstants.EDITOR_MARK_IMPLEMENTORS);
	fMarkMethodExitPoints= store.getBoolean(PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS);
	fMarkBreakContinueTargets= store.getBoolean(PreferenceConstants.EDITOR_MARK_BREAK_CONTINUE_TARGETS);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:JavaEditor.java

示例9: configureTextViewer

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
@Override
protected void configureTextViewer(TextViewer textViewer) {
	if (!(textViewer instanceof SourceViewer))
		return;

	if (fPreferenceStore == null) {
		fSourceViewerConfigurations= new ArrayList<SourceViewerConfiguration>(3);
		fPreferenceStore= JavaPlugin.getDefault().getCombinedPreferenceStore();
		fPreferenceChangeListener= new IPropertyChangeListener() {
			public void propertyChange(PropertyChangeEvent event) {
				Iterator<SourceViewerConfiguration> iter= fSourceViewerConfigurations.iterator();
				while (iter.hasNext())
					((PropertiesFileSourceViewerConfiguration)iter.next()).handlePropertyChangeEvent(event);
				invalidateTextPresentation();
			}
		};
		fPreferenceStore.addPropertyChangeListener(fPreferenceChangeListener);
	}

	SourceViewerConfiguration sourceViewerConfiguration= new PropertiesFileSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), fPreferenceStore, null,
			getDocumentPartitioning());

	fSourceViewerConfigurations.add(sourceViewerConfiguration);
	((SourceViewer)textViewer).configure(sourceViewerConfiguration);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:PropertiesFileMergeViewer.java

示例10: createPreviewer

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
private NSISSourceViewer createPreviewer(Composite parent)
{
    NSISSourceViewer previewer = new NSISSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL
                    | SWT.BORDER | SWT.WRAP);
    NSISTextUtility.hookSourceViewer(previewer);
    SourceViewerConfiguration configuration = new NSISSourceViewerConfiguration(
                    new ChainedPreferenceStore(new IPreferenceStore[] { NSISPreferences.getInstance().getPreferenceStore(),
                                    EditorsUI.getPreferenceStore() }));
    previewer.configure(configuration);
    new NSISDocumentSetupParticipant().setup(mCommandDoc);
    previewer.setDocument(mCommandDoc);
    previewer.setEditable(false);
    final StyledText textWidget = previewer.getTextWidget();
    textWidget.getCaret().setVisible(false);
    textWidget.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e)
        {
            textWidget.setSelectionRange(e.x, 0);
        }
    });
    return previewer;
}
 
开发者ID:henrikor2,项目名称:eclipsensis,代码行数:24,代码来源:NSISCommandDialog.java

示例11: createPreviewer

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
private Control createPreviewer(Composite parent)
{
    mPreviewer= new NSISSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    NSISTextUtility.hookSourceViewer(mPreviewer);
    SourceViewerConfiguration configuration= new NSISSourceViewerConfiguration(new ChainedPreferenceStore(new IPreferenceStore[]{mPreferenceStore,getPreferenceStore(), EditorsUI.getPreferenceStore()}));
    mPreviewer.configure(configuration);

    InputStream is = null;
    String content= ""; //$NON-NLS-1$
    try {
        is = getClass().getResourceAsStream("NSISPreview.txt"); //$NON-NLS-1$
        content= new String(IOUtility.loadContentFromStream(is));
    }
    catch(Exception e) {
        EclipseNSISPlugin.getDefault().log(e);
    }
    finally {
        IOUtility.closeIO(is);
    }
    IDocument document= new Document(content);
    new NSISDocumentSetupParticipant().setup(document);
    mPreviewer.setDocument(document);
    mPreviewer.setEditable(false);

    return mPreviewer.getControl();
}
 
开发者ID:henrikor2,项目名称:eclipsensis,代码行数:27,代码来源:NSISEditorPreferencePage.java

示例12: createSourceViewerConfiguration

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
@Override
public SourceViewerConfiguration createSourceViewerConfiguration() {
    PyContentAssistant contentAssist = new PyContentAssistant();
    IContentAssistProcessor processor = createConsoleCompletionProcessor(contentAssist);
    contentAssist.setContentAssistProcessor(processor, PydevScriptConsoleSourceViewerConfiguration.PARTITION_TYPE);

    contentAssist.enableAutoActivation(true);
    contentAssist.enableAutoInsert(false);
    contentAssist.setAutoActivationDelay(PyCodeCompletionPreferencesPage.getAutocompleteDelay());

    PyCorrectionAssistant quickAssist = new PyCorrectionAssistant();
    // next create a content assistant processor to populate the completions window
    IQuickAssistProcessor quickAssistProcessor = createConsoleQuickAssistProcessor(quickAssist);

    // Correction assist works on all
    quickAssist.setQuickAssistProcessor(quickAssistProcessor);

    SourceViewerConfiguration cfg = new PydevScriptConsoleSourceViewerConfiguration(createHover(), contentAssist,
            quickAssist);
    return cfg;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:22,代码来源:PydevConsole.java

示例13: createViewer

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
@Override
protected SourceViewer createViewer(Composite parent) {
	LangSourceViewer viewer = new LangSourceViewer(parent, null, null, false,
		SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	
	final IContentAssistProcessor templateProcessor = getTemplateProcessor();
	
	IDocument document = new Document();
	LangDocumentPartitionerSetup.getInstance().setup(document);
	
	IPreferenceStore store = LangUIPlugin.getDefault().getCombinedPreferenceStore();
	SourceViewerConfiguration configuration = EditorSettings_Actual
			.createTemplateEditorSourceViewerConfiguration(store, templateProcessor);
	viewer.configure(configuration);
	viewer.setEditable(true);
	viewer.setDocument(document);
	
	return viewer;
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:20,代码来源:LangTemplatePreferencePage.java

示例14: setContentAssistProcessor

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
@Override
protected void setContentAssistProcessor(ContentAssistant assistant, SourceViewerConfiguration configuration,
		ISourceViewer sourceViewer) {
	super.setContentAssistProcessor(assistant, configuration, sourceViewer);
	assistant.setContentAssistProcessor(jsDocContentAssistProcessor, TokenTypeToPartitionMapper.JS_DOC_PARTITION);
	assistant.setContentAssistProcessor(null, TokenTypeToPartitionMapper.REG_EX_PARTITION);
	assistant.setContentAssistProcessor(null, TokenTypeToPartitionMapper.TEMPLATE_LITERAL_PARTITION);
	assistant.setContentAssistProcessor(null, TerminalsTokenTypeToPartitionMapper.SL_COMMENT_PARTITION);
	assistant.setContentAssistProcessor(null, TerminalsTokenTypeToPartitionMapper.COMMENT_PARTITION);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:ContentAssistantFactory.java

示例15: handleColorSettingsChanged

import org.eclipse.jface.text.source.SourceViewerConfiguration; //导入依赖的package包/类
public void handleColorSettingsChanged() {
	// done like in TextEditor for spelling
	ISourceViewer viewer = getSourceViewer();
	SourceViewerConfiguration configuration = getSourceViewerConfiguration();
	if (viewer instanceof ISourceViewerExtension2) {
		ISourceViewerExtension2 viewerExtension2 = (ISourceViewerExtension2) viewer;
		viewerExtension2.unconfigure();
		if (configuration instanceof BatchSourceViewerConfiguration) {
			BatchSourceViewerConfiguration gconf = (BatchSourceViewerConfiguration) configuration;
			gconf.updateTextScannerDefaultColorToken();
		}
		viewer.configure(configuration);
	}
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:15,代码来源:BatchEditor.java


注:本文中的org.eclipse.jface.text.source.SourceViewerConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。