public SpringPropertiesReconciler createReconciler(
     ISourceViewer sourceViewer,
     DocumentContextFinder documentContextFinder,
     IReconcileTrigger reconcileTigger) {
   IReconcilingStrategy strategy = null;
   if (!DISABLE_SPELL_CHECKER
       && EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
     IReconcilingStrategy spellcheck =
         new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) {
           @Override
           protected IContentType getContentType() {
             return SpringPropertiesFileEditor.CONTENT_TYPE;
           }
         };
     strategy = ReconcilingUtil.compose(strategy, spellcheck);
   }
   try {
     IReconcileEngine reconcileEngine = createEngine();
     IReconcilingStrategy propertyChecker =
         new SpringPropertiesReconcileStrategy(
             sourceViewer, reconcileEngine, documentContextFinder, reconcileTigger);
     strategy = ReconcilingUtil.compose(strategy, propertyChecker);
   } catch (Exception e) {
     SpringPropertiesEditorPlugin.log(e);
   }
   if (strategy != null) {
     SpringPropertiesReconciler reconciler = new SpringPropertiesReconciler(strategy);
     reconciler.setDelay(500);
     return reconciler;
   }
   return null;
 }
  @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;
  }
Ejemplo n.º 3
0
  public org.eclipse.jface.text.reconciler.IReconciler getReconciler(
      final org.eclipse.jface.text.source.ISourceViewer sourceViewer) {
    if (fPreferenceStore == null
        || !fPreferenceStore.getBoolean(
            org.eclipse.ui.texteditor.spelling.SpellingService.PREFERENCE_SPELLING_ENABLED)) {
      return null;
    }

    org.eclipse.ui.texteditor.spelling.SpellingService spellingService =
        org.eclipse.ui.editors.text.EditorsUI.getSpellingService();
    if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) == null) {
      return null;
    }

    org.eclipse.jface.text.reconciler.IReconcilingStrategy strategy =
        new org.eclipse.ui.texteditor.spelling.SpellingReconcileStrategy(
            sourceViewer, spellingService) {
          @Override
          protected org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector
              createSpellingProblemCollector() {
            final org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector collector =
                super.createSpellingProblemCollector();

            return new org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector() {

              public void accept(org.eclipse.ui.texteditor.spelling.SpellingProblem problem) {
                int offset = problem.getOffset();
                int length = problem.getLength();
                if (sourceViewer == null) {
                  return;
                }
                org.eclipse.jface.text.IDocument document = sourceViewer.getDocument();
                if (document == null) {
                  return;
                }
                String text;
                try {
                  text = document.get(offset, length);
                } catch (org.eclipse.jface.text.BadLocationException e) {
                  return;
                }
                if (new edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ui
                        .TestmodelIgnoredWordsFilter()
                    .ignoreWord(text)) {
                  return;
                }
                collector.accept(problem);
              }

              public void beginCollecting() {
                collector.beginCollecting();
              }

              public void endCollecting() {
                collector.endCollecting();
              }
            };
          }
        };
    org.eclipse.jface.text.reconciler.MonoReconciler reconciler =
        new org.eclipse.jface.text.reconciler.MonoReconciler(strategy, false);
    reconciler.setDelay(500);
    return reconciler;
  }