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

The following examples show how to use org.eclipse.ui.texteditor.spelling.SpellingService. 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: TexSourceViewerConfiguration.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
 */
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
        return null;
    if (!TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.ECLIPSE_BUILDIN_SPELLCHECKER))
        return null;
    //Set TeXlipse spelling Engine as default
    PreferenceStore store = new PreferenceStore();
    store.setValue(SpellingService.PREFERENCE_SPELLING_ENGINE, 
            "org.eclipse.texlipse.LaTeXSpellEngine");
    store.setValue(SpellingService.PREFERENCE_SPELLING_ENABLED, 
    true);
    SpellingService spellingService = new SpellingService(store);
    if (spellingService.getActiveSpellingEngineDescriptor(store) == null)
        return null;
    IReconcilingStrategy strategy= new TeXSpellingReconcileStrategy(sourceViewer, spellingService);
    
    MonoReconciler reconciler= new MonoReconciler(strategy, true);
    reconciler.setDelay(500);
    reconciler.setProgressMonitor(new NullProgressMonitor());
    return reconciler;
}
 
Example #2
Source File: PyEditConfigurationWithoutEditor.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        return null;
    }

    SpellingService spellingService = EditorsUI.getSpellingService();
    if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) == null) {
        return null;
    }

    //Overridden (just) to return a PyReconciler!
    IReconcilingStrategy strategy = new PyReconciler(sourceViewer, spellingService);

    MonoReconciler reconciler = new MonoReconciler(strategy, false);
    reconciler.setIsIncrementalReconciler(false);
    reconciler.setProgressMonitor(new NullProgressMonitor());
    reconciler.setDelay(500);
    return reconciler;
}
 
Example #3
Source File: EditorConfigSourceViewerConfiguration.java    From editorconfig-eclipse with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #4
Source File: SpellCheckEngine.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public final void propertyChange(final PropertyChangeEvent event) {
	if (event.getProperty().equals(PreferenceConstants.SPELLING_LOCALE)) {
		resetSpellChecker();
		return;
	}

	if (event.getProperty().equals(PreferenceConstants.SPELLING_USER_DICTIONARY)) {
		resetUserDictionary();
		return;
	}

	if (event.getProperty().equals(PreferenceConstants.SPELLING_USER_DICTIONARY_ENCODING)) {
		resetUserDictionary();
		return;
	}

	if (event.getProperty().equals(SpellingService.PREFERENCE_SPELLING_ENABLED) && !EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
		if (this == fgEngine)
			SpellCheckEngine.shutdownInstance();
		else
			shutdown();
	}
}
 
Example #5
Source File: PropertiesFileSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@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;
}
 
Example #6
Source File: ModulaReconciler.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void install(ITextViewer textViewer) {
    super.install(textViewer);
    
    propertyChangeListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            boolean isEpeelingEnambed = SpellingService.PREFERENCE_SPELLING_ENABLED.equals(event.getProperty())
                                     || SpellingService.PREFERENCE_SPELLING_ENGINE.equals(event.getProperty());
            if (isEpeelingEnambed) {
                forceReconciling();
            }
        }
    };
    EditorsUI.getPreferenceStore().addPropertyChangeListener(propertyChangeListener);
}
 
Example #7
Source File: CommonSourceViewerConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer)
{
	if (fTextEditor != null && fTextEditor.isEditable())
	{
		IReconcilingStrategy reconcilingStrategy = new CommonReconcilingStrategy(fTextEditor);
		if (EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
		{
			SpellingService spellingService = EditorsUI.getSpellingService();
			Collection<String> spellingContentTypes = getSpellingContentTypes(sourceViewer);
			if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) != null
					&& !spellingContentTypes.isEmpty())
			{
				reconcilingStrategy = new CompositeReconcilingStrategy(reconcilingStrategy,
						new MultiRegionSpellingReconcileStrategy(sourceViewer, spellingService,
								getConfiguredDocumentPartitioning(sourceViewer), spellingContentTypes));
			}
		}
		CommonReconciler reconciler = new CommonReconciler(reconcilingStrategy);
		reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
		reconciler.setIsIncrementalReconciler(false);
		reconciler.setIsAllowedToModifyDocument(false);
		reconciler.setProgressMonitor(new NullProgressMonitor());
		reconciler.setDelay(500);
		return fReconciler = reconciler;
	}
	return null;
}
 
