Java 类org.eclipse.ui.texteditor.spelling.SpellingContext 实例源码

项目:languagetool-eclipse-plugin    文件:Engine.java   
@Override
public void check(IDocument document, IRegion[] regions, SpellingContext context,
        ISpellingProblemCollector collector, IProgressMonitor monitor) {
    JLanguageTool.setDataBroker(new EclipseRessourceDataBroker());
    JLanguageTool langTool = new JLanguageTool(new AmericanEnglish());
    if (langTool.getLanguage() == null) {
        return;
    }

    for (IRegion region : regions) {
        AnnotatedTextBuilder textBuilder = new AnnotatedTextBuilder();
        List<RuleMatch> matches;
        try {
            MarkupUtil.populateBuilder(textBuilder, document.get(region.getOffset(), region.getLength()));
            matches = langTool.check(textBuilder.build());
            processMatches(collector, matches);
        } catch (IOException | BadLocationException e) {
            e.printStackTrace();
        }
    }
}
项目:devit-jdt    文件:DefaultSpellingEnginePatch.java   
@Override
public void check(IDocument document, IRegion[] regions,
        SpellingContext context, ISpellingProblemCollector collector,
        IProgressMonitor monitor) {
    // System.out.println("==document:" + document);
    // System.out.println(context.getContentType());
    // for (IRegion item : regions) {
    // System.out.println(item.getOffset() + "," + item.getLength());
    // }

    if (JavaCore.JAVA_SOURCE_CONTENT_TYPE
            .equals(context.getContentType().getId())) {
        // System.out.println("checking use " + javaSpellingEngine);
        javaSpellingEngine.check(document, regions, context, collector,
                monitor);
    } else {
        // System.out.println("check with super.*");
        super.check(document, regions, context, collector, monitor);
    }
}
项目:texlipse    文件:TeXSpellingReconcileStrategy.java   
/**
 * Creates a new comment reconcile strategy.
 *
 * @param viewer the source viewer
 * @param spellingService the spelling service to use
 */
