Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilos Kleint2011-02-09 08:25:26 -0500
committerMilos Kleint2011-02-09 08:25:26 -0500
commitc144d865e7ae89420104bf30a8286a7d952cc426 (patch)
tree7d4e6d9d8ec194d4452fc08a95f915dde989abb8 /org.eclipse.m2e.editor.xml
parent4e80092760f4e15ba1bd1115dc0162c1caf0afbc (diff)
downloadm2e-core-c144d865e7ae89420104bf30a8286a7d952cc426.tar.gz
m2e-core-c144d865e7ae89420104bf30a8286a7d952cc426.tar.xz
m2e-core-c144d865e7ae89420104bf30a8286a7d952cc426.zip
336511 fix finding proper existing editor for workspace non-pom.xml POMs
Diffstat (limited to 'org.eclipse.m2e.editor.xml')
-rw-r--r--org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomHyperlinkDetector.java6
-rw-r--r--org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/XmlUtils.java5
2 files changed, 7 insertions, 4 deletions
diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomHyperlinkDetector.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomHyperlinkDetector.java
index 59056914..bb6c35ce 100644
--- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomHyperlinkDetector.java
+++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomHyperlinkDetector.java
@@ -223,7 +223,7 @@ public class PomHyperlinkDetector implements IHyperlinkDetector {
if (mavprj != null) {
InputLocation openLocation = findLocationForManagedArtifact(region, mavprj);
if (openLocation != null) {
- File file = XmlUtils.fileForInputLocation(openLocation);
+ File file = XmlUtils.fileForInputLocation(openLocation, mavprj);
if (file != null) {
IFileStore fileStore = EFS.getLocalFileSystem().getStore(file.toURI());
openXmlEditor(fileStore, openLocation.getLineNumber(), openLocation.getColumnNumber(), openLocation.getSource().getModelId());
@@ -352,7 +352,7 @@ public class PomHyperlinkDetector implements IHyperlinkDetector {
if (mdl.getProperties().containsKey(region.property)) {
InputLocation location = mdl.getLocation( "properties" ).getLocation( region.property ); //$NON-NLS-1$
if (location != null) {
- File file = XmlUtils.fileForInputLocation(location);
+ File file = XmlUtils.fileForInputLocation(location, mavprj);
if (file != null) {
IFileStore fileStore = EFS.getLocalFileSystem().getStore(file.toURI());
openXmlEditor(fileStore, location.getLineNumber(), location.getColumnNumber(), location.getSource().getModelId());
@@ -529,7 +529,7 @@ public class PomHyperlinkDetector implements IHyperlinkDetector {
IWorkbenchPage page = window.getActivePage();
if(page != null) {
try {
- if(fileStore.getName().equals("pom.xml")) {
+ if(!fileStore.getName().endsWith(".pom")) { //.pom means stuff from local repository?
IEditorPart part = IDE.openEditorOnFileStore(page, fileStore);
reveal(selectEditorPage(part), line, column);
} else {
diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/XmlUtils.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/XmlUtils.java
index 408ca308..a8529015 100644
--- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/XmlUtils.java
+++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/XmlUtils.java
@@ -152,7 +152,7 @@ public class XmlUtils {
* @param location
* @return
*/
- public static File fileForInputLocation(InputLocation location) {
+ public static File fileForInputLocation(InputLocation location, MavenProject origin) {
InputSource source = location.getSource();
if (source != null) {
//MNGECLIPSE-2539 apparently if maven can't resolve the model from local storage,
@@ -165,6 +165,9 @@ public class XmlUtils {
} else {
//try to find pom by coordinates..
String modelId = source.getModelId();
+ if (origin.getModel().getId().equals(modelId) && origin.getFile() != null) {
+ return origin.getFile();
+ }
String[] splitStrings = modelId.split(":");
assert splitStrings.length == 3;
IMavenProjectFacade facade = MavenPlugin.getDefault().getMavenProjectManager().getMavenProject(splitStrings[0], splitStrings[1], splitStrings[2]);

Back to the top