當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。