use of org.eclipse.mylyn.internal.wikitext.ui.editor.syntax.MarkupDocumentProvider in project mylyn.docs by eclipse.
the class MarkupEditor method setMarkupLanguage.
public void setMarkupLanguage(MarkupLanguage markupLanguage, boolean persistSetting) {
if (markupLanguage instanceof AbstractMarkupLanguage) {
((AbstractMarkupLanguage) markupLanguage).setEnableMacros(false);
}
((MarkupDocumentProvider) getDocumentProvider()).setMarkupLanguage(markupLanguage);
IDocument document = getDocumentProvider().getDocument(getEditorInput());
IDocumentPartitioner partitioner = document.getDocumentPartitioner();
if (partitioner instanceof FastMarkupPartitioner) {
final FastMarkupPartitioner fastMarkupPartitioner = (FastMarkupPartitioner) partitioner;
fastMarkupPartitioner.setMarkupLanguage(markupLanguage);
}
sourceViewerConfiguration.setMarkupLanguage(markupLanguage);
if (getSourceViewer() != null) {
getSourceViewer().invalidateTextPresentation();
}
outlineDirty = true;
scheduleOutlineUpdate();
updateSourceTabLabel();
if (viewer != null) {
viewer.getTextWidget().setData(MarkupLanguage.class.getName(), getMarkupLanguage());
}
if (persistSetting && markupLanguage != null) {
storeMarkupLanguagePreference(markupLanguage);
}
if (persistSetting) {
ISourceViewer sourceViewer = getSourceViewer();
if (sourceViewer instanceof MarkupProjectionViewer) {
IReconciler reconciler = ((MarkupProjectionViewer) sourceViewer).getReconciler();
if (reconciler instanceof MarkupMonoReconciler) {
((MarkupMonoReconciler) reconciler).forceReconciling();
}
}
}
}
Aggregations