@Override
 public IReconciler getReconciler(ISourceViewer sourceViewer) {
   IReconcilingStrategy strategy;
   {
     if (markupValidationReconcilingStrategy == null) {
       markupValidationReconcilingStrategy = new MarkupValidationReconcilingStrategy(sourceViewer);
       markupValidationReconcilingStrategy.setMarkupLanguage(markupLanguage);
       markupValidationReconcilingStrategy.setResource(file);
     }
     IReconciler reconciler = super.getReconciler(sourceViewer);
     if (reconciler != null) {
       MultiReconcilingStrategy multiStrategy = new MultiReconcilingStrategy();
       for (String contentType : FastMarkupPartitioner.ALL_CONTENT_TYPES) {
         maybeAddReconcilingStrategyForContentType(multiStrategy, reconciler, contentType);
       }
       maybeAddReconcilingStrategyForContentType(
           multiStrategy, reconciler, IDocument.DEFAULT_CONTENT_TYPE);
       multiStrategy.add(markupValidationReconcilingStrategy);
       strategy = multiStrategy;
     } else {
       strategy = markupValidationReconcilingStrategy;
     }
   }
   MonoReconciler reconciler = new MarkupMonoReconciler(strategy, false);
   reconciler.setIsIncrementalReconciler(false);
   reconciler.setProgressMonitor(new NullProgressMonitor());
   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;
  }
Exemple #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;
  }