public TeXSpellingReconcileStrategy(ISourceViewer viewer, SpellingService spellingService) {
    Assert.isNotNull(viewer);
    Assert.isNotNull(spellingService);
    fViewer= viewer;
    fSpellingService= spellingService;
    fSpellingContext= new SpellingContext();
    fSpellingContext.setContentType(getContentType());

}
项目:gwt-eclipse-plugin    文件:GWTSpellingEngine.java   
@Override
public void check(IDocument document, IRegion[] regions,
    SpellingContext context, ISpellingProblemCollector collector,
    IProgressMonitor monitor) {
  if (JavaCore.JAVA_SOURCE_CONTENT_TYPE.equals(context.getContentType().getId())) {
    gwtEngine.check(document, regions, context, collector, monitor);
  } else {
    super.check(document, regions, context, collector, monitor);
  }
}
项目:Eclipse-Postfix-Code-Completion    文件:DefaultSpellingEngine.java   
public void check(IDocument document, IRegion[] regions, SpellingContext context, ISpellingProblemCollector collector, IProgressMonitor monitor) {
    ISpellingEngine engine= getEngine(context.getContentType());
    if (engine == null)
        engine= getEngine(TEXT_CONTENT_TYPE);
    if (engine != null)
        engine.check(document, regions, context, collector, monitor);
}
项目:Eclipse-Postfix-Code-Completion    文件:SpellingEngine.java   
public void check(IDocument document, IRegion[] regions, SpellingContext context, ISpellingProblemCollector collector, IProgressMonitor monitor) {
    if (collector != null) {
        final ISpellCheckEngine spellingEngine= SpellCheckEngine.getInstance();
        ISpellChecker checker= spellingEngine.getSpellChecker();
        if (checker != null)
            check(document, regions, checker, collector, monitor);
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:DefaultSpellingEngine.java   
public void check(IDocument document, IRegion[] regions, SpellingContext context, ISpellingProblemCollector collector, IProgressMonitor monitor) {
    ISpellingEngine engine= getEngine(context.getContentType());
    if (engine == null)
        engine= getEngine(TEXT_CONTENT_TYPE);
    if (engine != null)
        engine.check(document, regions, context, collector, monitor);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SpellingEngine.java   
public void check(IDocument document, IRegion[] regions, SpellingContext context, ISpellingProblemCollector collector, IProgressMonitor monitor) {
    if (collector != null) {
        final ISpellCheckEngine spellingEngine= SpellCheckEngine.getInstance();
        ISpellChecker checker= spellingEngine.getSpellChecker();
        if (checker != null)
            check(document, regions, checker, collector, monitor);
    }
}
项目:Pydev    文件:PyReconciler.java   
/**
 * Creates a new comment reconcile strategy.
 * 
 * @param viewer the source viewer
 * @param spellingService the spelling service to use
 */
public PyReconciler(ISourceViewer viewer, SpellingService spellingService) {
    Assert.isNotNull(viewer);
    Assert.isNotNull(spellingService);
    fViewer = viewer;
    fSpellingService = spellingService;
    fSpellingContext = new SpellingContext();
    fSpellingContext.setContentType(getContentType());
}
项目:eclipse.spellchecker    文件:DefaultSpellingEngine.java   
public void check(IDocument document, IRegion[] regions, SpellingContext context, ISpellingProblemCollector collector, IProgressMonitor monitor) {
    ISpellingEngine engine= getEngine(context.getContentType());
    if (engine == null)
        engine= getEngine(TEXT_CONTENT_TYPE);
    if (engine != null)
        engine.check(document, regions, context, collector, monitor);
}
项目:eclipse.spellchecker    文件:SpellingEngine.java   
public void check(IDocument document, IRegion[] regions, SpellingContext context, ISpellingProblemCollector collector, IProgressMonitor monitor) {
    if (collector != null) {
        final ISpellCheckEngine spellingEngine= SpellCheckEngine.getInstance();
        ISpellChecker checker= spellingEngine.getSpellChecker();
        if (checker != null)
            check(document, regions, checker, collector, monitor);
    }
}
项目:subclipse    文件:CommitCommentArea.java   
public CommentSpellingReconcileStrategy(AnnotationModel annotationModel) {
  this.fAnnotationModel = annotationModel;
  fSpellingContext = new SpellingContext();
  fSpellingContext.setContentType(Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT));
}
项目:texlipse    文件:TexSpellingEngine.java   
public void check(IDocument document, IRegion[] regions, SpellingContext context, 
        ISpellingProblemCollector collector, IProgressMonitor monitor) {

    if (ignore == null) {
        ignore = new HashSet<String>();
    }

    IProject project = getProject(document);

    String lang = DEFAULT_LANG;
    if (project != null) {
        lang = TexlipseProperties.getProjectProperty(project, TexlipseProperties.LANGUAGE_PROPERTY);
    }
    //Get spellchecker for the correct language
    SpellChecker spellCheck = getSpellChecker(lang);
    if (spellCheck == null) return;

    if (collector instanceof TeXSpellingProblemCollector) {
        ((TeXSpellingProblemCollector) collector).setRegions(regions);
    }

    try {
        spellCheck.addSpellCheckListener(this);
        for (final IRegion r : regions) {
            errors = new LinkedList<SpellCheckEvent>();
            int roffset = r.getOffset();

            //Create a new wordfinder and initialize it
            TexlipseWordFinder wf = new TexlipseWordFinder();
            wf.setIgnoreComments(TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.SPELLCHECKER_IGNORE_COMMENTS));
            wf.setIgnoreMath(TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.SPELLCHECKER_IGNORE_MATH));

            spellCheck.checkSpelling(new StringWordTokenizer(
                    document.get(roffset, r.getLength()), wf));

            for (SpellCheckEvent error : errors) {
                SpellingProblem p = new TexSpellingProblem(error, roffset, lang);
                collector.accept(p);
            }
        }
        spellCheck.removeSpellCheckListener(this);                
    } catch (BadLocationException e) {
        e.printStackTrace();
    }
}
项目:APICloud-Studio    文件:CommitCommentArea.java   
public CommentSpellingReconcileStrategy(AnnotationModel annotationModel) {
  this.fAnnotationModel = annotationModel;
  fSpellingContext = new SpellingContext();
  fSpellingContext.setContentType(Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT));
}
项目:devit-jdt    文件:NameSpellingChecker.java   
@Override
public void check(IDocument document, IRegion[] regions,
        SpellingContext context, ISpellingProblemCollector collector,
        IProgressMonitor monitor) {
    super.check(document, regions, context, collector, monitor);
}