下面列出了org.eclipse.ui.editors.text.EditorsUI#getSpellingService ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
if (!EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
return null;
IReconcilingStrategy strategy= new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) {
@Override
protected IContentType getContentType() {
return PROPERTIES_CONTENT_TYPE;
}
};
MonoReconciler reconciler= new MonoReconciler(strategy, false);
reconciler.setDelay(500);
return reconciler;
}
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
if (!EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
return null;
IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) {
@Override
protected IContentType getContentType() {
return EditorConfigTextTools.EDITORCONFIG_CONTENT_TYPE;
}
};
MonoReconciler reconciler = new MonoReconciler(strategy, false);
reconciler.setDelay(500);
return reconciler;
}
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
return null;
}
SpellingService spellingService = EditorsUI.getSpellingService();
if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) == null) {
return null;
}
//Overridden (just) to return a PyReconciler!
IReconcilingStrategy strategy = new PyReconciler(sourceViewer, spellingService);
MonoReconciler reconciler = new MonoReconciler(strategy, false);
reconciler.setIsIncrementalReconciler(false);
reconciler.setProgressMonitor(new NullProgressMonitor());
reconciler.setDelay(500);
return reconciler;
}
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer)
{
if (fTextEditor != null && fTextEditor.isEditable())
{
IReconcilingStrategy reconcilingStrategy = new CommonReconcilingStrategy(fTextEditor);
if (EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
{
SpellingService spellingService = EditorsUI.getSpellingService();
Collection<String> spellingContentTypes = getSpellingContentTypes(sourceViewer);
if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) != null
&& !spellingContentTypes.isEmpty())
{
reconcilingStrategy = new CompositeReconcilingStrategy(reconcilingStrategy,
new MultiRegionSpellingReconcileStrategy(sourceViewer, spellingService,
getConfiguredDocumentPartitioning(sourceViewer), spellingContentTypes));
}
}
CommonReconciler reconciler = new CommonReconciler(reconcilingStrategy);
reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
reconciler.setIsIncrementalReconciler(false);
reconciler.setIsAllowedToModifyDocument(false);
reconciler.setProgressMonitor(new NullProgressMonitor());
reconciler.setDelay(500);
return fReconciler = reconciler;
}
return null;
}
protected XtextSpellingReconcileStrategy(ISourceViewer viewer) {
super(viewer, EditorsUI.getSpellingService());
spellingContext.setContentType(getContentType());
}
/**
* Creates a new comment reconcile strategy.
*
* @param viewer the source viewer
* @param editor the text editor to operate on
*/
public SourceCodeSpellingReconcileStrategy(ISourceViewer viewer) {
super(viewer, EditorsUI.getSpellingService());
}
/**
* Creates a new comment reconcile strategy.
*
* @param viewer the source viewer
* @param editor the text editor to operate on
*/
public JavaSpellingReconcileStrategy(ISourceViewer viewer, ITextEditor editor) {
super(viewer, EditorsUI.getSpellingService());
fEditor= editor;
}