aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Munoz2012-11-28 15:45:27 (EST)
committerIgor Fedorenko2012-12-16 12:51:26 (EST)
commitbd1d499d0eaa3cd57e0cfddd1544d49f1eff76dd (patch)
tree0179c255c968a1bde530fa1e8ea5f14048a790e2
parent05bb7cc24d7b69f7bd681f799457fb86866dbdc5 (diff)
downloadm2e-core-bd1d499d0eaa3cd57e0cfddd1544d49f1eff76dd.zip
m2e-core-bd1d499d0eaa3cd57e0cfddd1544d49f1eff76dd.tar.gz
m2e-core-bd1d499d0eaa3cd57e0cfddd1544d49f1eff76dd.tar.bz2
395144: The install artifact wizard does not process POM in different location
Changes to be comitted: Modified: MavenInstallFileArtifactWizardPage.java - I wrote 100% of the code - I have right to contribute Eclipse - I have updated the header
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenInstallFileArtifactWizardPage.java47
1 files changed, 30 insertions, 17 deletions
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenInstallFileArtifactWizardPage.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenInstallFileArtifactWizardPage.java
index 9dcb7ca..0bd5dd5 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenInstallFileArtifactWizardPage.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenInstallFileArtifactWizardPage.java
@@ -139,7 +139,7 @@ public class MavenInstallFileArtifactWizardPage extends WizardPage {
fileDialog.setFileName(pomFileNameText.getText());
String res = fileDialog.open();
if(res!=null) {
- pomFileNameText.setText(res);
+ updatePOMFileName(res);
}
}
});
@@ -274,22 +274,7 @@ public class MavenInstallFileArtifactWizardPage extends WizardPage {
String pomFileName = fileName.substring(0, n) + ".pom"; //$NON-NLS-1$
if(new File(pomFileName).exists()) {
pomFileNameText.setText(pomFileName);
-
- // read pom file
-
- try {
- IMaven maven = MavenPlugin.getMaven();
- MavenProject mavenProject = maven.readProject(new File(pomFileName), null);
-
- groupIdCombo.setText(mavenProject.getGroupId());
- artifactIdCombo.setText(mavenProject.getArtifactId());
- versionCombo.setText(mavenProject.getVersion());
- packagingCombo.setText(mavenProject.getPackaging());
- return;
-
- } catch(CoreException ex) {
- log.error(ex.getMessage(), ex);
- }
+ readPOMFile(pomFileName);
}
}
@@ -303,6 +288,34 @@ public class MavenInstallFileArtifactWizardPage extends WizardPage {
}
}
}
+
+ private void updatePOMFileName(String fileName){
+ if(!getPomFileName().equals(fileName))
+ pomFileNameText.setText(fileName);
+
+ File file = new File(fileName);
+ if(!file.exists() || !file.isFile() || !fileName.endsWith(".pom")) { //$NON-NLS-1$
+ return;
+ }
+
+ readPOMFile(fileName);
+ }
+
+ private void readPOMFile(String fileName){
+ try {
+ IMaven maven = MavenPlugin.getMaven();
+ MavenProject mavenProject = maven.readProject(new File(fileName), null);
+
+ groupIdCombo.setText(mavenProject.getGroupId());
+ artifactIdCombo.setText(mavenProject.getArtifactId());
+ versionCombo.setText(mavenProject.getVersion());
+ packagingCombo.setText(mavenProject.getPackaging());
+ return;
+
+ } catch(CoreException ex) {
+ log.error(ex.getMessage(), ex);
+ }
+ }
void pageChanged() {
String artifactFileName = getArtifactFileName();