diff options
author | John Collier | 2018-03-27 16:13:28 +0000 |
---|---|---|
committer | John Collier | 2018-03-27 16:16:53 +0000 |
commit | 7bfd05ca687758b8cebe394cc784e7aadadf0c4b (patch) | |
tree | 39b5b209b13c1b559c54452872701e3e3b553eca /plugins | |
parent | 5092ff0cdb232ccd2f293255d01103f8c4dc15fc (diff) | |
download | webtools.javaee-7bfd05ca687758b8cebe394cc784e7aadadf0c4b.tar.gz webtools.javaee-7bfd05ca687758b8cebe394cc784e7aadadf0c4b.tar.xz webtools.javaee-7bfd05ca687758b8cebe394cc784e7aadadf0c4b.zip |
Bug 515476: Don't assume schema location for Web App projects
Fixes JavaEEQuickpeek.getVersion() so that the schema location of a
deployment descriptor does not need to be specified. So long as we know
the namespace and schema type, we can determine the version.
Also-by: Brian de Alwis <bsd@mt.ca>
Signed-off-by: John Collier <John.J.Collier@ibm.com>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/org.eclipse.jst.j2ee.core/archive/org/eclipse/jst/jee/util/internal/JavaEEQuickPeek.java | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/plugins/org.eclipse.jst.j2ee.core/archive/org/eclipse/jst/jee/util/internal/JavaEEQuickPeek.java b/plugins/org.eclipse.jst.j2ee.core/archive/org/eclipse/jst/jee/util/internal/JavaEEQuickPeek.java index 66b066496..269801780 100644 --- a/plugins/org.eclipse.jst.j2ee.core/archive/org/eclipse/jst/jee/util/internal/JavaEEQuickPeek.java +++ b/plugins/org.eclipse.jst.j2ee.core/archive/org/eclipse/jst/jee/util/internal/JavaEEQuickPeek.java @@ -153,14 +153,11 @@ public class JavaEEQuickPeek implements J2EEVersionConstants { String publicID = handler.getDtdPublicID(); String systemID = handler.getDtdSystemID(); String schemaName = null; + String namespace = null; if (publicID == null || systemID == null) { if (handler.getRootAttributes() != null) { schemaName = normalizeSchemaLocation(handler.getRootAttributes().getValue("xsi:schemaLocation")); //$NON-NLS-1$ } - if (schemaName == null) { - version = UNKNOWN; - return version; - } } switch (getType()) { case APPLICATION_CLIENT_TYPE: @@ -262,6 +259,25 @@ public class JavaEEQuickPeek implements J2EEVersionConstants { } else if (schemaName.indexOf(J2EEConstants.WEBAPP_SCHEMA_4_0) != -1) { version = J2EEVersionConstants.WEB_4_0_ID; } + } else if (J2EEConstants.J2EE_NS_URL.equals(namespace)) { + String versionAttribute = handler.getRootAttributes().getValue("version"); //$NON-NLS-1$ + if (J2EEVersionConstants.VERSION_2_4_TEXT.equals(versionAttribute)) { + version = J2EEVersionConstants.WEB_2_4_ID; + } + } else if (J2EEConstants.JAVAEE_NS_URL.equals(namespace)) { + String versionAttribute = handler.getRootAttributes().getValue("version"); //$NON-NLS-1$ + if (J2EEVersionConstants.VERSION_2_5_TEXT.equals(versionAttribute)) { + version = J2EEVersionConstants.WEB_2_5_ID; + } else if (J2EEVersionConstants.VERSION_3_0_TEXT.equals(versionAttribute)) { + version = J2EEVersionConstants.WEB_3_0_ID; + } + } else if (J2EEConstants.JAVAEE7_NS_URL.equals(namespace)) { + String versionAttribute = handler.getRootAttributes().getValue("version"); //$NON-NLS-1$ + if (J2EEVersionConstants.VERSION_3_1_TEXT.equals(versionAttribute)) { + version = J2EEVersionConstants.WEB_3_1_ID; + } else if (J2EEVersionConstants.VERSION_4_0_TEXT.equals(versionAttribute)) { + version = J2EEVersionConstants.WEB_4_0_ID; + } } break; case WEBSERVICES_TYPE: |