类org.eclipse.ui.texteditor.spelling.ISpellingEngine源码实例Demo

下面列出了怎么用org.eclipse.ui.texteditor.spelling.ISpellingEngine的API类实例代码及写法,或者点击链接到github查看源代码。

@Override
public SpellingEngineDescriptor getActiveSpellingEngineDescriptor(
    IPreferenceStore preferences) {
  // Create dummy IConfigurationElement subclass so we have a non-null
  // instance to pass to the ctor of the anonymous subclass of
  // SpellingEngineDescriptor below
  IConfigurationElement configElement = new DummyConfigurationElement();

  // Dummy descriptor that always creates our spelling engine
  return new SpellingEngineDescriptor(configElement) {
    @Override
    public ISpellingEngine createEngine() throws CoreException {
      return new GWTSpellingEngine();
    }
  };
}
 
源代码2 项目: xds-ide   文件: DefaultSpellingEngine.java
@Override
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);
	}
}
 
源代码3 项目: xds-ide   文件: DefaultSpellingEngine.java
/**
 * Returns a spelling engine for the given content type or
 * <code>null</code> if none could be found.
 *
 * @param contentType the content type
 * @return a spelling engine for the given content type or
 *         <code>null</code> if none could be found
 */
private ISpellingEngine getEngine(IContentType contentType) {
	if (contentType == null)
		return null;

	if (fEngines.containsKey(contentType))
		return fEngines.get(contentType);

	return getEngine(contentType.getBaseType());
}
 
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);
}
 
/**
 * Returns a spelling engine for the given content type or
 * <code>null</code> if none could be found.
 *
 * @param contentType the content type
 * @return a spelling engine for the given content type or
 *         <code>null</code> if none could be found
 */
private ISpellingEngine getEngine(IContentType contentType) {
	if (contentType == null)
		return null;

	if (fEngines.containsKey(contentType))
		return fEngines.get(contentType);

	return getEngine(contentType.getBaseType());
}
 
 类所在包
 类方法
 同包方法