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

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

@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
	if (!EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
		return null;

	IReconcilingStrategy strategy= new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) {
		@Override
		protected IContentType getContentType() {
			return PROPERTIES_CONTENT_TYPE;
		}
	};

	MonoReconciler reconciler= new MonoReconciler(strategy, false);
	reconciler.setDelay(500);
	return reconciler;
}
 
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
	if (!EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
		return null;

	IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) {
		@Override
		protected IContentType getContentType() {
			return EditorConfigTextTools.EDITORCONFIG_CONTENT_TYPE;
		}
	};

	MonoReconciler reconciler = new MonoReconciler(strategy, false);
	reconciler.setDelay(500);
	return reconciler;
}
 
public GWTJavaSpellingReconcileStrategy(ISourceViewer viewer,
    ITextEditor editor) {
  super(viewer, editor);

  try {
    // Reflectively set the spelling service to our own
    Field spellingServiceField = SpellingReconcileStrategy.class.getDeclaredField("fSpellingService");
    spellingServiceField.setAccessible(true);
    spellingServiceField.set(this, GWTSpellingService.getSpellingService());
  } catch (Exception e) {
    GWTPluginLog.logError(e);
  }
}
 
/**
 * Verify that
 * {@link org.eclipse.ui.texteditor.spelling.SpellingReconcileStrategy}
 * contains the private fields we access reflectively in
 * {@link GWTJavaSpellingReconcileStrategy}.
 * 
 * @throws NoSuchFieldException
 * @throws SecurityException
 */
public void testPrivateFields() throws SecurityException,
    NoSuchFieldException {
  Field spellingServiceField = SpellingReconcileStrategy.class.getDeclaredField("fSpellingService");
  spellingServiceField.setAccessible(true);
}
 
 类所在包
 同包方法