You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jo...@apache.org on 2018/06/26 20:28:15 UTC
[incubator-netbeans] branch master updated: [NETBEANS-290] Provided
support for hyperlink on dependencies. (#481)
This is an automated email from the ASF dual-hosted git repository.
johnmcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new cb1c221 [NETBEANS-290] Provided support for hyperlink on dependencies. (#481)
cb1c221 is described below
commit cb1c221ac80ac201eb2e483dd55964560fc2c694
Author: John McDonnell <mc...@gmail.com>
AuthorDate: Tue Jun 26 21:28:12 2018 +0100
[NETBEANS-290] Provided support for hyperlink on dependencies. (#481)
* [NETBEANS-290] Provided support for hyperlink on dependencies.
---
.../maven/hyperlinks/HyperlinkProviderImpl.java | 668 ++++++++++++---------
.../unit/data/test_projects/hyperlinks/pom.xml | 48 ++
.../unit/data/test_projects/hyperlinks2/pom.xml | 19 +
.../test_projects/hyperlinks2/subModule/pom.xml | 16 +
...perlinkProviderImplTestForMultiPomProjects.java | 161 +++++
...erlinkProviderImplTestForSinglePomProjects.java | 285 +++++++++
6 files changed, 917 insertions(+), 280 deletions(-)
diff --git a/maven.grammar/src/org/netbeans/modules/maven/hyperlinks/HyperlinkProviderImpl.java b/maven.grammar/src/org/netbeans/modules/maven/hyperlinks/HyperlinkProviderImpl.java
index 1ed9be3..279a45c 100644
--- a/maven.grammar/src/org/netbeans/modules/maven/hyperlinks/HyperlinkProviderImpl.java
+++ b/maven.grammar/src/org/netbeans/modules/maven/hyperlinks/HyperlinkProviderImpl.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.netbeans.modules.maven.hyperlinks;
+import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collections;
@@ -26,8 +26,10 @@ import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.text.Document;
+import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.InputLocation;
import org.apache.maven.model.InputSource;
+import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
import org.netbeans.api.editor.mimelookup.MimeRegistration;
import org.netbeans.api.editor.mimelookup.MimeRegistrations;
@@ -46,6 +48,8 @@ import org.netbeans.modules.maven.api.FileUtilities;
import org.netbeans.modules.maven.api.ModelUtils;
import org.netbeans.modules.maven.api.NbMavenProject;
import org.netbeans.modules.maven.api.PluginPropertyUtils;
+import org.netbeans.modules.maven.embedder.EmbedderFactory;
+import org.netbeans.modules.maven.embedder.MavenEmbedder;
import org.netbeans.modules.maven.grammar.POMDataObject;
import org.openide.awt.HtmlBrowser;
import org.openide.cookies.EditCookie;
@@ -57,311 +61,71 @@ import org.openide.text.Line;
import org.openide.util.NbBundle.Messages;
import static org.netbeans.modules.maven.hyperlinks.Bundle.*;
import org.netbeans.modules.maven.spi.nodes.NodeUtils;
+import org.openide.filesystems.FileUtil;
/**
* adds hyperlinking support to pom.xml files..
+ *
* @author mkleint
*/
@MimeRegistrations({
- @MimeRegistration(mimeType=Constants.POM_MIME_TYPE, service=HyperlinkProviderExt.class, position = 1000),
- @MimeRegistration(mimeType=POMDataObject.SETTINGS_MIME_TYPE, service=HyperlinkProviderExt.class, position = 1000)
+ @MimeRegistration(mimeType = Constants.POM_MIME_TYPE, service = HyperlinkProviderExt.class, position = 1000)
+ ,
+ @MimeRegistration(mimeType = POMDataObject.SETTINGS_MIME_TYPE, service = HyperlinkProviderExt.class, position = 1000)
})
public class HyperlinkProviderImpl implements HyperlinkProviderExt {
+
private static final Logger LOG = Logger.getLogger(HyperlinkProviderImpl.class.getName());
-
+
@Override
public boolean isHyperlinkPoint(final Document doc, final int offset, HyperlinkType type) {
- final boolean[] isText = new boolean[1];
- final int[] ftokenOff = new int[1];
- final String[] ftext = new String[1];
- doc.render(new Runnable() {
-
- @Override
- public void run() {
- isText[0] = false;
- TokenHierarchy th = TokenHierarchy.get(doc);
- TokenSequence<XMLTokenId> xml = th.tokenSequence(XMLTokenId.language());
- xml.move(offset);
- xml.moveNext();
- Token<XMLTokenId> token = xml.token();
+ final PomHyperlinkInfo hyperLinkInfo = new PomHyperlinkInfo(doc, offset);
+ doc.render(new PomParserRunnable(hyperLinkInfo, doc, offset));
- // when it's not a value -> do nothing.
- if (token == null) {
-
- return;
- }
- if (token.id() == XMLTokenId.TEXT) {
- isText[0] = true;
- ftokenOff[0] = xml.offset();
- ftext[0] = token.text().toString();
- }
- }
- });
-
- if (isText[0]) {
- //we are in element text
- FileObject fo = getProjectDir(doc);
- String text = ftext[0];
- int tokenOff = ftokenOff[0];
- if (fo != null && getPath(fo, text) != null) {
- return true;
- }
- // urls get opened..
- if (text != null &&
- (text.startsWith("http://") || //NOI18N
- (text.startsWith("https://")))) { //NOI18N
- return true;
- }
- if (text != null) {
- int ff = offset - tokenOff;
- if (ff > -1 && ff < text.length()) {
- String before = text.substring(0, ff);
- String after = text.substring(ff, text.length());
- int bo = before.lastIndexOf("${");//NOI18N
- int bc = before.lastIndexOf("}");//NOI18N
- int ao = after.indexOf("${");//NOI18N
- int ac = after.indexOf("}");//NOI18N
- if (bo > bc && ac > -1 && (ac < ao || ao == -1)) {
- return true;
- }
- }
- }
- }
- return false;
+ return hyperLinkInfo.isHyperlinkPoint();
}
@Override
public int[] getHyperlinkSpan(final Document doc, final int offset, HyperlinkType type) {
- final boolean[] isText = new boolean[1];
- final int[] ftokenOff = new int[1];
- final String[] ftext = new String[1];
-
- doc.render(new Runnable() {
-
- @Override
- public void run() {
- isText[0] = false;
- TokenHierarchy th = TokenHierarchy.get(doc);
- TokenSequence<XMLTokenId> xml = th.tokenSequence(XMLTokenId.language());
- xml.move(offset);
- xml.moveNext();
- Token<XMLTokenId> token = xml.token();
+ final PomHyperlinkInfo hyperLinkInfo = new PomHyperlinkInfo(doc, offset);
+ doc.render(new PomParserRunnable(hyperLinkInfo, doc, offset));
- // when it's not a value -> do nothing.
- if (token == null) {
-
- return;
- }
- if (token.id() == XMLTokenId.TEXT) {
- isText[0] = true;
- ftokenOff[0] = xml.offset();
- ftext[0] = token.text().toString();
- }
- }
- });
-
- if (isText[0]) {
- //we are in element text
- FileObject fo = getProjectDir(doc);
- int tokenOff = ftokenOff[0];
- String text = ftext[0];
- if (fo != null && getPath(fo, text) != null) {
- return new int[] { tokenOff, tokenOff + text.length() };
- }
- // urls get opened..
- if (text != null &&
- (text.startsWith("http://") || //NOI18N
- (text.startsWith("https://")))) { //NOI18N
- return new int[] { tokenOff, tokenOff + text.length() };
- }
- if (text != null) {
- Tuple prop = findProperty(text, tokenOff, offset);
- if (prop != null) {
- return new int[] { prop.spanStart, prop.spanEnd};
- }
- }
- }
- return null;
+ return hyperLinkInfo.getHyperLinkSpan();
}
@Override
public void performClickAction(final Document doc, final int offset, HyperlinkType type) {
- final boolean[] isText = new boolean[1];
- final int[] ftokenOff = new int[1];
- final String[] ftext = new String[1];
- final FileObject fo = getProjectDir(doc);
- doc.render(new Runnable() {
-
- @Override
- public void run() {
- isText[0] = false;
- TokenHierarchy th = TokenHierarchy.get(doc);
- TokenSequence<XMLTokenId> xml = th.tokenSequence(XMLTokenId.language());
- xml.move(offset);
- xml.moveNext();
- Token<XMLTokenId> token = xml.token();
-
- // when it's not a value -> do nothing.
- if (token == null) {
-
- return;
- }
- if (token.id() == XMLTokenId.TEXT) {
- isText[0] = true;
- ftokenOff[0] = xml.offset();
- ftext[0] = token.text().toString();
- if (fo != null && getPath(fo, ftext[0]) != null) {
- xml.movePrevious();
- token = xml.token();
- if (token != null && token.id().equals(XMLTokenId.TAG) && TokenUtilities.equals(token.text(), ">")) {//NOI18N
- xml.movePrevious();
- token = xml.token();
- if (token != null && token.id().equals(XMLTokenId.TAG) && TokenUtilities.equals(token.text(), "<module")) {//NOI18N
- if (!ftext[0].endsWith("/pom.xml")) {
- ftext[0] = ftext[0] + "/pom.xml"; //NOI18N
- }
- }
- }
- }
- }
- }
- });
-
- if (isText[0]) {
- //we are in element text
- int tokenOff = ftokenOff[0];
- String text = ftext[0];
-
- if (fo != null && getPath(fo, text) != null) {
- FileObject file = getPath(fo, text);
- NodeUtils.openPomFile(file);
- }
- // urls get opened..
- if (text != null &&
- (text.startsWith("http://") || //NOI18N
- (text.startsWith("https://")))) { //NOI18N
- try {
- String urlText = text;
- if (urlText.contains("${")) {//NOI18N
- //special case, need to evaluate expression
- Project nbprj = getProject(doc);
- if (nbprj != null) {
- Object exRes;
- try {
- exRes = PluginPropertyUtils.createEvaluator(nbprj).evaluate(urlText);
- if (exRes != null) {
- urlText = exRes.toString();
- }
- } catch (ExpressionEvaluationException ex) {
- //just ignore
- LOG.log(Level.FINE, "Expression evaluation failed", ex);
- }
+ final PomHyperlinkInfo hyperLinkInfo = new PomHyperlinkInfo(doc, offset);
+ doc.render(new PomParserRunnable(hyperLinkInfo, doc, offset));
- }
- }
- URL url = new URL(urlText);
- HtmlBrowser.URLDisplayer.getDefault().showURL(url);
- } catch (MalformedURLException ex) {
- LOG.log(Level.FINE, "malformed url for hyperlink", ex);
- }
- }
- else if (text != null) {
- Tuple tup = findProperty(text, tokenOff, offset);
- if (tup != null) {
- String prop = tup.value.substring("${".length(), tup.value.length() - 1); //remove the brackets//NOI18N
- NbMavenProject nbprj = getNbMavenProject(doc);
- if (nbprj != null) {
- if (prop != null && (prop.startsWith("project.") || prop.startsWith("pom."))) {//NOI18N
- String val = prop.substring(prop.indexOf('.') + 1, prop.length());//NOI18N
- //TODO eventually we want to process everything through an evaluation engine..
- InputLocation iloc = nbprj.getMavenProject().getModel().getLocation(val);
- if (iloc != null) {
- ModelUtils.openAtSource(iloc);
- return;
- }
- }
- InputLocation propLoc = nbprj.getMavenProject().getModel().getLocation("properties");
- if (propLoc != null) { //#212984
- InputLocation location = propLoc.getLocation(prop);
- if (location != null) {
- ModelUtils.openAtSource(location);
- }
- }
- }
- }
- }
- }
+ hyperLinkInfo.performClickAction();
}
-
+
@Override
public Set<HyperlinkType> getSupportedHyperlinkTypes() {
return Collections.singleton(HyperlinkType.GO_TO_DECLARATION);
}
-
@Override
@Messages({
"# {0} - property name",
- "# {1} - resolved value",
- "Hint_prop_resolution={0} resolves to ''{1}''\nNavigate to definition.",
+ "# {1} - resolved value",
+ "Hint_prop_resolution={0} resolves to ''{1}''\nNavigate to definition.",
"Hint_prop_cannot=Cannot resolve expression\nNavigates to definition."})
public String getTooltipText(final Document doc, final int offset, HyperlinkType type) {
+ final PomHyperlinkInfo hyperLinkInfo = new PomHyperlinkInfo(doc, offset);
+ doc.render(new PomParserRunnable(hyperLinkInfo, doc, offset));
+ String[] tooltip = hyperLinkInfo.getTooltipText();
- final boolean[] isText = new boolean[1];
- final int[] ftokenOff = new int[1];
- final String[] ftext = new String[1];
-
- doc.render(new Runnable() {
-
- @Override
- public void run() {
- isText[0] = false;
- TokenHierarchy th = TokenHierarchy.get(doc);
- TokenSequence<XMLTokenId> xml = th.tokenSequence(XMLTokenId.language());
- xml.move(offset);
- xml.moveNext();
- Token<XMLTokenId> token = xml.token();
-
- // when it's not a value -> do nothing.
- if (token == null) {
-
- return;
- }
- if (token.id() == XMLTokenId.TEXT) {
- isText[0] = true;
- ftokenOff[0] = xml.offset();
- ftext[0] = token.text().toString();
- }
- }
- });
-
- if (isText[0]) {
- //we are in element text
- String text = ftext[0];
- int tokenOff = ftokenOff[0];
- Tuple tup = findProperty(text, tokenOff, offset);
-
- if (tup != null) {
- String prop = tup.value.substring("${".length(), tup.value.length() - 1); //remove the brackets
- try {
- Project nbprj = getProject(doc);
- if (nbprj != null) {
- Object exRes = PluginPropertyUtils.createEvaluator(nbprj).evaluate(tup.value);
- if (exRes != null) {
- return Hint_prop_resolution(prop, exRes);
- } else {
- }
- } else {
- //pom file in repository or settings file.
- }
- } catch (ExpressionEvaluationException ex) {
- return Hint_prop_cannot();
- }
- }
+ if (tooltip == null) {
+ return Hint_prop_cannot();
+ } else if (tooltip.length == 2) {
+ return Hint_prop_resolution(tooltip[0], tooltip[1]);
+ } else {
+ return tooltip[0];
}
- return null;
}
-
+
public static void openAtSource(InputLocation location) {
InputSource source = location.getSource();
if (source != null && source.getLocation() != null) {
@@ -381,19 +145,20 @@ public class HyperlinkProviderImpl implements HyperlinkProviderExt {
}
}
}
-
+
private static class Tuple {
+
final int spanStart;
final int spanEnd;
final String value;
+
public Tuple(String val, int start, int end) {
this.value = val;
this.spanStart = start;
- this.spanEnd = end;
+ this.spanEnd = end;
}
- }
-
-
+ }
+
private Tuple findProperty(String textToken, int tokenOffset, int currentOffset) {
if (textToken == null) {
return null;
@@ -410,15 +175,15 @@ public class HyperlinkProviderImpl implements HyperlinkProviderExt {
if (bo > bc && ac > -1 && (ac < ao || ao == -1)) { //case where currentOffset is on property
return new Tuple(textToken.substring(bo, before.length() + ac + 1), tokenOffset + bo, tokenOffset + ff + ac + 1);
}
-
+
if (before.length() == 0 && ao == 0 && ac > 0) { //case where currentOffset is at beginning
- return new Tuple(textToken.substring(0, ac + 1), tokenOffset, tokenOffset + ac + 1);
+ return new Tuple(textToken.substring(0, ac + 1), tokenOffset, tokenOffset + ac + 1);
}
-
+
}
return null;
}
-
+
private FileObject getProjectDir(Document doc) {
DataObject dObject = NbEditorUtilities.getDataObject(doc);
if (dObject != null) {
@@ -426,7 +191,7 @@ public class HyperlinkProviderImpl implements HyperlinkProviderExt {
}
return null;
}
-
+
private NbMavenProject getNbMavenProject(Document doc) {
Project prj = getProject(doc);
if (prj != null) {
@@ -442,6 +207,7 @@ public class HyperlinkProviderImpl implements HyperlinkProviderExt {
}
return null;
}
+
private FileObject getPath(FileObject parent, String path) {
// TODO more substitutions necessary probably..
if (path.startsWith("${basedir}/")) { //NOI18N
@@ -454,4 +220,346 @@ public class HyperlinkProviderImpl implements HyperlinkProviderExt {
return parent.getFileObject(path);
}
+ private class PomParserRunnable implements Runnable {
+
+ private final PomHyperlinkInfo hyperLinkInfo;
+ private final Document document;
+ private final int offset;
+
+ public PomParserRunnable(PomHyperlinkInfo hyperLinkInfo, Document document, int offset) {
+ this.hyperLinkInfo = hyperLinkInfo;
+ this.document = document;
+ this.offset = offset;
+ }
+
+ @Override
+ public void run() {
+ TokenHierarchy th = TokenHierarchy.get(document);
+ TokenSequence<XMLTokenId> xml = th.tokenSequence(XMLTokenId.language());
+ xml.move(offset);
+ xml.moveNext();
+ Token<XMLTokenId> token = xml.token();
+
+ // when it's not a value -> do nothing.
+ if (token == null) {
+ return;
+ }
+
+ if (token.id() == XMLTokenId.TEXT) {
+ hyperLinkInfo.calculateInfo(token, xml);
+ }
+ }
+ }
+
+ private class PomHyperlinkInfo {
+
+ final Document doc;
+ final int documentOffset;
+ final FileObject projectFileObject;
+ boolean isText;
+ int ftokenOff;
+ String ftext;
+
+ String artifactId;
+ String groupId;
+ String version;
+ String type;
+
+ public PomHyperlinkInfo(Document doc, int documentOffset) {
+ this.doc = doc;
+ this.documentOffset = documentOffset;
+ this.projectFileObject = getProjectDir(doc);
+ }
+
+ boolean isHyperlinkUrl() {
+ return ftext != null
+ && (ftext.startsWith("http://")
+ || //NOI18N
+ ftext.startsWith("https://")); //NOI18N;
+ }
+
+ private FileObject getFileSystemLinkObject() {
+ FileObject fo = getProjectDir(doc);
+ if (fo != null && ftext != null) {
+ return getPath(fo, ftext) ;
+ }
+ return null;
+ }
+
+ boolean isMavenProperty() {
+ if (ftext != null) {
+ int ff = documentOffset - ftokenOff;
+ if (ff > -1 && ff < ftext.length()) {
+ String before = ftext.substring(0, ff);
+ String after = ftext.substring(ff, ftext.length());
+ int bo = before.lastIndexOf("${");//NOI18N
+ int bc = before.lastIndexOf("}");//NOI18N
+ int ao = after.indexOf("${");//NOI18N
+ int ac = after.indexOf("}");//NOI18N
+ if (bo > bc && ac > -1 && (ac < ao || ao == -1)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ boolean isMavenDependency() {
+ return artifactId != null && groupId != null && version != null;
+ }
+
+ boolean isHyperlinkPoint() {
+ return (isHyperlinkUrl() || getFileSystemLinkObject() != null ||
+ isMavenProperty() || (isMavenDependency() && getMavenArtifactAbsolutePomPath() != null));
+ }
+
+ private void calculateInfo(Token<XMLTokenId> token, TokenSequence<XMLTokenId> xml) {
+ isText = token.id() == XMLTokenId.TEXT;
+ if (isText) {
+ ftokenOff = xml.offset();
+ ftext = token.text().toString();
+
+ if (projectFileObject != null && getPath(projectFileObject, ftext) != null) {
+ xml.movePrevious();
+ token = xml.token();
+ if (token != null && token.id().equals(XMLTokenId.TAG) && TokenUtilities.equals(token.text(), ">")) {//NOI18N
+ xml.movePrevious();
+ token = xml.token();
+ if (token != null && token.id().equals(XMLTokenId.TAG)) {
+ if (TokenUtilities.equals(token.text(), "<module")) {//NOI18N
+ if (!ftext.endsWith("/pom.xml")) {
+ ftext += "/pom.xml"; //NOI18N
+ }
+ }
+ }
+ }
+ } else {
+ xml.movePrevious();
+ token = xml.token();
+ if (token != null && token.id().equals(XMLTokenId.TAG) && TokenUtilities.equals(token.text(), ">")) { //NOI18N
+ xml.movePrevious();
+ String tokenString = xml.token().text().toString();
+ if ("<artifactId".equals(tokenString) || //NOI18N
+ "<groupId".equals(tokenString) || //NOI18N
+ "<type".equals(tokenString) || //NOI18N
+ ("<version".equals(tokenString) && !ftext.startsWith("${"))) {
+
+ resetSequenceToDependencytagToken(xml);
+
+ if (TokenUtilities.equals(xml.token().text(), "<dependency")) { //NOI18N
+
+ while (!TokenUtilities.equals(xml.token().text(), "</dependency")) { //NOI18N
+
+ switch (xml.token().text().toString()) {
+ case "<artifactId":
+ moveToXmlTokenById(xml, XMLTokenId.TEXT);
+ token = xml.token();
+ artifactId = token.text().toString();
+ break;
+ case "<groupId":
+ moveToXmlTokenById(xml, XMLTokenId.TEXT);
+ token = xml.token();
+ groupId = token.text().toString();
+ break;
+ case "<version":
+ moveToXmlTokenById(xml, XMLTokenId.TEXT);
+ token = xml.token();
+ if (TokenUtilities.startsWith(token.text(), "${")) { //NOI18N
+ Project nbprj = getProject(doc);
+ if (nbprj != null) {
+ try {
+ version = (String) PluginPropertyUtils.createEvaluator(nbprj).evaluate(token.text().toString());
+ } catch (ExpressionEvaluationException eee) {
+ LOG.log(Level.INFO, "Unable to evaluate property: " + token.text().toString(), eee);
+ }
+ }
+ } else {
+ version = token.text().toString();
+ }
+ break;
+ case "<type" :
+ moveToXmlTokenById(xml, XMLTokenId.TEXT);
+ token = xml.token();
+ type = token.text().toString();
+ break;
+ }
+ xml.moveNext();
+ moveToXmlTokenById(xml, XMLTokenId.TAG);
+ }
+ // handle cases where the version element is covered in a
+ // parent pom/dependenciesManagement
+ if (version == null) {
+ NbMavenProject projectForDocument = getNbMavenProject(doc);
+ if (projectForDocument != null) {
+ MavenProject mavenProject = projectForDocument.getMavenProject();
+ for (Artifact artifact : mavenProject.getArtifacts()) {
+ if (artifact.getGroupId().equals(groupId)
+ && artifact.getArtifactId().equals(artifactId)) {
+ version = artifact.getVersion();
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ String[] getTooltipText() {
+ if (isText) {
+ //we are in element text
+ String text = ftext;
+ int tokenOff = ftokenOff;
+ if (isMavenProperty()) {
+ Tuple tup = findProperty(text, tokenOff, documentOffset);
+
+ if (tup != null) {
+ String prop = tup.value.substring("${".length(), tup.value.length() - 1); //remove the brackets
+ try {
+ Project nbprj = getProject(doc);
+ if (nbprj != null) {
+ Object exRes = PluginPropertyUtils.createEvaluator(nbprj).evaluate(tup.value);
+ if (exRes != null) {
+ return new String[]{prop, (String) exRes};
+ }
+ } else {
+ //pom file in repository or settings file.
+ }
+ } catch (ExpressionEvaluationException ex) {
+ return null;
+ }
+ }
+ } else if (isMavenDependency()) {
+ return new String[]{getMavenArtifactAbsolutePomPath()};
+ }
+ }
+ return null;
+ }
+
+ String getMavenArtifactAbsolutePomPath() {
+ if (!isMavenDependency()) {
+ return null;
+ } else {
+ MavenEmbedder embedder = EmbedderFactory.getProjectEmbedder();
+ Artifact mavenArtifact = embedder.createArtifact(groupId, artifactId, version, type == null ? "jar" : type);
+ String mavenPomPath = embedder.getLocalRepository().find(mavenArtifact).getFile().getAbsolutePath().replace(".jar", ".pom");
+ if (mavenPomPath == null) {
+ return null;
+ }
+ return new File(mavenPomPath).exists() ? mavenPomPath : null;
+ }
+ }
+
+ private int[] getHyperLinkSpan() {
+ if (isText) {
+ //we are in element text
+ FileObject fo = getProjectDir(doc);
+ if (fo != null && getPath(fo, ftext) != null) {
+ return new int[]{ftokenOff, ftokenOff + ftext.length()};
+ }
+ // urls get opened..
+ if (isHyperlinkUrl()) {
+ return new int[]{ftokenOff, ftokenOff + ftext.length()};
+ }
+ if (ftext != null) {
+ Tuple prop = findProperty(ftext, ftokenOff, documentOffset);
+ if (prop != null) {
+ return new int[]{prop.spanStart, prop.spanEnd};
+ }
+ }
+ if (isMavenDependency()) {
+ return new int[]{ftokenOff, ftokenOff + ftext.length()};
+ }
+ }
+ return null;
+ }
+
+ private void resetSequenceToDependencytagToken(TokenSequence<XMLTokenId> xml) {
+ while (!TokenUtilities.equals("<dependency", xml.token().text()) //NOI18N
+ && !TokenUtilities.equals("<plugin", xml.token().text()) //NOI18N
+ && !TokenUtilities.equals("<parent", xml.token().text()) //NOI18N
+ && !TokenUtilities.equals("<exclusion", xml.token().text()) //NOI18N
+ && !TokenUtilities.equals("<project", xml.token().text())) { //NOI18N
+ xml.movePrevious();
+ }
+ }
+
+ private void performClickAction() {
+ if (isText) {
+ //we are in element text
+ int tokenOff = ftokenOff;
+ String text = ftext;
+ FileObject fileSystemLinkObject = getFileSystemLinkObject();
+ if (fileSystemLinkObject != null) {
+ NodeUtils.openPomFile(fileSystemLinkObject);
+ } else if (isHyperlinkUrl()) {
+ // urls get opened..
+ try {
+ String urlText = text;
+ if (urlText.contains("${")) {//NOI18N
+ //special case, need to evaluate expression
+ Project nbprj = getProject(doc);
+ if (nbprj != null) {
+ Object exRes;
+ try {
+ exRes = PluginPropertyUtils.createEvaluator(nbprj).evaluate(urlText);
+ if (exRes != null) {
+ urlText = exRes.toString();
+ }
+ } catch (ExpressionEvaluationException ex) {
+ //just ignore
+ LOG.log(Level.FINE, "Expression evaluation failed", ex);
+ }
+
+ }
+ }
+ URL url = new URL(urlText);
+ HtmlBrowser.URLDisplayer.getDefault().showURL(url);
+ } catch (MalformedURLException ex) {
+ LOG.log(Level.FINE, "malformed url for hyperlink", ex);
+ }
+ } else if (isMavenProperty()) {
+ Tuple tup = findProperty(text, tokenOff, documentOffset);
+ if (tup != null) {
+ String prop = tup.value.substring(2, tup.value.length() - 1);
+ NbMavenProject nbprj = getNbMavenProject(doc);
+ if (nbprj != null) {
+ if (prop != null && (prop.startsWith("project.") || prop.startsWith("pom."))) {//NOI18N
+ String val = prop.substring(prop.indexOf('.') + 1, prop.length());//NOI18N
+ //TODO eventually we want to process everything through an evaluation engine..
+ InputLocation iloc = nbprj.getMavenProject().getModel().getLocation(val);
+ if (iloc != null) {
+ ModelUtils.openAtSource(iloc);
+ return;
+ }
+ }
+ InputLocation propLoc = nbprj.getMavenProject().getModel().getLocation("properties");
+ if (propLoc != null) { //#212984
+ InputLocation location = propLoc.getLocation(prop);
+ if (location != null) {
+ ModelUtils.openAtSource(location);
+ }
+ }
+ }
+ }
+ } else if (isMavenDependency()) {
+ File pomFile = new File(getMavenArtifactAbsolutePomPath());
+ FileObject fileToOpen = FileUtil.toFileObject(pomFile);
+ if (fileToOpen != null) {
+ NodeUtils.openPomFile(fileToOpen);
+ }
+ }
+ }
+ }
+
+ private void moveToXmlTokenById(TokenSequence<XMLTokenId> xml, XMLTokenId tokenId) {
+ while (xml.token() != null && !xml.token().id().equals(tokenId)) {
+ xml.moveNext();
+ }
+ }
+
+ }
}
diff --git a/maven.grammar/test/unit/data/test_projects/hyperlinks/pom.xml b/maven.grammar/test/unit/data/test_projects/hyperlinks/pom.xml
new file mode 100644
index 0000000..bf4ffd8
--- /dev/null
+++ b/maven.grammar/test/unit/data/test_projects/hyperlinks/pom.xml
@@ -0,0 +1,48 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.netbeans</groupId>
+ <artifactId>hyperlinks</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <properties>
+ <mockito.version>1.10.9</mockito.version>
+ </properties>
+ <repositories>
+ <repository>
+ <id>central</id>
+ <name>Central Repository</name>
+ <url>http://repo.maven.apache.org/maven2</url>
+ <layout>default</layout>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>${mockito.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <compilerArgs>
+ <arg>-parameters</arg>
+ </compilerArgs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/maven.grammar/test/unit/data/test_projects/hyperlinks2/pom.xml b/maven.grammar/test/unit/data/test_projects/hyperlinks2/pom.xml
new file mode 100644
index 0000000..6e56bc8
--- /dev/null
+++ b/maven.grammar/test/unit/data/test_projects/hyperlinks2/pom.xml
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.netbeans</groupId>
+ <artifactId>hyperlinks2</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <modules>
+ <module>subModule</module>
+ </modules>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.7</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+</project>
\ No newline at end of file
diff --git a/maven.grammar/test/unit/data/test_projects/hyperlinks2/subModule/pom.xml b/maven.grammar/test/unit/data/test_projects/hyperlinks2/subModule/pom.xml
new file mode 100644
index 0000000..1f9350d
--- /dev/null
+++ b/maven.grammar/test/unit/data/test_projects/hyperlinks2/subModule/pom.xml
@@ -0,0 +1,16 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.netbeans</groupId>
+ <artifactId>hyperlinks2</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>subModule</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
diff --git a/maven.grammar/test/unit/src/org/netbeans/modules/maven/hyperlinks/HyperlinkProviderImplTestForMultiPomProjects.java b/maven.grammar/test/unit/src/org/netbeans/modules/maven/hyperlinks/HyperlinkProviderImplTestForMultiPomProjects.java
new file mode 100644
index 0000000..9916ec5
--- /dev/null
+++ b/maven.grammar/test/unit/src/org/netbeans/modules/maven/hyperlinks/HyperlinkProviderImplTestForMultiPomProjects.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.maven.hyperlinks;
+
+import java.io.File;
+import java.io.IOException;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.netbeans.api.lexer.Language;
+import org.netbeans.api.xml.lexer.XMLTokenId;
+import org.netbeans.junit.NbTestCase;
+import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType;
+import org.netbeans.modules.maven.grammar.POMDataObject;
+import org.openide.cookies.EditorCookie;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.LocalFileSystem;
+import org.openide.loaders.DataObject;
+
+/**
+ * Additional Unit tests for the HyperlinkProvider for pom.xml files when used in a
+ * hierarchy of maven projects.
+ */
+public class HyperlinkProviderImplTestForMultiPomProjects extends NbTestCase {
+
+ private static final int START_DEPENDENCY_GROUP_ID_VALUE = 538;
+ private static final int MIDDLE_DEPENDENCY_GROUP_ID_VALUE = 547;
+ private static final int END_DEPENDENCY_GROUP_ID_VALUE = 555;
+
+ private static final int START_DEPENDENCY_ARTIFACT_ID_VALUE = 591;
+ private static final int MIDDLE_DEPENDENCY_ARTIFACT_ID_VALUE = 599;
+ private static final int END_DEPENDENCY_ARTIFACT_ID_VALUE = 603;
+
+ private Document testDocument;
+ private HyperlinkProviderImpl classUnderTest;
+
+ static {
+ System.setProperty("org.openide.windows.DummyWindowManager.VISIBLE", "false");
+ }
+
+ public HyperlinkProviderImplTestForMultiPomProjects(String n) {
+ super(n);
+ }
+
+ @BeforeClass
+ @Override
+ public void setUp() {
+ classUnderTest = new HyperlinkProviderImpl();
+ }
+
+ @AfterClass
+ @Override
+ public void tearDown() throws IOException {
+ classUnderTest = null;
+ }
+
+ private Document generateTestPomDocument() throws BadLocationException, Exception {
+ if (testDocument == null) {
+ POMDataObject docDataObject = getTestMavenProjectPom();
+ EditorCookie cookie = docDataObject.getLookup().lookup(EditorCookie.class);
+
+ testDocument = cookie.openDocument();
+ testDocument.putProperty(Language.class, XMLTokenId.language());
+ }
+
+ return testDocument;
+ }
+
+ public void testHyperlinkPointMatchesMavenDependencyWhenNoVersionIsDefined() throws BadLocationException, Exception {
+ Document doc = generateTestPomDocument();
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, START_DEPENDENCY_GROUP_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, START_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, MIDDLE_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, END_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, END_DEPENDENCY_GROUP_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, START_DEPENDENCY_ARTIFACT_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, START_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, MIDDLE_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, END_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, END_DEPENDENCY_ARTIFACT_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+ }
+
+ public void testHyperlinkSpanForMavenDependencyWhenNoVersionIsDefined() throws BadLocationException, Exception {
+ Document doc = generateTestPomDocument();
+ int[] hyperlinkSpan1 = classUnderTest.getHyperlinkSpan(doc, START_DEPENDENCY_GROUP_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION);
+ assertNull(hyperlinkSpan1);
+
+ int[] hyperlinkSpan2 = classUnderTest.getHyperlinkSpan(doc, START_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_DEPENDENCY_GROUP_ID_VALUE, hyperlinkSpan2[0]);
+ assertEquals(END_DEPENDENCY_GROUP_ID_VALUE + 1, hyperlinkSpan2[1]);
+
+ int[] hyperlinkSpan3 = classUnderTest.getHyperlinkSpan(doc, MIDDLE_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_DEPENDENCY_GROUP_ID_VALUE, hyperlinkSpan3[0]);
+ assertEquals(END_DEPENDENCY_GROUP_ID_VALUE + 1, hyperlinkSpan3[1]);
+
+ int[] hyperlinkSpan4 = classUnderTest.getHyperlinkSpan(doc, END_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_DEPENDENCY_GROUP_ID_VALUE, hyperlinkSpan4[0]);
+ assertEquals(END_DEPENDENCY_GROUP_ID_VALUE + 1, hyperlinkSpan4[1]);
+
+ int[] hyperlinkSpan5 = classUnderTest.getHyperlinkSpan(doc, END_DEPENDENCY_GROUP_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION);
+ assertNull(hyperlinkSpan5);
+
+ int[] hyperlinkSpan6 = classUnderTest.getHyperlinkSpan(doc, START_DEPENDENCY_ARTIFACT_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION);
+ assertNull(hyperlinkSpan6);
+
+ int[] hyperlinkSpan7 = classUnderTest.getHyperlinkSpan(doc, START_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_DEPENDENCY_ARTIFACT_ID_VALUE, hyperlinkSpan7[0]);
+ assertEquals(END_DEPENDENCY_ARTIFACT_ID_VALUE + 1, hyperlinkSpan7[1]);
+
+ int[] hyperlinkSpan8 = classUnderTest.getHyperlinkSpan(doc, MIDDLE_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_DEPENDENCY_ARTIFACT_ID_VALUE, hyperlinkSpan8[0]);
+ assertEquals(END_DEPENDENCY_ARTIFACT_ID_VALUE + 1, hyperlinkSpan8[1]);
+
+ int[] hyperlinkSpan9 = classUnderTest.getHyperlinkSpan(doc, END_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_DEPENDENCY_ARTIFACT_ID_VALUE, hyperlinkSpan9[0]);
+ assertEquals(END_DEPENDENCY_ARTIFACT_ID_VALUE + 1, hyperlinkSpan9[1]);
+
+ int[] hyperlinkSpan10 = classUnderTest.getHyperlinkSpan(doc, END_DEPENDENCY_ARTIFACT_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION);
+ assertNull(hyperlinkSpan10);
+ }
+
+ public void testTooltipTextMatchesMavenDependencyWhenNoVersionIsDefined() throws BadLocationException, Exception {
+ Document doc = generateTestPomDocument();
+ assertEquals("Cannot resolve expression\nNavigates to definition.", classUnderTest.getTooltipText(doc, START_DEPENDENCY_GROUP_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertTrue(classUnderTest.getTooltipText(doc, START_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertTrue(classUnderTest.getTooltipText(doc, MIDDLE_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertTrue(classUnderTest.getTooltipText(doc, END_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertEquals("Cannot resolve expression\nNavigates to definition.", classUnderTest.getTooltipText(doc, END_DEPENDENCY_GROUP_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+
+ assertEquals("Cannot resolve expression\nNavigates to definition.", classUnderTest.getTooltipText(doc, START_DEPENDENCY_ARTIFACT_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertTrue(classUnderTest.getTooltipText(doc, START_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertTrue(classUnderTest.getTooltipText(doc, MIDDLE_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertTrue(classUnderTest.getTooltipText(doc, END_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertEquals("Cannot resolve expression\nNavigates to definition.", classUnderTest.getTooltipText(doc, END_DEPENDENCY_ARTIFACT_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+ }
+
+ private POMDataObject getTestMavenProjectPom() throws Exception {
+ LocalFileSystem lfs = new LocalFileSystem();
+ lfs.setRootDirectory(new File(getDataDir(),"test_projects"));
+ FileObject pom = lfs.findResource("hyperlinks2/subModule/pom.xml");
+ return (POMDataObject) DataObject.find(pom);
+ }
+}
diff --git a/maven.grammar/test/unit/src/org/netbeans/modules/maven/hyperlinks/HyperlinkProviderImplTestForSinglePomProjects.java b/maven.grammar/test/unit/src/org/netbeans/modules/maven/hyperlinks/HyperlinkProviderImplTestForSinglePomProjects.java
new file mode 100644
index 0000000..eceda15
--- /dev/null
+++ b/maven.grammar/test/unit/src/org/netbeans/modules/maven/hyperlinks/HyperlinkProviderImplTestForSinglePomProjects.java
@@ -0,0 +1,285 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.maven.hyperlinks;
+
+import java.io.File;
+import java.io.IOException;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.netbeans.api.lexer.Language;
+import org.netbeans.api.xml.lexer.XMLTokenId;
+import org.netbeans.junit.NbTestCase;
+import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType;
+import org.netbeans.modules.maven.grammar.POMDataObject;
+import org.openide.cookies.EditorCookie;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.LocalFileSystem;
+import org.openide.loaders.DataObject;
+
+/**
+ * Unit tests for the HyperlinkProvider for pom.xml within a single project.
+ */
+public class HyperlinkProviderImplTestForSinglePomProjects extends NbTestCase {
+
+ /* Maven Repository URL */
+ private static final int START_URL_VALUE = 577;
+ private static final int MIDDLE_URL_VALUE = 595;
+ private static final int END_URL_VALUE = 611;
+
+ /* dependency - org.apache.commons:commons-lang3:3.7 */
+ private static final int START_DEPENDENCY_GROUP_ID_VALUE = 849;
+ private static final int MIDDLE_DEPENDENCY_GROUP_ID_VALUE = 857;
+ private static final int END_DEPENDENCY_GROUP_ID_VALUE = 866;
+
+ private static final int START_DEPENDENCY_ARTIFACT_ID_VALUE = 902;
+ private static final int MIDDLE_DEPENDENCY_ARTIFACT_ID_VALUE = 909;
+ private static final int END_DEPENDENCY_ARTIFACT_ID_VALUE = 914;
+
+ private static final int START_DEPENDENCY_VERSION_ID_VALUE = 950;
+ private static final int MIDDLE_DEPENDENCY_VERSION_ID_VALUE = 951;
+ private static final int END_DEPENDENCY_VERSION_ID_VALUE = 952;
+
+ /* dependency - org.mockito:mockito-core:1.10.9 - uses property for version: mockito.version*/
+ private static final int START_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE = 1028;
+ private static final int MIDDLE_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE = 1034;
+ private static final int END_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE = 1038;
+
+ private static final int START_VERSION_PROPERTY_DEPENDENCY_ARTIFACT_ID_VALUE = 1074;
+ private static final int MIDDLE_VERSION_PROPERTY_DEPENDENCY_ARTIFACT_ID_VALUE = 1079;
+ private static final int END_VERSION_PROPERTY_DEPENDENCY_ARTIFACT_ID_VALUE = 1085;
+
+ private static final int START_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE = 1123;
+ private static final int MIDDLE_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE = 1131;
+ private static final int END_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE = 1138;
+
+ /* plugin - maven-compiler-plugin:org.apache.maven.plugins:3.1 */
+ private static final int START_PLUGIN_ARTIFACT_ID_VALUE = 1271;
+ private static final int MIDDLE_PLUGIN_ARTIFACT_ID_VALUE = 1281;
+ private static final int END_PLUGIN_ARTIFACT_ID_VALUE = 1292;
+
+ private static final int START_PLUGIN_GROUP_ID_VALUE = 1331;
+ private static final int MIDDLE_PLUGIN_GROUP_ID_VALUE = 1342;
+ private static final int END_PLUGIN_GROUP_ID_VALUE = 1366;
+
+ private Document testDocument;
+ private HyperlinkProviderImpl classUnderTest;
+
+ static {
+ System.setProperty("org.openide.windows.DummyWindowManager.VISIBLE", "false");
+ }
+
+ public HyperlinkProviderImplTestForSinglePomProjects(String n) {
+ super(n);
+ }
+
+ @BeforeClass
+ @Override
+ public void setUp() {
+ classUnderTest = new HyperlinkProviderImpl();
+ }
+
+ @AfterClass
+ @Override
+ public void tearDown() throws IOException {
+ classUnderTest = null;
+ }
+
+ private Document generateTestPomDocument() throws BadLocationException, Exception {
+ if (testDocument == null) {
+ POMDataObject docDataObject = getTestMavenProjectPom();
+ EditorCookie cookie = docDataObject.getLookup().lookup(EditorCookie.class);
+
+ testDocument = cookie.openDocument();
+ testDocument.putProperty(Language.class, XMLTokenId.language());
+ }
+
+ return testDocument;
+ }
+
+ public void testHyperlinkPointMatchesUsedMavenProperty() throws BadLocationException, Exception {
+ Document doc = generateTestPomDocument();
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, START_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, START_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, MIDDLE_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, END_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, END_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+ }
+
+ public void testHyperlinkPointMatchesUrl() throws BadLocationException, Exception {
+ Document doc = generateTestPomDocument();
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, START_URL_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, START_URL_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, MIDDLE_URL_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, END_URL_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, END_URL_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+ }
+
+ public void testHyperlinkPointMatchesMavenDependency() throws BadLocationException, Exception {
+ Document doc = generateTestPomDocument();
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, START_DEPENDENCY_GROUP_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, START_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, MIDDLE_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, END_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, END_DEPENDENCY_GROUP_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, START_DEPENDENCY_ARTIFACT_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, START_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, MIDDLE_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, END_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, END_DEPENDENCY_ARTIFACT_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, START_DEPENDENCY_VERSION_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, START_DEPENDENCY_VERSION_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, MIDDLE_DEPENDENCY_VERSION_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, END_DEPENDENCY_VERSION_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, END_DEPENDENCY_VERSION_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+ }
+
+ public void testHyperlinkPointDoesntMatchMavenPlugin() throws BadLocationException, Exception {
+ Document doc = generateTestPomDocument();
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, START_PLUGIN_ARTIFACT_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, START_PLUGIN_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, MIDDLE_PLUGIN_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, END_PLUGIN_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, END_PLUGIN_ARTIFACT_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, START_PLUGIN_GROUP_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, START_PLUGIN_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, MIDDLE_PLUGIN_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, END_PLUGIN_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, END_PLUGIN_GROUP_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+ }
+
+ public void testHyperlinkPointMatchesMavenDependencyWhenDependencyUsesVersionProperty() throws BadLocationException, Exception {
+ Document doc = generateTestPomDocument();
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, START_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, START_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, MIDDLE_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, END_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, END_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, START_VERSION_PROPERTY_DEPENDENCY_ARTIFACT_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, START_VERSION_PROPERTY_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, MIDDLE_VERSION_PROPERTY_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(true, classUnderTest.isHyperlinkPoint(doc, END_VERSION_PROPERTY_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals(false, classUnderTest.isHyperlinkPoint(doc, END_VERSION_PROPERTY_DEPENDENCY_ARTIFACT_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+ }
+
+ public void testHyperlinkSpanForMavenProperty() throws BadLocationException, Exception {
+ Document doc = generateTestPomDocument();
+ int[] hyperlinkSpan1 = classUnderTest.getHyperlinkSpan(doc, START_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE - 1, HyperlinkType.GO_TO_DECLARATION);
+ assertNull(hyperlinkSpan1);
+
+ int[] hyperlinkSpan2 = classUnderTest.getHyperlinkSpan(doc, START_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE - 2, hyperlinkSpan2[0]);
+ assertEquals(END_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE + 1, hyperlinkSpan2[1]);
+
+ int[] hyperlinkSpan3 = classUnderTest.getHyperlinkSpan(doc, MIDDLE_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE - 2, hyperlinkSpan3[0]);
+ assertEquals(END_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE + 1, hyperlinkSpan3[1]);
+
+ int[] hyperlinkSpan4 = classUnderTest.getHyperlinkSpan(doc, END_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE - 2, hyperlinkSpan4[0]);
+ assertEquals(END_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE + 1, hyperlinkSpan4[1]);
+
+ int[] hyperlinkSpan5 = classUnderTest.getHyperlinkSpan(doc, END_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE + 1, HyperlinkType.GO_TO_DECLARATION);
+ assertNull(hyperlinkSpan5);
+ }
+
+ public void testHyperlinkSpanForUrl() throws BadLocationException, Exception {
+ Document doc = generateTestPomDocument();
+ int[] hyperlinkSpan1 = classUnderTest.getHyperlinkSpan(doc, START_URL_VALUE - 1, HyperlinkType.GO_TO_DECLARATION);
+ assertNull(hyperlinkSpan1);
+
+ int[] hyperlinkSpan2 = classUnderTest.getHyperlinkSpan(doc, START_URL_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_URL_VALUE, hyperlinkSpan2[0]);
+ assertEquals(END_URL_VALUE + 1, hyperlinkSpan2[1]);
+
+ int[] hyperlinkSpan3 = classUnderTest.getHyperlinkSpan(doc, MIDDLE_URL_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_URL_VALUE, hyperlinkSpan3[0]);
+ assertEquals(END_URL_VALUE + 1, hyperlinkSpan3[1]);
+
+ int[] hyperlinkSpan4 = classUnderTest.getHyperlinkSpan(doc, END_URL_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_URL_VALUE, hyperlinkSpan4[0]);
+ assertEquals(END_URL_VALUE + 1, hyperlinkSpan4[1]);
+
+ int[] hyperlinkSpan5 = classUnderTest.getHyperlinkSpan(doc, END_URL_VALUE + 1, HyperlinkType.GO_TO_DECLARATION);
+ assertNull(hyperlinkSpan5);
+ }
+
+ public void testHyperlinkSpanForMavenDependency() throws BadLocationException, Exception {
+ Document doc = generateTestPomDocument();
+ int[] hyperlinkSpan1 = classUnderTest.getHyperlinkSpan(doc, START_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION);
+ assertNull(hyperlinkSpan1);
+
+ int[] hyperlinkSpan2 = classUnderTest.getHyperlinkSpan(doc, START_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE, hyperlinkSpan2[0]);
+ assertEquals(END_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE + 1, hyperlinkSpan2[1]);
+
+ int[] hyperlinkSpan3 = classUnderTest.getHyperlinkSpan(doc, MIDDLE_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE, hyperlinkSpan3[0]);
+ assertEquals(END_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE + 1, hyperlinkSpan3[1]);
+
+ int[] hyperlinkSpan4 = classUnderTest.getHyperlinkSpan(doc, END_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION);
+ assertEquals(START_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE, hyperlinkSpan4[0]);
+ assertEquals(END_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE + 1, hyperlinkSpan4[1]);
+
+ int[] hyperlinkSpan5 = classUnderTest.getHyperlinkSpan(doc, END_VERSION_PROPERTY_DEPENDENCY_GROUP_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION);
+ assertNull(hyperlinkSpan5);
+ }
+
+ public void testTooltipTextMatchesUsedMavenProperty() throws BadLocationException, Exception {
+ Document doc = generateTestPomDocument();
+ assertEquals("Cannot resolve expression\nNavigates to definition.", classUnderTest.getTooltipText(doc, START_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals("mockito.version resolves to \'1.10.9\'\nNavigate to definition.", classUnderTest.getTooltipText(doc, START_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals("mockito.version resolves to \'1.10.9\'\nNavigate to definition.", classUnderTest.getTooltipText(doc, MIDDLE_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals("mockito.version resolves to \'1.10.9\'\nNavigate to definition.", classUnderTest.getTooltipText(doc, END_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE, HyperlinkType.GO_TO_DECLARATION));
+ assertEquals("Cannot resolve expression\nNavigates to definition.", classUnderTest.getTooltipText(doc, END_VERSION_PROPERTY_DEPENDENCY_VERSION_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+ }
+
+ public void testTooltipTextMatchesMavenDependency() throws BadLocationException, Exception {
+ Document doc = generateTestPomDocument();
+ assertEquals("Cannot resolve expression\nNavigates to definition.", classUnderTest.getTooltipText(doc, START_DEPENDENCY_GROUP_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertTrue(classUnderTest.getTooltipText(doc, START_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertTrue(classUnderTest.getTooltipText(doc, MIDDLE_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertTrue(classUnderTest.getTooltipText(doc, END_DEPENDENCY_GROUP_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertEquals("Cannot resolve expression\nNavigates to definition.", classUnderTest.getTooltipText(doc, END_DEPENDENCY_GROUP_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+
+ assertEquals("Cannot resolve expression\nNavigates to definition.", classUnderTest.getTooltipText(doc, START_DEPENDENCY_ARTIFACT_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertTrue(classUnderTest.getTooltipText(doc, START_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertTrue(classUnderTest.getTooltipText(doc, MIDDLE_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertTrue(classUnderTest.getTooltipText(doc, END_DEPENDENCY_ARTIFACT_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertEquals("Cannot resolve expression\nNavigates to definition.", classUnderTest.getTooltipText(doc, END_DEPENDENCY_ARTIFACT_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+
+ assertEquals("Cannot resolve expression\nNavigates to definition.", classUnderTest.getTooltipText(doc, START_DEPENDENCY_VERSION_ID_VALUE - 1, HyperlinkType.GO_TO_DECLARATION));
+ assertTrue(classUnderTest.getTooltipText(doc, START_DEPENDENCY_VERSION_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertTrue(classUnderTest.getTooltipText(doc, MIDDLE_DEPENDENCY_VERSION_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertTrue(classUnderTest.getTooltipText(doc, END_DEPENDENCY_VERSION_ID_VALUE, HyperlinkType.GO_TO_DECLARATION).endsWith("org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.pom"));
+ assertEquals("Cannot resolve expression\nNavigates to definition.", classUnderTest.getTooltipText(doc, END_DEPENDENCY_VERSION_ID_VALUE + 1, HyperlinkType.GO_TO_DECLARATION));
+ }
+
+ private POMDataObject getTestMavenProjectPom() throws Exception {
+ LocalFileSystem lfs = new LocalFileSystem();
+ lfs.setRootDirectory(new File(getDataDir(),"test_projects"));
+ FileObject pom = lfs.findResource("hyperlinks/pom.xml");
+ return (POMDataObject) DataObject.find(pom);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists