/** * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer) */ @Override public IReconciler getReconciler(ISourceViewer sourceViewer) { if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) return null; if (!TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.ECLIPSE_BUILDIN_SPELLCHECKER)) return null; //Set TeXlipse spelling Engine as default PreferenceStore store = new PreferenceStore(); store.setValue(SpellingService.PREFERENCE_SPELLING_ENGINE, "org.eclipse.texlipse.LaTeXSpellEngine"); store.setValue(SpellingService.PREFERENCE_SPELLING_ENABLED, true); SpellingService spellingService = new SpellingService(store); if (spellingService.getActiveSpellingEngineDescriptor(store) == null) return null; IReconcilingStrategy strategy= new TeXSpellingReconcileStrategy(sourceViewer, spellingService); MonoReconciler reconciler= new MonoReconciler(strategy, true); reconciler.setDelay(500); reconciler.setProgressMonitor(new NullProgressMonitor()); 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 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; }
private static IReconcilingStrategy create(IPreferenceStore preferenceStore, IResource resource) { if (EditorConfigConstants.EDITORCONFIG.equals(resource.getName())) { // it's an .editorconfig file, add validation CompositeReconcilingStrategy strategy = new CompositeReconcilingStrategy(); strategy.setReconcilingStrategies(new IReconcilingStrategy[] { new ValidateEditorConfigStrategy(resource), new ValidateAppliedOptionsStrategy(preferenceStore, resource), new EditorConfigFoldingStrategy() }); return strategy; } return new ValidateAppliedOptionsStrategy(preferenceStore, resource); }
public IReconcilingStrategy[] getReconcilingStrategies() { if (store.getBoolean(Prefs.SPELLING_ENABLED)) { SpellingService service = new SpellingService(store); if (service.getActiveSpellingEngineDescriptor(store) != null) { IReconcilingStrategy spellStrategy = new SpellingReconcileStrategy(viewer, service); return new IReconcilingStrategy[] { spellStrategy }; } } return new IReconcilingStrategy[] { new NullReconcilingStrategy() }; }
@Override public void setDocument(IDocument document) { if (strategies == null) return; for (IReconcilingStrategy strategy : strategies) { strategy.setDocument(document); } }
@Override public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) { if (strategies == null) return; for (IReconcilingStrategy strategy : strategies) { strategy.reconcile(dirtyRegion, subRegion); } }
@Override public void reconcile(IRegion partition) { if (strategies == null) return; for (IReconcilingStrategy strategy : strategies) { strategy.reconcile(partition); } }
@Override public void setProgressMonitor(IProgressMonitor monitor) { if (strategies == null) return; for (IReconcilingStrategy strategy : strategies) { if (strategy instanceof IReconcilingStrategyExtension) { IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy; extension.setProgressMonitor(monitor); } } }
@Override public void initialReconcile() { if (strategies == null) return; for (IReconcilingStrategy strategy : strategies) { if (strategy instanceof IReconcilingStrategyExtension) { IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy; extension.initialReconcile(); } } }
protected IReconcilingStrategy getTypeScriptFoldingStrategy() { if ("org.eclipse.wst.jsdt.core.jsSource".equals(contentType)) { return super.getFoldingStrategy(); } if (foldingStrategy == null) { ITextViewer viewer = getTextViewer(); if (viewer instanceof ProjectionViewer) { foldingStrategy = new TypeScriptFoldingStrategy(); foldingStrategy.setViewer((ProjectionViewer) viewer); foldingStrategy.setDocument(getDocument()); } } return foldingStrategy; }
protected IReconcilingStrategy getCodeLensStrategy() { if (!TypeScriptUIPlugin.getDefault().getPreferenceStore() .getBoolean(TypeScriptUIPreferenceConstants.EDITOR_ACTIVATE_CODELENS)) { return null; } if (codeLensStrategy == null && getDocument() != null) { if (getTextViewer() instanceof ISourceViewer) { ISourceViewer viewer = (ISourceViewer) getTextViewer(); codeLensStrategy = new TypeScriptCodeLensStrategy(viewer); codeLensStrategy.setDocument(getDocument()); codeLensStrategy.setProgressMonitor(new NullProgressMonitor()); } } return codeLensStrategy; }
@Override protected IReconcilingStrategy getSpellcheckStrategy() { if (spellcheckStrategy == null) { String contentTypeId = getContentType(getDocument()); if (contentTypeId != null) { if (getTextViewer() instanceof ISourceViewer) { ISourceViewer viewer = (ISourceViewer) getTextViewer(); spellcheckStrategy = new UiBinderSpellcheckStrategy(viewer, contentTypeId); spellcheckStrategy.setDocument(getDocument()); } } } return spellcheckStrategy; }
@Override public IReconciler getReconciler(ISourceViewer sourceViewer) { JavaReconciler reconciler = (JavaReconciler) super.getReconciler(sourceViewer); if (reconciler != null) { try { JavaCompositeReconcilingStrategy strategy = (JavaCompositeReconcilingStrategy) reconciler.getReconcilingStrategy(IDocument.DEFAULT_CONTENT_TYPE); IReconcilingStrategy[] strategies = strategy.getReconcilingStrategies(); IReconcilingStrategy[] newStrategies = new IReconcilingStrategy[strategies.length]; for (int i = 0; i < strategies.length; i++) { if (strategies[i] instanceof JavaSpellingReconcileStrategy) { // Replace the default Java reconcile strategy with our own, which // will suppress spell checking within JSNI blocks newStrategies[i] = new GWTJavaSpellingReconcileStrategy( sourceViewer, getEditor()); } else { newStrategies[i] = strategies[i]; } } strategy.setReconcilingStrategies(newStrategies); } catch (Exception e) { // We're being defensive to ensure that we always return a reconciler GWTPluginLog.logError(e); } return reconciler; } return null; }
public void dispose() { for (IReconcilingStrategy strategy : fStrategies) { if (strategy instanceof IDisposableReconcilingStrategy) { ((IDisposableReconcilingStrategy) strategy).dispose(); } } }
public void setDocument(IDocument document) { for (IReconcilingStrategy strategy : fStrategies) { strategy.setDocument(document); } }
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) { for (IReconcilingStrategy strategy : fStrategies) { strategy.reconcile(dirtyRegion, subRegion); } }
public void reconcile(IRegion partition) { for (IReconcilingStrategy strategy : fStrategies) { strategy.reconcile(partition); } }
public void setProgressMonitor(IProgressMonitor monitor) { for (IReconcilingStrategy strategy : fStrategies) { if (strategy instanceof IReconcilingStrategyExtension) { IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy; extension.setProgressMonitor(monitor); } } }
public void initialReconcile() { for (IReconcilingStrategy strategy : fStrategies) { if (strategy instanceof IReconcilingStrategyExtension) { IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy; extension.initialReconcile(); } } }
public void fullReconcile() { for (IReconcilingStrategy strategy : fStrategies) { if (strategy instanceof IBatchReconcilingStrategy) { IBatchReconcilingStrategy extension = (IBatchReconcilingStrategy) strategy; extension.fullReconcile(); } } }
/** * */ public CommonReconciler(IReconcilingStrategy defaultStrategy) { super(); this.defaultStrategy = defaultStrategy; setReconcilingStrategy(defaultStrategy, String.valueOf(System.currentTimeMillis())); }
/** * @param strategy * @param contentTypes */ public void setReconcilingStrategy(IReconcilingStrategy strategy, Collection<String> contentTypes) { for (String contentType : contentTypes) { setReconcilingStrategy(strategy, contentType); } }
@Override public IReconcilingStrategy getReconcilingStrategy(String contentType) { IReconcilingStrategy strategy = super.getReconcilingStrategy(contentType); if (strategy != null) { return strategy; } return defaultStrategy; }
@Override protected void initialProcess() { for (IReconcilingStrategy s : reconcilingStrategies) { if (s instanceof IReconcilingStrategyExtension) { ((IReconcilingStrategyExtension) s).initialReconcile(); } } fInitialProcessDone = true; }
@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; }
/** * Creates a new Java reconciling strategy. * * @param viewer the source viewer * @param editor the editor of the strategy's reconciler * @param documentPartitioning the document partitioning this strategy uses for configuration */ public JavaCompositeReconcilingStrategy(ISourceViewer viewer, ITextEditor editor, String documentPartitioning) { fEditor= editor; fJavaStrategy= new JavaReconcilingStrategy(editor); setReconcilingStrategies(new IReconcilingStrategy[] { fJavaStrategy, new JavaSpellingReconcileStrategy(viewer, editor) }); }
@Override public IReconcilingStrategy getReconcilingStrategy(String contentType) { return null; }
public IReconciler getReconciler(final ISourceViewer sourceViewer) { if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) { return null; } SpellingService spellingService = EditorsUI.getSpellingService(); if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) == null) { return null; } IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService) { @Override protected ISpellingProblemCollector createSpellingProblemCollector() { final ISpellingProblemCollector collector = super.createSpellingProblemCollector(); return new ISpellingProblemCollector() { public void accept(SpellingProblem problem) { int offset = problem.getOffset(); int length = problem.getLength(); if (sourceViewer == null) { return; } IDocument document = sourceViewer.getDocument(); if (document == null) { return; } String text; try { text = document.get(offset, length); } catch (BadLocationException e) { return; } if (new de.darwinspl.preferences.resource.dwprofile.ui.DwprofileIgnoredWordsFilter().ignoreWord(text)) { return; } collector.accept(problem); } public void beginCollecting() { collector.beginCollecting(); } public void endCollecting() { collector.endCollecting(); } }; } }; MonoReconciler reconciler = new MonoReconciler(strategy, false); reconciler.setDelay(500); return reconciler; }
public IReconciler getReconciler(final ISourceViewer sourceViewer) { if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) { return null; } SpellingService spellingService = EditorsUI.getSpellingService(); if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) == null) { return null; } IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService) { @Override protected ISpellingProblemCollector createSpellingProblemCollector() { final ISpellingProblemCollector collector = super.createSpellingProblemCollector(); return new ISpellingProblemCollector() { public void accept(SpellingProblem problem) { int offset = problem.getOffset(); int length = problem.getLength(); if (sourceViewer == null) { return; } IDocument document = sourceViewer.getDocument(); if (document == null) { return; } String text; try { text = document.get(offset, length); } catch (BadLocationException e) { return; } if (new eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionIgnoredWordsFilter().ignoreWord(text)) { return; } collector.accept(problem); } public void beginCollecting() { collector.beginCollecting(); } public void endCollecting() { collector.endCollecting(); } }; } }; MonoReconciler reconciler = new MonoReconciler(strategy, false); reconciler.setDelay(500); return reconciler; }
public IReconciler getReconciler(final ISourceViewer sourceViewer) { if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) { return null; } SpellingService spellingService = EditorsUI.getSpellingService(); if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) == null) { return null; } IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService) { @Override protected ISpellingProblemCollector createSpellingProblemCollector() { final ISpellingProblemCollector collector = super.createSpellingProblemCollector(); return new ISpellingProblemCollector() { public void accept(SpellingProblem problem) { int offset = problem.getOffset(); int length = problem.getLength(); if (sourceViewer == null) { return; } IDocument document = sourceViewer.getDocument(); if (document == null) { return; } String text; try { text = document.get(offset, length); } catch (BadLocationException e) { return; } if (new eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaIgnoredWordsFilter().ignoreWord(text)) { return; } collector.accept(problem); } public void beginCollecting() { collector.beginCollecting(); } public void endCollecting() { collector.endCollecting(); } }; } }; MonoReconciler reconciler = new MonoReconciler(strategy, false); reconciler.setDelay(500); return reconciler; }
public IReconciler getReconciler(final ISourceViewer sourceViewer) { if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) { return null; } SpellingService spellingService = EditorsUI.getSpellingService(); if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) == null) { return null; } IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService) { @Override protected ISpellingProblemCollector createSpellingProblemCollector() { final ISpellingProblemCollector collector = super.createSpellingProblemCollector(); return new ISpellingProblemCollector() { public void accept(SpellingProblem problem) { int offset = problem.getOffset(); int length = problem.getLength(); if (sourceViewer == null) { return; } IDocument document = sourceViewer.getDocument(); if (document == null) { return; } String text; try { text = document.get(offset, length); } catch (BadLocationException e) { return; } if (new eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueIgnoredWordsFilter().ignoreWord(text)) { return; } collector.accept(problem); } public void beginCollecting() { collector.beginCollecting(); } public void endCollecting() { collector.endCollecting(); } }; } }; MonoReconciler reconciler = new MonoReconciler(strategy, false); reconciler.setDelay(500); return reconciler; }
public IReconciler getReconciler(final ISourceViewer sourceViewer) { if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) { return null; } SpellingService spellingService = EditorsUI.getSpellingService(); if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) == null) { return null; } IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService) { @Override protected ISpellingProblemCollector createSpellingProblemCollector() { final ISpellingProblemCollector collector = super.createSpellingProblemCollector(); return new ISpellingProblemCollector() { public void accept(SpellingProblem problem) { int offset = problem.getOffset(); int length = problem.getLength(); if (sourceViewer == null) { return; } IDocument document = sourceViewer.getDocument(); if (document == null) { return; } String text; try { text = document.get(offset, length); } catch (BadLocationException e) { return; } if (new eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingIgnoredWordsFilter().ignoreWord(text)) { return; } collector.accept(problem); } public void beginCollecting() { collector.beginCollecting(); } public void endCollecting() { collector.endCollecting(); } }; } }; MonoReconciler reconciler = new MonoReconciler(strategy, false); reconciler.setDelay(500); return reconciler; }
public IReconciler getReconciler(final ISourceViewer sourceViewer) { if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) { return null; } SpellingService spellingService = EditorsUI.getSpellingService(); if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) == null) { return null; } IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService) { @Override protected ISpellingProblemCollector createSpellingProblemCollector() { final ISpellingProblemCollector collector = super.createSpellingProblemCollector(); return new ISpellingProblemCollector() { public void accept(SpellingProblem problem) { int offset = problem.getOffset(); int length = problem.getLength(); if (sourceViewer == null) { return; } IDocument document = sourceViewer.getDocument(); if (document == null) { return; } String text; try { text = document.get(offset, length); } catch (BadLocationException e) { return; } if (new eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsIgnoredWordsFilter().ignoreWord(text)) { return; } collector.accept(problem); } public void beginCollecting() { collector.beginCollecting(); } public void endCollecting() { collector.endCollecting(); } }; } }; MonoReconciler reconciler = new MonoReconciler(strategy, false); reconciler.setDelay(500); return reconciler; }