@Override public void install(ITextViewer textViewer) { if (fStrategies == null) return; for (int i = 0; i < fStrategies.length; i++) { if (fStrategies[i] instanceof IReconciler) { IReconciler extension = (IReconciler) fStrategies[i]; try { extension.install(textViewer); } catch (Exception e) { } } } }
@Override public void uninstall() { if (fStrategies == null) return; for (int i = 0; i < fStrategies.length; i++) { if (fStrategies[i] instanceof IReconciler) { IReconciler extension = (IReconciler) fStrategies[i]; try { extension.uninstall(); } catch (Exception e) { } } } }
/** * @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; }
/** * @param store * @param coreStore */ // public ITPSourceViewerConfig(IPreferenceStore store, Preferences coreStore) // { // super(store, coreStore/* // * , CommonSourceViewerConfiguration.CODESCANNER_TYPE_ITP // */); // } public IReconciler getReconciler(ISourceViewer sourceViewer) { CommonReconcilingStrategy strategy = new ItpReconcilingStrategy(fEditor); MonoReconciler reconciler = new MonoReconciler(strategy, false); reconciler.setProgressMonitor(new NullProgressMonitor()); reconciler.setDelay(500); return reconciler; }
@Override public IReconciler getReconciler(ISourceViewer sourceViewer) { MonoReconciler reconciler = new MonoReconciler(new EiffelReconcilingStrategy(), true); reconciler.install(sourceViewer); return reconciler; }
public IReconciler getReconciler(ISourceViewer sourceViewer) { MonoReconciler reconciler = new MonoReconciler(strategy, false); reconciler.setIsIncrementalReconciler(false); reconciler.setProgressMonitor(new NullProgressMonitor()); reconciler.setDelay(200); return reconciler; }
/** * */ public IReconciler getReconciler(ISourceViewer sourceViewer) { TLAReconcilingStrategy strategy = new TLAReconcilingStrategy(); strategy.setEditor(editor); MonoReconciler reconciler = new MonoReconciler(strategy, false); return reconciler; }
public IReconciler getReconciler(ISourceViewer sourceViewer) { NCLReconcilingStrategy strategy = new NCLReconcilingStrategy(); strategy.setEditor(editor); MonoReconciler reconciler = new MonoReconciler(strategy, false); return reconciler; }
@Override protected void doSetInput(IEditorInput input) throws CoreException { if (getDocument() != null) getDocument().removeDocumentListener(docListener); setPreferenceStore(getPrefsStore()); super.doSetInput(input); IDocument doc = getDocumentProvider().getDocument(input); // check and correct line endings String tmp = doc.get(); int hash = tmp.hashCode(); tmp = Strings.normalize(tmp); if (hash != tmp.hashCode()) doc.set(tmp); connectPartitioningToElement(input, doc); FluentMkSourceViewer sourceViewer = (FluentMkSourceViewer) getSourceViewer(); if (sourceViewer != null && sourceViewer.getReconciler() == null) { IReconciler reconciler = getSourceViewerConfiguration().getReconciler(sourceViewer); if (reconciler != null) { reconciler.install(sourceViewer); sourceViewer.setReconciler(reconciler); } } // Attach listener to new doc getDocument().addDocumentListener(docListener); installSemanticHighlighting(); // Initialize code folding if (projectionProvider != null) { projectionProvider.initialize(); } }
@Override public IReconciler getReconciler(ISourceViewer viewer) { if (editor != null && editor.isEditable()) { MkReconcilingStrategy strategy = new MkReconcilingStrategy(viewer, editor, getConfiguredDocumentPartitioning(viewer)); MonoReconciler reconciler = new MonoReconciler(strategy, false); reconciler.setProgressMonitor(new ProgressMonitorAndCanceler()); reconciler.setDelay(500); return reconciler; } return null; }
private void internalDoSetInput(IEditorInput input) throws CoreException { ISourceViewer sourceViewer = getSourceViewer(); TypeScriptSourceViewer TypeScriptSourceViewer = null; if (sourceViewer instanceof TypeScriptSourceViewer) TypeScriptSourceViewer = (TypeScriptSourceViewer) sourceViewer; IPreferenceStore store = getPreferenceStore(); // if (TypeScriptSourceViewer != null && isFoldingEnabled() &&(store == // null || !store.getBoolean(PreferenceConstants.EDITOR_SHOW_SEGMENTS))) // TypeScriptSourceViewer.prepareDelayedProjection(); super.doSetInput(input); if (TypeScriptSourceViewer != null && TypeScriptSourceViewer.getReconciler() == null) { IReconciler reconciler = getSourceViewerConfiguration().getReconciler(TypeScriptSourceViewer); if (reconciler != null) { reconciler.install(TypeScriptSourceViewer); TypeScriptSourceViewer.setReconciler(reconciler); } } // if (fEncodingSupport != null) // fEncodingSupport.reset(); // setOutlinePageInput(fOutlinePage, input); // // if (isShowingOverrideIndicators()) // installOverrideIndicator(false); }
/** * @since 2.3 */ @SuppressWarnings("rawtypes") public Object getAdapter(Class adapter) { if (IReconciler.class.isAssignableFrom(adapter)) { return fReconciler; } return Platform.getAdapterManager().getAdapter(this, adapter); }
public static void setAsReconciler( StructuredTextViewerConfiguration configuration) throws Exception { try { IReconciler reconciler = createReconciler(); // Reflectively set the spelling service to our own Field reconcilerField = StructuredTextViewerConfiguration.class.getDeclaredField("fReconciler"); reconcilerField.setAccessible(true); reconcilerField.set(configuration, reconciler); } catch (Throwable t) { throw new Exception(t); } }
/** * Creates and initializes the UI Binder-specific reconciler. */ private static IReconciler createReconciler() { // Initialization mirrors StructuredTextViewerConfiguration.getReconciler. // Difference: We do not have an ISourceViewer, but the // ISourceViewer.getConfiguredDocumentPartitioning for structured text // always returns the DEFAULT_STRUCTURED_PARTITIONING (the method is final // and it is just a simple return of this value.) UiBinderStructuredRegionProcessor reconciler = new UiBinderStructuredRegionProcessor(); reconciler.setDocumentPartitioning(IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING); return reconciler; }
@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; }
@Override public IReconciler getReconciler(ISourceViewer sourceViewer) { JsonReconcilingStrategy strategy = new JsonReconcilingStrategy(); strategy.setEditor(editor); MonoReconciler reconciler = new MonoReconciler(strategy, false); return reconciler; }
private void waitForReconcileToStartAndFinish() { Optional<XtextReconciler> foundReconciler = Optional.ofNullable(getInternalSourceViewer()) .filter(IAdaptable.class::isInstance).map(IAdaptable.class::cast) .map(a -> a.getAdapter(IReconciler.class)).filter(XtextReconciler.class::isInstance) .map(XtextReconciler.class::cast); if (!foundReconciler.isPresent()) { return; } JobStartListener listener = new JobStartListener(); XtextReconciler reconciler = foundReconciler.get(); try { reconciler.join(); reconciler.addJobChangeListener(listener); reconciler.forceReconcile(); synchronized (listener) { while (!listener.isStarted()) { listener.wait(); } } reconciler.join(); } catch (InterruptedException e) { return; } finally { reconciler.removeJobChangeListener(listener); } }
@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; }
@Override public IReconciler getReconciler(ISourceViewer sourceViewer) { final ITextEditor editor= getEditor(); if (editor != null && editor.isEditable()) { JavaCompositeReconcilingStrategy strategy= new JavaCompositeReconcilingStrategy(sourceViewer, editor, getConfiguredDocumentPartitioning(sourceViewer)); JavaReconciler reconciler= new JavaReconciler(editor, strategy, false); reconciler.setIsAllowedToModifyDocument(false); reconciler.setDelay(500); return reconciler; } return null; }
private void internalDoSetInput(IEditorInput input) throws CoreException { ISourceViewer sourceViewer= getSourceViewer(); JavaSourceViewer javaSourceViewer= null; if (sourceViewer instanceof JavaSourceViewer) javaSourceViewer= (JavaSourceViewer)sourceViewer; IPreferenceStore store= getPreferenceStore(); if (javaSourceViewer != null && isFoldingEnabled() &&(store == null || !store.getBoolean(PreferenceConstants.EDITOR_SHOW_SEGMENTS))) javaSourceViewer.prepareDelayedProjection(); super.doSetInput(input); if (javaSourceViewer != null && javaSourceViewer.getReconciler() == null) { IReconciler reconciler= getSourceViewerConfiguration().getReconciler(javaSourceViewer); if (reconciler != null) { reconciler.install(javaSourceViewer); javaSourceViewer.setReconciler(reconciler); } } if (fEncodingSupport != null) fEncodingSupport.reset(); setOutlinePageInput(fOutlinePage, input); if (isShowingOverrideIndicators()) installOverrideIndicator(false); }
@Override public IReconciler getReconciler(ISourceViewer sourceViewer) { if (fTextEditor != null && fTextEditor.isEditable()) { ApexReconcilingStrategy strategy = new ApexReconcilingStrategy((ApexCodeEditor) fTextEditor); ApexReconciler reconciler = new ApexReconciler(fTextEditor, strategy, false); reconciler.setIsAllowedToModifyDocument(false); reconciler.setDelay(500); return reconciler; } return null; }
public IReconciler getReconciler( ISourceViewer sourceViewer ) { // Creates an instance of MonoReconciler with the specified strategy, // and is not incremental. return new MonoReconciler( new ScriptReconcilingStrategy( sourceViewer ), false ); }
@Override public IReconciler getReconciler(ISourceViewer sourceViewer) { JsonReconcilingStrategy strategy = new JsonReconcilingStrategy(); strategy.setTextEditor(textEditor); MonoReconciler reconciler = new MonoReconciler(strategy,false); return reconciler; }
public IReconciler getReconciler(ISourceViewer sourceViewer) { DefReconcilingStrategy strategy = new DefReconcilingStrategy(fEditor); MonoReconciler reconciler = new MonoReconciler(strategy, false); reconciler.setProgressMonitor(new NullProgressMonitor()); reconciler.setDelay(500); return reconciler; }
public IReconciler getReconciler(ISourceViewer sourceViewer) { /* currently we avoid the default reconciler mechanism parts (spell checking etc.)*/ return null; }
@Override public void install(ITextViewer textViewer) { super.install(textViewer); ((IReconciler) getReconcilingStrategy(IDocument.DEFAULT_CONTENT_TYPE)).install(textViewer); }
@Override public void uninstall() { super.uninstall(); ((IReconciler) getReconcilingStrategy(IDocument.DEFAULT_CONTENT_TYPE)).uninstall(); }
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; }