use of org.eclipse.linuxtools.internal.rpm.ui.editor.hyperlink.MailHyperlink in project linuxtools by eclipse.
the class MailHyperlinkDetectorTest method testDetectHyperlinks.
@Test
public void testDetectHyperlinks() throws PartInitException {
String testText = "Version: 0.0\n" + "Release: 0\n" + "%changelog\n" + "* Fri Feb 27 2009 Test <someone@smth.com> 3.3.2.4-6\n-\n" + "* Fri Feb 27 2009 Test someone@smth.com 3.3.2.4-6\n-\n";
newFile(testText);
IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), testFile, "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor");
editor = (SpecfileEditor) openEditor;
editor.doRevertToSaved();
MailHyperlinkDetector elementDetector = new MailHyperlinkDetector();
elementDetector.setEditor(editor);
// test mail
IRegion region = new Region(38, 0);
IHyperlink[] returned = elementDetector.detectHyperlinks(editor.getSpecfileSourceViewer(), region, false);
assertEquals(1, returned.length);
assertTrue(returned[0] instanceof MailHyperlink);
region = new Region(124, 0);
returned = elementDetector.detectHyperlinks(editor.getSpecfileSourceViewer(), region, false);
assertEquals(1, returned.length);
assertTrue(returned[0] instanceof MailHyperlink);
}
Aggregations