use of org.eclipse.mylyn.internal.wikitext.ui.editor.syntax.FastMarkupPartitioner 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();
}
}
}
}
use of org.eclipse.mylyn.internal.wikitext.ui.editor.syntax.FastMarkupPartitioner in project mylyn.docs by eclipse.
the class WikiTextSourcePartitioning method configurePartitioning.
/**
* Configure partitioning on a document using the specified markup language.
*
* @param document
* the document that should have its partitioning configured
* @param markupLanguage
* the markup language to use, or null
* @since 3.0
*/
public static void configurePartitioning(IDocument document, MarkupLanguage markupLanguage) {
FastMarkupPartitioner partitioner = new FastMarkupPartitioner();
partitioner.setMarkupLanguage(markupLanguage == null ? null : markupLanguage.clone());
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
}
use of org.eclipse.mylyn.internal.wikitext.ui.editor.syntax.FastMarkupPartitioner in project mylyn.docs by eclipse.
the class WikiTextSourceEditor method setMarkupLanguage.
/**
* set the markup language. If unspecified, it's assumed to be Textile.
*
* @since 3.0
*/
public void setMarkupLanguage(MarkupLanguage markupLanguage) {
this.markupLanguage = markupLanguage;
if (this.markupLanguage instanceof AbstractMarkupLanguage) {
((AbstractMarkupLanguage) this.markupLanguage).setEnableMacros(false);
}
sourceViewerConfiguration.setMarkupLanguage(markupLanguage);
IDocumentProvider documentProvider = getDocumentProvider();
if (documentProvider instanceof WikiTextDocumentProvider) {
((WikiTextDocumentProvider) documentProvider).setMarkupLanguage(markupLanguage);
}
if (getEditorInput() != null) {
IDocument document = documentProvider.getDocument(getEditorInput());
IDocumentPartitioner partitioner = document.getDocumentPartitioner();
if (partitioner instanceof FastMarkupPartitioner) {
final FastMarkupPartitioner fastMarkupPartitioner = (FastMarkupPartitioner) partitioner;
fastMarkupPartitioner.setMarkupLanguage(markupLanguage);
}
}
if (viewer != null) {
viewer.getTextWidget().setData(MarkupLanguage.class.getName(), getMarkupLanguage());
}
if (getSourceViewer() != null) {
getSourceViewer().invalidateTextPresentation();
}
}
use of org.eclipse.mylyn.internal.wikitext.ui.editor.syntax.FastMarkupPartitioner in project mylyn.docs by eclipse.
the class MarkupEditor method getMarkupLanguage.
public MarkupLanguage getMarkupLanguage() {
IDocument document = getDocumentProvider().getDocument(getEditorInput());
IDocumentPartitioner partitioner = document.getDocumentPartitioner();
MarkupLanguage markupLanguage = null;
if (partitioner instanceof FastMarkupPartitioner) {
markupLanguage = ((FastMarkupPartitioner) partitioner).getMarkupLanguage();
}
return markupLanguage;
}
use of org.eclipse.mylyn.internal.wikitext.ui.editor.syntax.FastMarkupPartitioner in project mylyn.docs by eclipse.
the class MarkupSourceViewer method configurePartitioning.
private void configurePartitioning(IDocument document) {
FastMarkupPartitioner partitioner = new FastMarkupPartitioner();
partitioner.setMarkupLanguage(markupLanguage.clone());
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
}
Aggregations