summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNan Li2013-03-06 17:41:18 (EST)
committer Neil Hauge2013-03-06 17:41:18 (EST)
commit54ed13ee86fffccc71de69a3bac12bc6a91e6261 (patch)
treed81f5071dabd2b5ecf1facf53d11c3df5104cd62
parent0763efb7d0ced332289a5d6b356bd3bb99616af9 (diff)
downloadwebtools.dali-54ed13ee86fffccc71de69a3bac12bc6a91e6261.zip
webtools.dali-54ed13ee86fffccc71de69a3bac12bc6a91e6261.tar.gz
webtools.dali-54ed13ee86fffccc71de69a3bac12bc6a91e6261.tar.bz2
397634 - fix NPE in metadata conversion when mapping file doesn't have
supported content.
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java
index a892dbb..cb07678 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java
@@ -215,7 +215,7 @@ public abstract class JavaMetadataConversionWizardPage
// no need to remove this listener, since we build the model ourselves
this.mappingFileNameModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildMappingFileNameListener());
- this.setPageComplete(this.getOrmXmlResource() != null);
+ this.setPageComplete(this.getRootStructureNodes(this.getOrmXmlResource()).hasNext());
}
protected Control createMappingFileControl(Composite parent) {
@@ -301,7 +301,7 @@ public abstract class JavaMetadataConversionWizardPage
* not <code>null</code>.
*/
protected EntityMappings getEntityMappings_(JptXmlResource ormXmlResource) {
- Iterator<JpaStructureNode> nodes = this.jpaProject.getJpaFile(ormXmlResource.getFile()).getRootStructureNodes().iterator();
+ Iterator<JpaStructureNode> nodes = this.getRootStructureNodes(ormXmlResource);
return nodes.hasNext() ? (EntityMappings) nodes.next() : null;
}
@@ -624,6 +624,13 @@ public abstract class JavaMetadataConversionWizardPage
// ********** misc **********
+ /**
+ * Return the root structure nodes of the given XML resource
+ */
+ protected Iterator<JpaStructureNode> getRootStructureNodes(JptXmlResource ormXmlResource) {
+ return this.jpaProject.getJpaFile(ormXmlResource.getFile()).getRootStructureNodes().iterator();
+ }
+
@Override
public final void performHelp() {
PlatformUI.getWorkbench().getHelpSystem().displayHelp(HELP_CONTEXT_ID);