Search in sources :

Example 1 with IssueNavigationLink

use of com.intellij.openapi.vcs.IssueNavigationLink in project intellij-community by JetBrains.

the class JavadocHighlightingTest method testIssueLinksInJavaDoc.

public void testIssueLinksInJavaDoc() {
    IssueNavigationConfiguration navigationConfiguration = IssueNavigationConfiguration.getInstance(getProject());
    List<IssueNavigationLink> oldLinks = navigationConfiguration.getLinks();
    try {
        navigationConfiguration.setLinks(ContainerUtil.newArrayList(new IssueNavigationLink("ABC-\\d+", "http://example.com/$0"), new IssueNavigationLink("INVALID-\\d+", "http://example.com/$0/$1")));
        configureByFile(getTestName(false) + ".java");
        List<String> expected = ContainerUtil.newArrayList("http://example.com/ABC-1123", "http://example.com/ABC-2", "http://example.com/ABC-22", "http://example.com/ABC-11");
        List<WebReference> refs = PlatformTestUtil.collectWebReferences(myFile);
        assertTrue(refs.stream().allMatch(PsiReferenceBase::isSoft));
        assertEquals(expected, refs.stream().map(WebReference::getUrl).collect(Collectors.toList()));
    } finally {
        navigationConfiguration.setLinks(oldLinks);
    }
}
Also used : WebReference(com.intellij.openapi.paths.WebReference) IssueNavigationLink(com.intellij.openapi.vcs.IssueNavigationLink) IssueNavigationConfiguration(com.intellij.openapi.vcs.IssueNavigationConfiguration)

Example 2 with IssueNavigationLink

use of com.intellij.openapi.vcs.IssueNavigationLink in project intellij-community by JetBrains.

the class IssueNavigationConfigurationPanel method reset.

public void reset() {
    IssueNavigationConfiguration configuration = IssueNavigationConfiguration.getInstance(myProject);
    myLinks = new ArrayList<>();
    for (IssueNavigationLink link : configuration.getLinks()) {
        myLinks.add(new IssueNavigationLink(link.getIssueRegexp(), link.getLinkRegexp()));
    }
    myModel = new ListTableModel<>(new ColumnInfo[] { ISSUE_COLUMN, LINK_COLUMN }, myLinks, 0);
    myLinkTable.setModel(myModel);
}
Also used : IssueNavigationLink(com.intellij.openapi.vcs.IssueNavigationLink) ColumnInfo(com.intellij.util.ui.ColumnInfo) IssueNavigationConfiguration(com.intellij.openapi.vcs.IssueNavigationConfiguration)

Aggregations

IssueNavigationConfiguration (com.intellij.openapi.vcs.IssueNavigationConfiguration)2 IssueNavigationLink (com.intellij.openapi.vcs.IssueNavigationLink)2 WebReference (com.intellij.openapi.paths.WebReference)1 ColumnInfo (com.intellij.util.ui.ColumnInfo)1