use of org.eclipse.wst.xsl.ui.internal.editor.XSLHyperlinkDetector in project webtools.sourceediting by eclipse.
the class TestXSLHyperlinkDetector method testWithParmVariableLink.
@Test
public void testWithParmVariableLink() throws Exception {
setUpTest("DraftReleaseCRs.xsl");
try {
XSLHyperlinkDetector linkDetector = new XSLHyperlinkDetector();
IRegion region = new Region(sourceViewer.getDocument().getLineOffset(74) + 44, 0);
boolean canShowMultipleLinks = true;
IHyperlink[] links = linkDetector.detectHyperlinks(sourceViewer, region, canShowMultipleLinks);
assertNotNull("No links returned", links);
assertEquals("Unexpected number of links", 1, links.length);
IHyperlink link = links[0];
assertTrue("Wrong file returned.", link.getHyperlinkText().contains("utils.xsl"));
} finally {
model.releaseFromEdit();
}
}
use of org.eclipse.wst.xsl.ui.internal.editor.XSLHyperlinkDetector in project webtools.sourceediting by eclipse.
the class TestXSLHyperlinkDetector method testDetectHyperlinksViewer.
@Test
public void testDetectHyperlinksViewer() throws Exception {
setUpTest("DraftReleaseCRs.xsl");
try {
XSLHyperlinkDetector linkDetector = new XSLHyperlinkDetector();
IRegion region = new Region(sourceViewer.getDocument().getLineOffset(28) + 54, 0);
boolean canShowMultipleLinks = true;
IHyperlink[] links = linkDetector.detectHyperlinks(sourceViewer, region, canShowMultipleLinks);
assertNotNull("No links returned", links);
assertEquals("Unexpected number of links", 1, links.length);
} finally {
model.releaseFromEdit();
}
}
use of org.eclipse.wst.xsl.ui.internal.editor.XSLHyperlinkDetector in project webtools.sourceediting by eclipse.
the class TestXSLHyperlinkDetector method testDetectHyperlinksDocument.
@Test
public void testDetectHyperlinksDocument() throws Exception {
setUpTest("DraftReleaseCRs.xsl");
try {
XSLHyperlinkDetector linkDetector = new XSLHyperlinkDetector();
IRegion region = new Region(sourceViewer.getDocument().getLineOffset(28) + 54, 0);
boolean canShowMultipleLinks = true;
IHyperlink[] links = linkDetector.detectHyperlinks(document, region, canShowMultipleLinks);
assertNotNull("No links returned", links);
assertEquals("Unexpected number of links", 1, links.length);
} finally {
model.releaseFromEdit();
}
}
use of org.eclipse.wst.xsl.ui.internal.editor.XSLHyperlinkDetector in project webtools.sourceediting by eclipse.
the class StructuredTextViewerConfigurationXSL method getHyperlinkDetectors.
/**
* (non-Javadoc)
*
* @see org.eclipse.ui.editors.text.TextSourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
*/
@Override
public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
if (sourceViewer == null || !fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED))
return null;
IHyperlinkDetector[] superDetectors = super.getHyperlinkDetectors(sourceViewer);
IHyperlinkDetector[] allDetectors = new IHyperlinkDetector[superDetectors.length + 1];
allDetectors[0] = new XSLHyperlinkDetector();
System.arraycopy(superDetectors, 0, allDetectors, 1, superDetectors.length);
return allDetectors;
}
Aggregations