|
|
|
|
Re: Code Editor framework [message #1739547 is a reply to message #1739545] |
Tue, 02 August 2016 19:51 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
in general you need:
a) an IPresentationReconciler
b) an IDocumentPartitioner
c) an IDocument document
d) SourceViewerConfiguration
The a setup would look like this
SourceViewer viewer = new SourceViewer();
IPresentationReconciler reconciler = /* Generated by the DSL */;
SourceViewerConfiguration configuration = new SourceViewerConfiguration() {
@Override
public String getStyleclassName() {
return "source-viewer"; //$NON-NLS-1$
}
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
return reconciler;
}
};
IDocumentPartitioner partitioner = .... /* Generated by the DSL */;
IDocument document = new Document();
if( document instanceof IDocumentExtension3 ) {
((IDocumentExtension3)document).setDocumentPartitioner(configuration.getConfiguredDocumentPartitioning(viewer),partitioner);
} else {
document.setDocumentPartitioner(partitioner);
}
document.setDocumentPartitioner(partitioner);
partitioner.connect(document);
viewer.configure(configuration);
viewer.setDocument(document, configuration.getAnnotationModel());
If you don't want to use the DSL we have you need to implement IPresentationReconciler & IDocumentPartitioner yourself.
[Updated on: Tue, 02 August 2016 19:52] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02674 seconds