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

项目:Eclipse-Postfix-Code-Completion    文件:PropertiesFileSourceViewerConfiguration.java   
@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;
}
项目:editorconfig-eclipse    文件:EditorConfigSourceViewerConfiguration.java   
@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;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:PropertiesFileSourceViewerConfiguration.java   
@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;
}
项目:fluentmark    文件:MkReconcilingStrategy.java   
public IReconcilingStrategy[] getReconcilingStrategies() {
    if (store.getBoolean(Prefs.SPELLING_ENABLED)) {
        SpellingService service = new SpellingService(store);
        if (service.getActiveSpellingEngineDescriptor(store) != null) {
            IReconcilingStrategy spellStrategy = new SpellingReconcileStrategy(viewer, service);
            return new IReconcilingStrategy[] { spellStrategy };
        }
    }
    return new IReconcilingStrategy[] { new NullReconcilingStrategy() };
}
项目:gwt-eclipse-plugin    文件:GWTJavaSpellingReconcileStrategy.java   
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);
  }
}
项目:DarwinSPL    文件:DwprofileSourceViewerConfiguration.java   
public IReconciler getReconciler(final ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        return null;
    }

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

    IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService) {

        @Override
        protected ISpellingProblemCollector createSpellingProblemCollector() {
            final ISpellingProblemCollector collector = super.createSpellingProblemCollector();

            return new ISpellingProblemCollector() {

                public void accept(SpellingProblem problem) {
                    int offset = problem.getOffset();
                    int length = problem.getLength();
                    if (sourceViewer == null) {
                        return;
                    }
                    IDocument document = sourceViewer.getDocument();
                    if (document == null) {
                        return;
                    }
                    String text;
                    try {
                        text = document.get(offset, length);
                    } catch (BadLocationException e) {
                        return;
                    }
                    if (new de.darwinspl.preferences.resource.dwprofile.ui.DwprofileIgnoredWordsFilter().ignoreWord(text)) {
                        return;
                    }
                    collector.accept(problem);
                }

                public void beginCollecting() {
                    collector.beginCollecting();
                }

                public void endCollecting() {
                    collector.endCollecting();
                }
            };
        }
    };

    MonoReconciler reconciler = new MonoReconciler(strategy, false);
    reconciler.setDelay(500);
    return reconciler;
}
项目:DarwinSPL    文件:HyexpressionSourceViewerConfiguration.java   
public IReconciler getReconciler(final ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        return null;
    }

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

    IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService) {

        @Override
        protected ISpellingProblemCollector createSpellingProblemCollector() {
            final ISpellingProblemCollector collector = super.createSpellingProblemCollector();

            return new ISpellingProblemCollector() {

                public void accept(SpellingProblem problem) {
                    int offset = problem.getOffset();
                    int length = problem.getLength();
                    if (sourceViewer == null) {
                        return;
                    }
                    IDocument document = sourceViewer.getDocument();
                    if (document == null) {
                        return;
                    }
                    String text;
                    try {
                        text = document.get(offset, length);
                    } catch (BadLocationException e) {
                        return;
                    }
                    if (new eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionIgnoredWordsFilter().ignoreWord(text)) {
                        return;
                    }
                    collector.accept(problem);
                }

                public void beginCollecting() {
                    collector.beginCollecting();
                }

                public void endCollecting() {
                    collector.endCollecting();
                }
            };
        }
    };

    MonoReconciler reconciler = new MonoReconciler(strategy, false);
    reconciler.setDelay(500);
    return reconciler;
}
项目:DarwinSPL    文件:HyvalidityformulaSourceViewerConfiguration.java   
public IReconciler getReconciler(final ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        return null;
    }

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

    IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService) {

        @Override
        protected ISpellingProblemCollector createSpellingProblemCollector() {
            final ISpellingProblemCollector collector = super.createSpellingProblemCollector();

            return new ISpellingProblemCollector() {

                public void accept(SpellingProblem problem) {
                    int offset = problem.getOffset();
                    int length = problem.getLength();
                    if (sourceViewer == null) {
                        return;
                    }
                    IDocument document = sourceViewer.getDocument();
                    if (document == null) {
                        return;
                    }
                    String text;
                    try {
                        text = document.get(offset, length);
                    } catch (BadLocationException e) {
                        return;
                    }
                    if (new eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaIgnoredWordsFilter().ignoreWord(text)) {
                        return;
                    }
                    collector.accept(problem);
                }

                public void beginCollecting() {
                    collector.beginCollecting();
                }

                public void endCollecting() {
                    collector.endCollecting();
                }
            };
        }
    };

    MonoReconciler reconciler = new MonoReconciler(strategy, false);
    reconciler.setDelay(500);
    return reconciler;
}
项目:DarwinSPL    文件:HydatavalueSourceViewerConfiguration.java   
public IReconciler getReconciler(final ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        return null;
    }

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

    IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService) {

        @Override
        protected ISpellingProblemCollector createSpellingProblemCollector() {
            final ISpellingProblemCollector collector = super.createSpellingProblemCollector();

            return new ISpellingProblemCollector() {

                public void accept(SpellingProblem problem) {
                    int offset = problem.getOffset();
                    int length = problem.getLength();
                    if (sourceViewer == null) {
                        return;
                    }
                    IDocument document = sourceViewer.getDocument();
                    if (document == null) {
                        return;
                    }
                    String text;
                    try {
                        text = document.get(offset, length);
                    } catch (BadLocationException e) {
                        return;
                    }
                    if (new eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueIgnoredWordsFilter().ignoreWord(text)) {
                        return;
                    }
                    collector.accept(problem);
                }

                public void beginCollecting() {
                    collector.beginCollecting();
                }

                public void endCollecting() {
                    collector.endCollecting();
                }
            };
        }
    };

    MonoReconciler reconciler = new MonoReconciler(strategy, false);
    reconciler.setDelay(500);
    return reconciler;
}
项目:DarwinSPL    文件:HymappingSourceViewerConfiguration.java   
public IReconciler getReconciler(final ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        return null;
    }

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

    IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService) {

        @Override
        protected ISpellingProblemCollector createSpellingProblemCollector() {
            final ISpellingProblemCollector collector = super.createSpellingProblemCollector();

            return new ISpellingProblemCollector() {

                public void accept(SpellingProblem problem) {
                    int offset = problem.getOffset();
                    int length = problem.getLength();
                    if (sourceViewer == null) {
                        return;
                    }
                    IDocument document = sourceViewer.getDocument();
                    if (document == null) {
                        return;
                    }
                    String text;
                    try {
                        text = document.get(offset, length);
                    } catch (BadLocationException e) {
                        return;
                    }
                    if (new eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingIgnoredWordsFilter().ignoreWord(text)) {
                        return;
                    }
                    collector.accept(problem);
                }

                public void beginCollecting() {
                    collector.beginCollecting();
                }

                public void endCollecting() {
                    collector.endCollecting();
                }
            };
        }
    };

    MonoReconciler reconciler = new MonoReconciler(strategy, false);
    reconciler.setDelay(500);
    return reconciler;
}
项目:DarwinSPL    文件:HyconstraintsSourceViewerConfiguration.java   
public IReconciler getReconciler(final ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        return null;
    }

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

    IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService) {

        @Override
        protected ISpellingProblemCollector createSpellingProblemCollector() {
            final ISpellingProblemCollector collector = super.createSpellingProblemCollector();

            return new ISpellingProblemCollector() {

                public void accept(SpellingProblem problem) {
                    int offset = problem.getOffset();
                    int length = problem.getLength();
                    if (sourceViewer == null) {
                        return;
                    }
                    IDocument document = sourceViewer.getDocument();
                    if (document == null) {
                        return;
                    }
                    String text;
                    try {
                        text = document.get(offset, length);
                    } catch (BadLocationException e) {
                        return;
                    }
                    if (new eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsIgnoredWordsFilter().ignoreWord(text)) {
                        return;
                    }
                    collector.accept(problem);
                }

                public void beginCollecting() {
                    collector.beginCollecting();
                }

                public void endCollecting() {
                    collector.endCollecting();
                }
            };
        }
    };

    MonoReconciler reconciler = new MonoReconciler(strategy, false);
    reconciler.setDelay(500);
    return reconciler;
}
项目:DarwinSPL    文件:HymanifestSourceViewerConfiguration.java   
public IReconciler getReconciler(final ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        return null;
    }

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

    IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService) {

        @Override
        protected ISpellingProblemCollector createSpellingProblemCollector() {
            final ISpellingProblemCollector collector = super.createSpellingProblemCollector();

            return new ISpellingProblemCollector() {

                public void accept(SpellingProblem problem) {
                    int offset = problem.getOffset();
                    int length = problem.getLength();
                    if (sourceViewer == null) {
                        return;
                    }
                    IDocument document = sourceViewer.getDocument();
                    if (document == null) {
                        return;
                    }
                    String text;
                    try {
                        text = document.get(offset, length);
                    } catch (BadLocationException e) {
                        return;
                    }
                    if (new eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestIgnoredWordsFilter().ignoreWord(text)) {
                        return;
                    }
                    collector.accept(problem);
                }

                public void beginCollecting() {
                    collector.beginCollecting();
                }

                public void endCollecting() {
                    collector.endCollecting();
                }
            };
        }
    };

    MonoReconciler reconciler = new MonoReconciler(strategy, false);
    reconciler.setDelay(500);
    return reconciler;
}
项目:gwt-eclipse-plugin    文件:GWTJavaSpellingReconcileStrategyTest.java   
/**
 * 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);
}