Search in sources :

Example 1 with MarkupHyperlinkDetector

use of org.eclipse.mylyn.internal.wikitext.ui.editor.syntax.MarkupHyperlinkDetector in project mylyn.docs by eclipse.

the class MarkupSourceViewerConfiguration method createCustomHyperlinkDetectors.

@Override
protected List<IHyperlinkDetector> createCustomHyperlinkDetectors(ISourceViewer sourceViewer) {
    List<IHyperlinkDetector> detectors = new ArrayList<>();
    if (markupHyperlinkDetector == null) {
        markupHyperlinkDetector = new MarkupHyperlinkDetector();
        markupHyperlinkDetector.setMarkupLanguage(markupLanguage);
        markupHyperlinkDetector.setFile(file);
    }
    if (fileRefHyperlinkDetector == null && file != null) {
        Map<String, List<String>> hyperlinkDectectorFileRefRegexes = WikiTextUiPlugin.getDefault().getHyperlinkDectectorFileRefRegexes();
        List<String> fileRefHyperlinkRegexes = hyperlinkDectectorFileRefRegexes.getOrDefault(markupLanguage.getName(), ImmutableList.of());
        fileRefHyperlinkDetector = new FileRefHyperlinkDetector(file.getParent(), fileRefHyperlinkRegexes);
    }
    detectors.add(markupHyperlinkDetector);
    detectors.add(fileRefHyperlinkDetector);
    detectors.add(markupHyperlinkDetector);
    detectors.addAll(super.createCustomHyperlinkDetectors(sourceViewer));
    return detectors;
}
Also used : FileRefHyperlinkDetector(org.eclipse.mylyn.internal.wikitext.ui.editor.syntax.FileRefHyperlinkDetector) IHyperlinkDetector(org.eclipse.jface.text.hyperlink.IHyperlinkDetector) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) MarkupHyperlinkDetector(org.eclipse.mylyn.internal.wikitext.ui.editor.syntax.MarkupHyperlinkDetector)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 IHyperlinkDetector (org.eclipse.jface.text.hyperlink.IHyperlinkDetector)1 FileRefHyperlinkDetector (org.eclipse.mylyn.internal.wikitext.ui.editor.syntax.FileRefHyperlinkDetector)1 MarkupHyperlinkDetector (org.eclipse.mylyn.internal.wikitext.ui.editor.syntax.MarkupHyperlinkDetector)1