[294516] JSP Tag file wizard should validate the existence of /WEB-INF/tags folder
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIMessages.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIMessages.java
index 0558d4b..c4b0d88 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIMessages.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIMessages.java
@@ -69,6 +69,7 @@
public static String _ERROR_FILENAME_MUST_END_JSP;
public static String _WARNING_FILE_MUST_BE_INSIDE_JAVA_PROJECT;
public static String _WARNING_FOLDER_MUST_BE_INSIDE_WEB_CONTENT;
+ public static String _WARNING_INVALID_TAG_LOCATION;
public static String ResourceGroup_nameExists;
public static String NewJSPTemplatesWizardPage_0;
public static String NewJSPTemplatesWizardPage_1;
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties
index fed7e65..fc16de8 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties
@@ -44,6 +44,7 @@
_ERROR_FILENAME_MUST_END_JSP = The file name must end in one of the following extensions {0}.
_WARNING_FILE_MUST_BE_INSIDE_JAVA_PROJECT = JavaServer Pages created in projects that do not support Java might not work as expected.
_WARNING_FOLDER_MUST_BE_INSIDE_WEB_CONTENT = Files created outside of the Web Content folder will not be included in your deployed Web application.
+_WARNING_INVALID_TAG_LOCATION=Tag files outside of /WEB-INF/tags/ will be ignored by the JSP container.
ResourceGroup_nameExists = The same name already exists.
NewJSPTemplatesWizardPage_0=Select JSP Template
NewJSPTemplatesWizardPage_1=Select a template as initial content in the JSP page.
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/wizard/NewTagFileWizardPage.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/wizard/NewTagFileWizardPage.java
index d0bcb46..0402134 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/wizard/NewTagFileWizardPage.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/wizard/NewTagFileWizardPage.java
@@ -103,16 +103,22 @@
if (!isJavaProject(project)) {
setMessage(JSPUIMessages._WARNING_FILE_MUST_BE_INSIDE_JAVA_PROJECT, WARNING);
}
- // if inside web project, check if inside webContent folder
- /*
- if (isDynamicWebProject(project)) {
- // check that the path is inside the webContent folder
- IPath webContentPath = getWebContentPath(project).append("/WEB-INF/tags");
- if (!webContentPath.isPrefixOf(fullPath)) {
- setMessage(JSPUIMessages._WARNING_FOLDER_MUST_BE_INSIDE_WEB_CONTENT, WARNING);
+ else if (isDynamicWebProject(project)) {
+ // JSP Spec - 8.4.1
+ final IPath[] paths = FacetModuleCoreSupport.getAcceptableRootPaths(project);
+ if (paths != null) {
+ boolean inTagsFolder = false;
+ for (int i = 0; i < paths.length; i++) {
+ if (paths[i].append("/WEB-INF/tags").isPrefixOf(fullPath)) { //$NON-NLS-1$
+ inTagsFolder = true;
+ break;
+ }
+ }
+ if (!inTagsFolder) {
+ setMessage(JSPUIMessages._WARNING_INVALID_TAG_LOCATION, WARNING);
+ }
}
}
- */
}
}
@@ -129,7 +135,7 @@
StringBuffer newFileName = new StringBuffer(filename);
// Preferences preference = JSPCorePlugin.getDefault().getPluginPreferences();
- String ext = "tag";//preference.getString(JSPCorePreferenceNames.DEFAULT_EXTENSION);
+ String ext = "tag";//preference.getString(JSPCorePreferenceNames.DEFAULT_EXTENSION); //$NON-NLS-1$
newFileName.append("."); //$NON-NLS-1$
newFileName.append(ext);