Author: scabanovich
Date: 2012-01-23 20:31:18 -0500 (Mon, 23 Jan 2012)
New Revision: 38058
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/helpers/WebAppHelper.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckServletMappingName.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/WebAppServletImpl.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/WebAppServletMappingImpl.java
Log:
JBIDE-10645
https://issues.joss.org/browse/JBIDE-10645
Constant is used instead of string.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/helpers/WebAppHelper.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/helpers/WebAppHelper.java 2012-01-24
01:23:45 UTC (rev 38057)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/helpers/WebAppHelper.java 2012-01-24
01:31:18 UTC (rev 38058)
@@ -91,7 +91,7 @@
XModelObject[] s = getServlets(webxml);
for (int i = 0; i < s.length; i++) {
if(className != null &&
className.equals(s[i].getAttributeValue("servlet-class"))) return s[i];
//$NON-NLS-1$
- if(servletName != null &&
servletName.equals(s[i].getAttributeValue("servlet-name"))) return s[i];
//$NON-NLS-1$
+ if(servletName != null &&
servletName.equals(s[i].getAttributeValue(WebAppConstants.SERVLET_NAME))) return s[i];
}
return null;
}
@@ -112,7 +112,7 @@
XModelObject folder = webxml.getChildByPath(SERVLET_FOLDER);
if(folder == null) folder = webxml;
s =
webxml.getModel().createModelObject(getServletEntity(folder.getModelEntity()), null);
- s.setAttributeValue("servlet-name", servletName); //$NON-NLS-1$
+ s.setAttributeValue(WebAppConstants.SERVLET_NAME, servletName);
s.setAttributeValue("servlet-class", className); //$NON-NLS-1$
DefaultCreateHandler.addCreatedObject(folder, s, -1);
}
@@ -138,7 +138,7 @@
if(webxml == null) return null;
XModelObject[] s = getServletMappings(webxml);
for (int i = 0; i < s.length; i++) {
- if(servletName != null &&
servletName.equals(s[i].getAttributeValue("servlet-name"))) return s[i];
//$NON-NLS-1$
+ if(servletName != null &&
servletName.equals(s[i].getAttributeValue(WebAppConstants.SERVLET_NAME))) return s[i];
}
return null;
}
@@ -157,7 +157,7 @@
XModelObject folder = webxml.getChildByPath(SERVLET_FOLDER);
if(folder == null) folder = webxml;
s = webxml.getModel().createModelObject(SERVLET_MAPPING_ENTITY, null);
- s.setAttributeValue("servlet-name", servletName); //$NON-NLS-1$
+ s.setAttributeValue(WebAppConstants.SERVLET_NAME, servletName);
s.setAttributeValue("url-pattern", "*.jsf"); //$NON-NLS-1$
//$NON-NLS-2$
DefaultCreateHandler.addCreatedObject(folder, s, -1);
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckServletMappingName.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckServletMappingName.java 2012-01-24
01:23:45 UTC (rev 38057)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckServletMappingName.java 2012-01-24
01:31:18 UTC (rev 38058)
@@ -17,13 +17,14 @@
import org.jboss.tools.common.validation.ValidationErrorManager;
import org.jboss.tools.jst.web.WebModelPlugin;
import org.jboss.tools.jst.web.model.helpers.WebAppHelper;
+import org.jboss.tools.jst.web.webapp.model.WebAppConstants;
/**
* @author Viacheslav Kabanovich
*/
public class CheckServletMappingName extends Check {
public static String JAX_RS_APPLICATION = "javax.ws.rs.core.Application";
//$NON-NLS-1$
- static String ATTR = "servlet-name"; //$NON-NLS-1$
+ static String ATTR = WebAppConstants.SERVLET_NAME;
boolean acceptEmpty = false;
public CheckServletMappingName(ValidationErrorManager manager, String preference,
boolean acceptEmpty) {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/WebAppServletImpl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/WebAppServletImpl.java 2012-01-24
01:23:45 UTC (rev 38057)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/WebAppServletImpl.java 2012-01-24
01:31:18 UTC (rev 38058)
@@ -21,13 +21,13 @@
}
public String name() {
- return getAttributeValue("servlet-name"); //$NON-NLS-1$
+ return getAttributeValue(WebAppConstants.SERVLET_NAME);
}
public String getPresentationString() {
String c = getAttributeValue(WebAppConstants.SERVLET_CLASS);
if(c.length() == 0) c = getAttributeValue(WebAppConstants.JSP_FILE);
- return "" + getAttributeValue("servlet-name") + ":"
+ c; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return "" + getAttributeValue(WebAppConstants.SERVLET_NAME) +
":" + c; //$NON-NLS-1$ //$NON-NLS-2$
}
protected void onAttributeValueEdit(String name, String oldValue, String newValue)
throws XModelException {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/WebAppServletMappingImpl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/WebAppServletMappingImpl.java 2012-01-24
01:23:45 UTC (rev 38057)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/WebAppServletMappingImpl.java 2012-01-24
01:31:18 UTC (rev 38058)
@@ -16,7 +16,7 @@
private static final long serialVersionUID = 1L;
public String name() {
- return getAttributeValue("servlet-name") + ":" +
getAttributeValue("url-pattern"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return getAttributeValue(WebAppConstants.SERVLET_NAME) + ":" +
getAttributeValue("url-pattern"); //$NON-NLS-1$ //$NON-NLS-2$
}
}