当前位置: 首页>>代码示例>>Java>>正文


Java SpellingContext类代码示例

本文整理汇总了Java中org.eclipse.ui.texteditor.spelling.SpellingContext的典型用法代码示例。如果您正苦于以下问题:Java SpellingContext类的具体用法?Java SpellingContext怎么用?Java SpellingContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SpellingContext类属于org.eclipse.ui.texteditor.spelling包,在下文中一共展示了SpellingContext类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: check

import org.eclipse.ui.texteditor.spelling.SpellingContext; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:devitcn,项目名称:devit-jdt,代码行数:21,代码来源:DefaultSpellingEnginePatch.java

示例2: check

import org.eclipse.ui.texteditor.spelling.SpellingContext; //导入依赖的package包/类
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();
    }
}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:46,代码来源:TexSpellingEngine.java

示例3: TeXSpellingReconcileStrategy

import org.eclipse.ui.texteditor.spelling.SpellingContext; //导入依赖的package包/类
/**
 * 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());

}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:16,代码来源:TeXSpellingReconcileStrategy.java

示例4: check

import org.eclipse.ui.texteditor.spelling.SpellingContext; //导入依赖的package包/类
@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();
		}
	}
}
 
开发者ID:vogellacompany,项目名称:languagetool-eclipse-plugin,代码行数:22,代码来源:Engine.java

示例5: check

import org.eclipse.ui.texteditor.spelling.SpellingContext; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:11,代码来源:GWTSpellingEngine.java

示例6: check

import org.eclipse.ui.texteditor.spelling.SpellingContext; //导入依赖的package包/类
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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:DefaultSpellingEngine.java

示例7: check

import org.eclipse.ui.texteditor.spelling.SpellingContext; //导入依赖的package包/类
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);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:SpellingEngine.java

示例8: PyReconciler

import org.eclipse.ui.texteditor.spelling.SpellingContext; //导入依赖的package包/类
/**
 * 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());
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:15,代码来源:PyReconciler.java

示例9: CommentSpellingReconcileStrategy

import org.eclipse.ui.texteditor.spelling.SpellingContext; //导入依赖的package包/类
public CommentSpellingReconcileStrategy(AnnotationModel annotationModel) {
  this.fAnnotationModel = annotationModel;
  fSpellingContext = new SpellingContext();
  fSpellingContext.setContentType(Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT));
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:6,代码来源:CommitCommentArea.java

示例10: check

import org.eclipse.ui.texteditor.spelling.SpellingContext; //导入依赖的package包/类
@Override
public void check(IDocument document, IRegion[] regions,
        SpellingContext context, ISpellingProblemCollector collector,
        IProgressMonitor monitor) {
    super.check(document, regions, context, collector, monitor);
}
 
开发者ID:devitcn,项目名称:devit-jdt,代码行数:7,代码来源:NameSpellingChecker.java


注:本文中的org.eclipse.ui.texteditor.spelling.SpellingContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。