本文整理汇总了Java中org.eclipse.ui.texteditor.spelling.SpellingProblem类的典型用法代码示例。如果您正苦于以下问题:Java SpellingProblem类的具体用法?Java SpellingProblem怎么用?Java SpellingProblem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpellingProblem类属于org.eclipse.ui.texteditor.spelling包,在下文中一共展示了SpellingProblem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createQuickfixes
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
/**
* @since 2.3
*/
protected List<ICompletionProposal> createQuickfixes(IQuickAssistInvocationContext invocationContext, Set<Annotation> applicableAnnotations) {
List<ICompletionProposal> result = Lists.newArrayList();
ISourceViewer sourceViewer = invocationContext.getSourceViewer();
IAnnotationModel annotationModel = sourceViewer.getAnnotationModel();
IXtextDocument xtextDocument = XtextDocumentUtil.get(sourceViewer);
for(Annotation annotation : applicableAnnotations) {
if (annotation instanceof SpellingAnnotation) {
SpellingProblem spellingProblem = ((SpellingAnnotation) annotation).getSpellingProblem();
result.addAll(asList(spellingProblem.getProposals()));
} else {
final Issue issue = issueUtil.getIssueFromAnnotation(annotation);
if (issue != null) {
Iterable<IssueResolution> resolutions = getResolutions(issue, xtextDocument);
if (resolutions.iterator().hasNext()) {
Position pos = annotationModel.getPosition(annotation);
for (IssueResolution resolution : resolutions) {
result.add(create(pos, resolution));
}
}
}
}
}
return result;
}
开发者ID:cplutte,项目名称:bts,代码行数:28,代码来源:XtextQuickAssistProcessor.java
示例2: isInterestingProblem
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
@Override
protected boolean isInterestingProblem(SpellingProblem problem) {
IStructuredDocument doc = (IStructuredDocument) getDocument();
try {
ITypedRegion[] partitions = doc.computePartitioning(
problem.getOffset(), problem.getLength());
for (ITypedRegion partition : partitions) {
if (partition.getType().equals(ICSSPartitions.STYLE)) {
return false;
}
}
} catch (BadLocationException e) {
// Ignore
}
return super.isInterestingProblem(problem);
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:18,代码来源:UiBinderStructuredRegionProcessor.java
示例3: accept
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
public void accept(SpellingProblem problem) {
IProblemRequestor requestor= fRequestor;
if (requestor != null) {
try {
int line= getDocument().getLineOfOffset(problem.getOffset()) + 1;
String word= getDocument().get(problem.getOffset(), problem.getLength());
boolean dictionaryMatch= false;
boolean sentenceStart= false;
if (problem instanceof JavaSpellingProblem) {
dictionaryMatch= ((JavaSpellingProblem)problem).isDictionaryMatch();
sentenceStart= ((JavaSpellingProblem) problem).isSentenceStart();
}
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=81514
IEditorInput editorInput= fEditor.getEditorInput();
if (editorInput != null) {
CoreSpellingProblem iProblem= new CoreSpellingProblem(problem.getOffset(), problem.getOffset() + problem.getLength() - 1, line, problem.getMessage(), word, dictionaryMatch, sentenceStart, getDocument(), editorInput.getName());
requestor.acceptProblem(iProblem);
}
} catch (BadLocationException x) {
// drop this SpellingProblem
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:JavaSpellingReconcileStrategy.java
示例4: check
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
public void check(IDocument document, IRegion[] regions, SpellingContext context,
ISpellingProblemCollector collector, IProgressMonitor monitor) {
if (ignore == null) {
ignore = new HashSet<String>();
}
IProject project = getProject(document);
String lang = DEFAULT_LANG;
if (project != null) {
lang = TexlipseProperties.getProjectProperty(project, TexlipseProperties.LANGUAGE_PROPERTY);
}
//Get spellchecker for the correct language
SpellChecker spellCheck = getSpellChecker(lang);
if (spellCheck == null) return;
if (collector instanceof TeXSpellingProblemCollector) {
((TeXSpellingProblemCollector) collector).setRegions(regions);
}
try {
spellCheck.addSpellCheckListener(this);
for (final IRegion r : regions) {
errors = new LinkedList<SpellCheckEvent>();
int roffset = r.getOffset();
//Create a new wordfinder and initialize it
TexlipseWordFinder wf = new TexlipseWordFinder();
wf.setIgnoreComments(TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.SPELLCHECKER_IGNORE_COMMENTS));
wf.setIgnoreMath(TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.SPELLCHECKER_IGNORE_MATH));
spellCheck.checkSpelling(new StringWordTokenizer(
document.get(roffset, r.getLength()), wf));
for (SpellCheckEvent error : errors) {
SpellingProblem p = new TexSpellingProblem(error, roffset, lang);
collector.accept(p);
}
}
spellCheck.removeSpellCheckListener(this);
} catch (BadLocationException e) {
e.printStackTrace();
}
}
开发者ID:eclipse,项目名称:texlipse,代码行数:46,代码来源:TexSpellingEngine.java
示例5: apply
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
public final void apply(final IDocument document) {
final ISpellCheckEngine engine= SpellCheckEngine.getInstance();
final ISpellChecker checker= engine.getSpellChecker();
if (checker != null) {
checker.ignoreWord(fWord);
ISourceViewer sourceViewer= fContext.getSourceViewer();
if (sourceViewer != null)
SpellingProblem.removeAll(sourceViewer, fWord);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:WordIgnoreProposal.java
示例6: apply
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
public final void apply(final IDocument document) {
final ISpellCheckEngine engine= SpellCheckEngine.getInstance();
final ISpellChecker checker= engine.getSpellChecker();
if (checker == null)
return;
if (!checker.acceptsWords()) {
final Shell shell;
if (fContext != null && fContext.getSourceViewer() != null)
shell= fContext.getSourceViewer().getTextWidget().getShell();
else
shell= JavaPlugin.getActiveWorkbenchShell();
if (!canAskToConfigure() || !askUserToConfigureUserDictionary(shell))
return;
String[] preferencePageIds= new String[] { "org.eclipse.ui.editors.preferencePages.Spelling" }; //$NON-NLS-1$
PreferencesUtil.createPreferenceDialogOn(shell, preferencePageIds[0], preferencePageIds, null).open();
}
if (checker.acceptsWords()) {
checker.addWord(fWord);
if (fContext != null && fContext.getSourceViewer() != null)
SpellingProblem.removeAll(fContext.getSourceViewer(), fWord);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:AddWordProposal.java
示例7: apply
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
public final void apply(final IDocument document) {
final ISpellCheckEngine engine= SpellCheckEngine.getInstance();
final ISpellChecker checker= engine.getSpellChecker();
if (checker == null)
return;
if (!checker.acceptsWords()) {
final Shell shell;
if (fContext != null && fContext.getSourceViewer() != null)
shell= fContext.getSourceViewer().getTextWidget().getShell();
else
shell= Activator.getActiveWorkbenchShell();
if (!canAskToConfigure() || !askUserToConfigureUserDictionary(shell))
return;
String[] preferencePageIds= new String[] { "org.eclipse.ui.editors.preferencePages.Spelling" }; //$NON-NLS-1$
PreferencesUtil.createPreferenceDialogOn(shell, preferencePageIds[0], preferencePageIds, null).open();
}
if (checker.acceptsWords()) {
checker.addWord(fWord);
if (fContext != null && fContext.getSourceViewer() != null)
SpellingProblem.removeAll(fContext.getSourceViewer(), fWord);
}
}
开发者ID:fabioz,项目名称:eclipse.spellchecker,代码行数:29,代码来源:AddWordProposal.java
示例8: getReconciler
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
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;
}
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:56,代码来源:DwprofileSourceViewerConfiguration.java
示例9: getReconciler
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
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;
}
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:56,代码来源:HyexpressionSourceViewerConfiguration.java
示例10: getReconciler
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
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;
}
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:56,代码来源:HyvalidityformulaSourceViewerConfiguration.java
示例11: getReconciler
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
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;
}
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:56,代码来源:HydatavalueSourceViewerConfiguration.java
示例12: getReconciler
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
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;
}
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:56,代码来源:HymappingSourceViewerConfiguration.java
示例13: getReconciler
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
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;
}
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:56,代码来源:HyconstraintsSourceViewerConfiguration.java
示例14: getReconciler
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
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;
}
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:56,代码来源:HymanifestSourceViewerConfiguration.java
示例15: accept
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
public void accept(SpellingProblem problem) {
fAddAnnotations.put(new Annotation(SPELLING_ERROR, false, problem.getMessage()),
new Position(problem.getOffset(), problem.getLength()));
}
开发者ID:subclipse,项目名称:subclipse,代码行数:5,代码来源:CommitCommentArea.java
示例16: apply
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
public void apply(IDocument document) {
TexSpellDictionary dict = TexSpellingEngine.getDict(fLang);
dict.addWord(ferror.getInvalidWord());
SpellingProblem.removeAll(fviewer, ferror.getInvalidWord());
}
开发者ID:eclipse,项目名称:texlipse,代码行数:6,代码来源:AddToDictProposal.java
示例17: apply
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
public void apply(IDocument document) {
fIgnore.add(fWord);
SpellingProblem.removeAll(fViewer, fWord);
}
开发者ID:eclipse,项目名称:texlipse,代码行数:5,代码来源:IgnoreProposal.java
示例18: accept
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
public void accept(SpellingProblem problem) {
fAddAnnotations.put(new SpellingAnnotation(problem), new Position(problem.getOffset(), problem.getLength()));
}
开发者ID:eclipse,项目名称:texlipse,代码行数:4,代码来源:TeXSpellingReconcileStrategy.java
示例19: accept
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
public void accept(SpellingProblem problem) {
fAddAnnotations.put(new SpellingAnnotation(problem), new Position(problem.getOffset(), problem.getLength()));
}
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:4,代码来源:MultiRegionSpellingReconcileStrategy.java
示例20: accept
import org.eclipse.ui.texteditor.spelling.SpellingProblem; //导入依赖的package包/类
@Override
public void accept(SpellingProblem problem) {
fAddAnnotations
.put(new SpellingAnnotation(problem), new Position(problem.getOffset(), problem.getLength()));
}
开发者ID:fabioz,项目名称:Pydev,代码行数:6,代码来源:PyReconciler.java
注:本文中的org.eclipse.ui.texteditor.spelling.SpellingProblem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论