diff options
author | Igor Fedorenko | 2011-08-04 15:24:23 +0000 |
---|---|---|
committer | Igor Fedorenko | 2011-08-04 15:24:23 +0000 |
commit | 093352787bc8b48dfebd094d2967760491550e3e (patch) | |
tree | b850877905e0c25f594a43ef8bdcdfcb395a4b7d /org.eclipse.m2e.editor.xml | |
parent | c47e215285d7c562d2e8c98c52a80349abe070b6 (diff) | |
parent | 55bb6dd084da70138e6fd4800a514ee94abdb743 (diff) | |
download | m2e-core-093352787bc8b48dfebd094d2967760491550e3e.tar.gz m2e-core-093352787bc8b48dfebd094d2967760491550e3e.tar.xz m2e-core-093352787bc8b48dfebd094d2967760491550e3e.zip |
Merge remote-tracking branch 'origin/master' into m2e-self-hosting
Conflicts:
com.ning.async-http-client/pom.xml
org.eclipse.m2e.archetype.common/META-INF/MANIFEST.MF
org.eclipse.m2e.archetype.common/pom.xml
org.eclipse.m2e.core.ui/pom.xml
org.eclipse.m2e.core/pom.xml
org.eclipse.m2e.discovery/pom.xml
org.eclipse.m2e.editor.xml/pom.xml
org.eclipse.m2e.editor/pom.xml
org.eclipse.m2e.feature/pom.xml
org.eclipse.m2e.integration.tests.common/pom.xml
org.eclipse.m2e.jdt/pom.xml
org.eclipse.m2e.launching/pom.xml
org.eclipse.m2e.lifecyclemapping.defaults/pom.xml
org.eclipse.m2e.logback.appender/pom.xml
org.eclipse.m2e.logback.configuration/pom.xml
org.eclipse.m2e.logback.feature/pom.xml
org.eclipse.m2e.maven.indexer/META-INF/MANIFEST.MF
org.eclipse.m2e.maven.indexer/pom.xml
org.eclipse.m2e.maven.runtime/META-INF/MANIFEST.MF
org.eclipse.m2e.maven.runtime/pom.xml
org.eclipse.m2e.model.edit/pom.xml
org.eclipse.m2e.refactoring/pom.xml
org.eclipse.m2e.scm/pom.xml
org.eclipse.m2e.sdk.feature/pom.xml
org.eclipse.m2e.site/pom.xml
org.eclipse.m2e.tests.common/pom.xml
org.eclipse.m2e.usagedata/pom.xml
org.jboss.netty/pom.xml
pom.xml
target-platform/pom.xml
Diffstat (limited to 'org.eclipse.m2e.editor.xml')
3 files changed, 29 insertions, 11 deletions
diff --git a/org.eclipse.m2e.editor.xml/META-INF/MANIFEST.MF b/org.eclipse.m2e.editor.xml/META-INF/MANIFEST.MF index 41b19b10..60926145 100644 --- a/org.eclipse.m2e.editor.xml/META-INF/MANIFEST.MF +++ b/org.eclipse.m2e.editor.xml/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.m2e.editor.xml;singleton:=true -Bundle-Version: 1.0.100.qualifier +Bundle-Version: 1.0.200.qualifier Bundle-Activator: org.eclipse.m2e.editor.xml.MvnIndexPlugin Eclipse-LazyStart: true Require-Bundle: org.eclipse.core.runtime, diff --git a/org.eclipse.m2e.editor.xml/pom.xml b/org.eclipse.m2e.editor.xml/pom.xml index d8241198..d64e7492 100644 --- a/org.eclipse.m2e.editor.xml/pom.xml +++ b/org.eclipse.m2e.editor.xml/pom.xml @@ -12,7 +12,7 @@ <parent> <groupId>org.eclipse.m2e</groupId> <artifactId>m2e-core</artifactId> - <version>1.0.100-SNAPSHOT</version> + <version>1.0.200-SNAPSHOT</version> </parent> <artifactId>org.eclipse.m2e.editor.xml</artifactId> diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/lifecycle/LifecycleMappingDialog.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/lifecycle/LifecycleMappingDialog.java index 2ed6ef84..59a55028 100644 --- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/lifecycle/LifecycleMappingDialog.java +++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/lifecycle/LifecycleMappingDialog.java @@ -8,10 +8,13 @@ * Contributors: * Sonatype, Inc. - initial API and implementation *******************************************************************************/ + package org.eclipse.m2e.editor.xml.internal.lifecycle; +import java.io.File; import java.lang.reflect.InvocationTargetException; +import org.apache.maven.model.InputLocation; import org.apache.maven.model.Plugin; import org.apache.maven.project.MavenProject; @@ -40,6 +43,7 @@ import org.eclipse.m2e.core.project.IMavenProjectFacade; import org.eclipse.m2e.core.ui.internal.components.PomHierarchyComposite; +@SuppressWarnings("restriction") public class LifecycleMappingDialog extends Dialog implements ISelectionChangedListener { private PomHierarchyComposite pomComposite; @@ -105,7 +109,9 @@ public class LifecycleMappingDialog extends Dialog implements ISelectionChangedL //350439 //set selection here, because we listen on changes and update the ok button. //but the button is not created until super is called here.. - pomComposite.setSelection(new StructuredSelection(pluginProject)); + if(pluginProject != null) { + pomComposite.setSelection(new StructuredSelection(pluginProject)); + } } public void selectionChanged(SelectionChangedEvent event) { @@ -143,16 +149,28 @@ public class LifecycleMappingDialog extends Dialog implements ISelectionChangedL } private MavenProject locatePlugin() { - for (MavenProject project : pomComposite.getHierarchy()) { - if (project.getOriginalModel().getBuild() != null) { - for (Plugin plugin : project.getOriginalModel().getBuild().getPlugins()) { - if(plugin.getGroupId().equals(pluginGroupId) && plugin.getArtifactId().equals(pluginArtifactId) - && (plugin.getVersion() == null || pluginVersion.equals(plugin.getVersion()))) { - return project; - } - } + MavenProject project = facade.getMavenProject(); // if we got here, facade.getMavenProject cannot be null + + Plugin plugin = project.getPlugin(pluginGroupId + ":" + pluginArtifactId); + + if(plugin == null) { + return null; // can't really happy + } + + InputLocation location = plugin.getLocation(""); + + if(location == null || location.getSource() == null || location.getSource().getLocation() == null) { + // that's odd. where does this come from??? + return null; + } + + File basedir = new File(location.getSource().getLocation()).getParentFile(); // should be canonical file already + for(MavenProject other : pomComposite.getHierarchy()) { + if(basedir.equals(other.getBasedir())) { + return other; } } + return null; } } |