use of org.eclipse.jface.text.reconciler.MonoReconciler in project KaiZen-OpenAPI-Editor by RepreZen.
the class JsonSourceViewerConfiguration method getReconciler.
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
JsonReconcilingStrategy strategy = new JsonReconcilingStrategy();
strategy.setEditor(editor);
MonoReconciler reconciler = new MonoReconciler(strategy, false);
return reconciler;
}
use of org.eclipse.jface.text.reconciler.MonoReconciler in project eclipse.platform.text by eclipse.
the class TextSourceViewerConfiguration method getReconciler.
/**
* Returns the reconciler ready to be used with the given source viewer.
* <p>
* This implementation currently returns a {@link MonoReconciler} which
* is responsible for spell checking. In the future a different reconciler
* taking over more responsibilities might be returned.</p>
*
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
* @since 3.3
*/
@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;
IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService);
MonoReconciler reconciler = new MonoReconciler(strategy, false);
reconciler.setDelay(500);
return reconciler;
}
use of org.eclipse.jface.text.reconciler.MonoReconciler in project eclipse.platform.text by eclipse.
the class CodeMiningDemo method main.
public static void main(String[] args) throws Exception {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setText("Code Mining demo");
ISourceViewer sourceViewer = new SourceViewer(shell, null, SWT.V_SCROLL | SWT.BORDER);
sourceViewer.setDocument(new Document("// Type class & new keyword and see references CodeMining\n" + "// Name class with a number N to emulate Nms before resolving the references CodeMining \n\n" + "class A\n" + "new A\n" + "new A\n\n" + "class 5\n" + "new 5\n" + "new 5\n" + "new 5"), new AnnotationModel());
// Add AnnotationPainter (required by CodeMining)
addAnnotationPainter(sourceViewer);
// Initialize codemining providers
((ISourceViewerExtension5) sourceViewer).setCodeMiningProviders(new ICodeMiningProvider[] { new ClassReferenceCodeMiningProvider(), new ClassImplementationsCodeMiningProvider() });
// Execute codemining in a reconciler
MonoReconciler reconciler = new MonoReconciler(new IReconcilingStrategy() {
@Override
public void setDocument(IDocument document) {
((ISourceViewerExtension5) sourceViewer).updateCodeMinings();
}
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
}
@Override
public void reconcile(IRegion partition) {
((ISourceViewerExtension5) sourceViewer).updateCodeMinings();
}
}, false);
reconciler.install(sourceViewer);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
use of org.eclipse.jface.text.reconciler.MonoReconciler in project eclipse.platform.text by eclipse.
the class InlinedAnnotationDemo method main.
public static void main(String[] args) throws Exception {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setText("Inlined annotation demo");
// Create source viewer and initialize the content
ISourceViewer sourceViewer = new SourceViewer(shell, null, SWT.V_SCROLL | SWT.BORDER);
sourceViewer.setDocument(new Document("\ncolor:rgb(255, 255, 0)"), new AnnotationModel());
// Initialize inlined annotations support
InlinedAnnotationSupport support = new InlinedAnnotationSupport();
support.install(sourceViewer, createAnnotationPainter(sourceViewer));
// Refresh inlined annotation in none UI Thread with reconciler.
MonoReconciler reconciler = new MonoReconciler(new IReconcilingStrategy() {
@Override
public void setDocument(IDocument document) {
Set<AbstractInlinedAnnotation> annotations = getInlinedAnnotation(sourceViewer, support);
support.updateAnnotations(annotations);
}
@Override
public void reconcile(IRegion partition) {
Set<AbstractInlinedAnnotation> anns = getInlinedAnnotation(sourceViewer, support);
support.updateAnnotations(anns);
}
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
}
}, false);
reconciler.setDelay(1);
reconciler.install(sourceViewer);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
use of org.eclipse.jface.text.reconciler.MonoReconciler in project linuxtools by eclipse.
the class SpecfileConfiguration method getReconciler.
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
if (editor != null && editor.isEditable()) {
SpecfileReconcilingStrategy strategy = new SpecfileReconcilingStrategy(editor);
MonoReconciler reconciler = new MonoReconciler(strategy, false);
reconciler.setProgressMonitor(new NullProgressMonitor());
reconciler.setDelay(500);
return reconciler;
}
return null;
}
Aggregations