Search in sources :

Example 1 with ISpellingPreferenceBlock

use of org.eclipse.ui.texteditor.spelling.ISpellingPreferenceBlock in project eclipse.platform.text by eclipse.

the class SpellingConfigurationBlock method performOk.

@Override
public void performOk() {
    for (Iterator<ISpellingPreferenceBlock> it = fProviderPreferences.values().iterator(); it.hasNext(); ) {
        final ISpellingPreferenceBlock block = it.next();
        ISafeRunnable runnable = new ISafeRunnable() {

            @Override
            public void run() throws Exception {
                block.performOk();
            }

            @Override
            public void handleException(Throwable x) {
            }
        };
        SafeRunner.run(runnable);
    }
}
Also used : ISafeRunnable(org.eclipse.core.runtime.ISafeRunnable) ISpellingPreferenceBlock(org.eclipse.ui.texteditor.spelling.ISpellingPreferenceBlock)

Example 2 with ISpellingPreferenceBlock

use of org.eclipse.ui.texteditor.spelling.ISpellingPreferenceBlock in project eclipse.platform.text by eclipse.

the class SpellingConfigurationBlock method updateCheckboxDependencies.

private void updateCheckboxDependencies() {
    final boolean enabled = fEnablementCheckbox.getSelection();
    if (fComboGroup != null)
        setEnabled(fComboGroup, enabled);
    SpellingEngineDescriptor desc = EditorsUI.getSpellingService().getActiveSpellingEngineDescriptor(fStore);
    // $NON-NLS-1$
    String id = desc != null ? desc.getId() : "";
    final ISpellingPreferenceBlock preferenceBlock = fProviderPreferences.get(id);
    if (preferenceBlock != null) {
        ISafeRunnable runnable = new ISafeRunnable() {

            @Override
            public void run() throws Exception {
                preferenceBlock.setEnabled(enabled);
            }

            @Override
            public void handleException(Throwable x) {
            }
        };
        SafeRunner.run(runnable);
    }
}
Also used : ISafeRunnable(org.eclipse.core.runtime.ISafeRunnable) SpellingEngineDescriptor(org.eclipse.ui.texteditor.spelling.SpellingEngineDescriptor) ISpellingPreferenceBlock(org.eclipse.ui.texteditor.spelling.ISpellingPreferenceBlock)

Example 3 with ISpellingPreferenceBlock

use of org.eclipse.ui.texteditor.spelling.ISpellingPreferenceBlock in project eclipse.platform.text by eclipse.

the class SpellingConfigurationBlock method dispose.

@Override
public void dispose() {
    for (Iterator<ISpellingPreferenceBlock> it = fProviderPreferences.values().iterator(); it.hasNext(); ) {
        final ISpellingPreferenceBlock block = it.next();
        ISafeRunnable runnable = new ISafeRunnable() {

            @Override
            public void run() throws Exception {
                block.dispose();
            }

            @Override
            public void handleException(Throwable x) {
            }
        };
        SafeRunner.run(runnable);
    }
}
Also used : ISafeRunnable(org.eclipse.core.runtime.ISafeRunnable) ISpellingPreferenceBlock(org.eclipse.ui.texteditor.spelling.ISpellingPreferenceBlock)

Example 4 with ISpellingPreferenceBlock

use of org.eclipse.ui.texteditor.spelling.ISpellingPreferenceBlock in project eclipse.platform.text by eclipse.

the class SpellingConfigurationBlock method performDefaults.

@Override
public void performDefaults() {
    restoreFromPreferences();
    for (Iterator<ISpellingPreferenceBlock> it = fProviderPreferences.values().iterator(); it.hasNext(); ) {
        final ISpellingPreferenceBlock block = it.next();
        ISafeRunnable runnable = new ISafeRunnable() {

            @Override
            public void run() throws Exception {
                block.performDefaults();
            }

            @Override
            public void handleException(Throwable x) {
            }
        };
        SafeRunner.run(runnable);
    }
}
Also used : ISafeRunnable(org.eclipse.core.runtime.ISafeRunnable) ISpellingPreferenceBlock(org.eclipse.ui.texteditor.spelling.ISpellingPreferenceBlock)

Example 5 with ISpellingPreferenceBlock

use of org.eclipse.ui.texteditor.spelling.ISpellingPreferenceBlock in project eclipse.platform.text by eclipse.

the class SpellingConfigurationBlock method canPerformOk.

@Override
public boolean canPerformOk() {
    SpellingEngineDescriptor desc = EditorsUI.getSpellingService().getActiveSpellingEngineDescriptor(fStore);
    // $NON-NLS-1$
    String id = desc != null ? desc.getId() : "";
    final ISpellingPreferenceBlock block = fProviderPreferences.get(id);
    if (block == null)
        return true;
    final Boolean[] result = new Boolean[] { Boolean.TRUE };
    ISafeRunnable runnable = new ISafeRunnable() {

        @Override
        public void run() throws Exception {
            result[0] = Boolean.valueOf(block.canPerformOk());
        }

        @Override
        public void handleException(Throwable x) {
        }
    };
    SafeRunner.run(runnable);
    return result[0].booleanValue();
}
Also used : ISafeRunnable(org.eclipse.core.runtime.ISafeRunnable) SpellingEngineDescriptor(org.eclipse.ui.texteditor.spelling.SpellingEngineDescriptor) ISpellingPreferenceBlock(org.eclipse.ui.texteditor.spelling.ISpellingPreferenceBlock)

Aggregations

ISafeRunnable (org.eclipse.core.runtime.ISafeRunnable)5 ISpellingPreferenceBlock (org.eclipse.ui.texteditor.spelling.ISpellingPreferenceBlock)5 SpellingEngineDescriptor (org.eclipse.ui.texteditor.spelling.SpellingEngineDescriptor)2