org.eclipse.ui.texteditor.spelling.ISpellingEngine Java Examples

The following examples show how to use org.eclipse.ui.texteditor.spelling.ISpellingEngine. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GWTJavaSpellingReconcileStrategy.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
@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();
    }
  };
}
 
Example #2
Source File: DefaultSpellingEngine.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@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);
	}
}
 
Example #3
Source File: DefaultSpellingEngine.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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());
}
 
Example #4
Source File: DefaultSpellingEngine.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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);
}
 
Example #5
Source File: DefaultSpellingEngine.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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());
}