Example #8
Source File: SpellingPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void updateStatus()
{
	boolean spellingEnabled = EditorsUI.getPreferenceStore()
			.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED);
	if (globalPreferencesLink != null)
	{
		String spellingEnabledMessage = Messages.SpellingPreferencePage_EnabledMessage;
		String spellingDisabledMessage = Messages.SpellingPreferencePage_DisabledMessage;
		globalPreferencesLink.setText(spellingEnabled ? spellingEnabledMessage : spellingDisabledMessage);
	}
	if (tableViewer != null)
	{
		tableViewer.getControl().setEnabled(spellingEnabled);
	}
}
 
Example #9
Source File: JavaReconciler.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void install(ITextViewer textViewer) {
	super.install(textViewer);

	fPartListener= new PartListener();
	IWorkbenchPartSite site= fTextEditor.getSite();
	IWorkbenchWindow window= site.getWorkbenchWindow();
	window.getPartService().addPartListener(fPartListener);

	fActivationListener= new ActivationListener(textViewer.getTextWidget());
	Shell shell= window.getShell();
	shell.addShellListener(fActivationListener);

	fJavaElementChangedListener= new ElementChangedListener();
	JavaCore.addElementChangedListener(fJavaElementChangedListener);

	fResourceChangeListener= new ResourceChangeListener();
	IWorkspace workspace= JavaPlugin.getWorkspace();
	workspace.addResourceChangeListener(fResourceChangeListener);

	fPropertyChangeListener= new IPropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent event) {
			if (SpellingService.PREFERENCE_SPELLING_ENABLED.equals(event.getProperty()) || SpellingService.PREFERENCE_SPELLING_ENGINE.equals(event.getProperty()))
				forceReconciling();
		}
	};
	JavaPlugin.getDefault().getCombinedPreferenceStore().addPropertyChangeListener(fPropertyChangeListener);

	fReconciledElement= EditorUtility.getEditorInputJavaElement(fTextEditor, false);
}
 
Example #10
Source File: SpellCheckEngine.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
public final void propertyChange(final PropertyChangeEvent event) {
    if (event.getProperty().equals(SpellingService.PREFERENCE_SPELLING_ENABLED) && !EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        if (this == fgEngine)
            SpellCheckEngine.shutdownInstance();
        else
            shutdown();
    }
}
 
Example #11
Source File: TeXSpellingReconcileStrategy.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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());

}
 
Example #12
Source File: PyReconciler.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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());
}
 
Example #13
Source File: GWTJavaSpellingReconcileStrategy.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
public static SpellingService getSpellingService() {
  if (spellingService == null) {
    spellingService = new GWTSpellingService();
  }
  return spellingService;
}
 
Example #14
Source File: MultiRegionSpellingReconcileStrategy.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @param viewer
 * @param spellingService
 */
public MultiRegionSpellingReconcileStrategy(ISourceViewer viewer, SpellingService spellingService, String documentPartitioning, Collection<String> contentTypes) {
	super(viewer, spellingService);
	this.documentPartitioning = documentPartitioning;
	this.contentTypes = contentTypes;
}
 
Example #15
Source File: DisableSpellCheckingProposal.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
public final void apply(final IDocument document) {
	IPreferenceStore store= EditorsUI.getPreferenceStore();
	store.setValue(SpellingService.PREFERENCE_SPELLING_ENABLED, false);
}
 
Example #16
Source File: JavaSpellingReconcileStrategy.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private boolean isSpellingEnabled() {
	return EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED);
}
 
Example #17
Source File: DisableSpellCheckingProposal.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public final void apply(final IDocument document) {
	IPreferenceStore store= EditorsUI.getPreferenceStore();
	store.setValue(SpellingService.PREFERENCE_SPELLING_ENABLED, false);
}
 
Example #18
Source File: XtextSpellingReconcileStrategy.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected boolean isSpellingEnabled() {
	return spellingProblemCollector != null && EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED);
}