Author: scabanovich
Date: 2010-02-02 09:18:33 -0500 (Tue, 02 Feb 2010)
New Revision: 20077
Modified:
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/StrutsAuxEntityRecognizer.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/StrutsEntityRecognizer.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validators/model/FileValidatorRecognizer.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5781
Modified:
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/StrutsAuxEntityRecognizer.java
===================================================================
---
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/StrutsAuxEntityRecognizer.java 2010-02-02
14:17:44 UTC (rev 20076)
+++
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/StrutsAuxEntityRecognizer.java 2010-02-02
14:18:33 UTC (rev 20077)
@@ -18,9 +18,10 @@
public StrutsAuxEntityRecognizer() {
}
- public String getEntityName(String ext, String body) {
+ public String getEntityName(EntityRecognizerContext context) {
+ String body = context.getBody();
if (body == null) return null;
- return StrutsConfigLoader.LAYOUT_FILE_EXTENSION.equals(ext) ?
"FileAnyAuxiliary" : null;
+ return StrutsConfigLoader.LAYOUT_FILE_EXTENSION.equals(context.getExtension()) ?
"FileAnyAuxiliary" : null;
}
}
Modified:
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/StrutsEntityRecognizer.java
===================================================================
---
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/StrutsEntityRecognizer.java 2010-02-02
14:17:44 UTC (rev 20076)
+++
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/StrutsEntityRecognizer.java 2010-02-02
14:18:33 UTC (rev 20077)
@@ -29,12 +29,17 @@
public StrutsEntityRecognizer() {}
- public String getEntityName(String ext, String body) {
+ public String getEntityName(EntityRecognizerContext context) {
+ String body = context.getBody();
if (body == null) return null;
- if(body.indexOf(DOC_PUBLICID_PR) < 0) return null;
- if (body.indexOf(DOC_PUBLICID_10) > 0) return ENT_STRUTSCONFIG+VER_SUFFIX_10;
- if (body.indexOf(DOC_PUBLICID_11) > 0) return ENT_STRUTSCONFIG+VER_SUFFIX_11;
- if (body.indexOf(DOC_PUBLICID_12) > 0) return ENT_STRUTSCONFIG+VER_SUFFIX_12;
+ XMLRecognizerContext xml = context.getXMLContext();
+ if(xml.isDTD()) {
+ String publicId = xml.getPublicId();
+ if(publicId == null || !publicId.startsWith(DOC_PUBLICID_PR)) return null;
+ if(DOC_PUBLICID_10.equals(publicId)) return ENT_STRUTSCONFIG + VER_SUFFIX_10;
+ if(DOC_PUBLICID_11.equals(publicId)) return ENT_STRUTSCONFIG + VER_SUFFIX_11;
+ if(DOC_PUBLICID_12.equals(publicId)) return ENT_STRUTSCONFIG + VER_SUFFIX_12;
+ }
return null;
}
Modified:
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validators/model/FileValidatorRecognizer.java
===================================================================
---
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validators/model/FileValidatorRecognizer.java 2010-02-02
14:17:44 UTC (rev 20076)
+++
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validators/model/FileValidatorRecognizer.java 2010-02-02
14:18:33 UTC (rev 20077)
@@ -28,10 +28,15 @@
public FileValidatorRecognizer() {}
- public String getEntityName(String ext, String body) {
+ public String getEntityName(EntityRecognizerContext context) {
+ String body = context.getBody();
if(body == null) return null;
- if(body.indexOf(DOC_PUBLICID) >= 0) return "FileValidationRules";
- if(body.indexOf(DOC_PUBLICID_11) >= 0) return
"FileValidationRules11";
+ XMLRecognizerContext xml = context.getXMLContext();
+ if(xml.isDTD()) {
+ String publicId = xml.getPublicId();
+ if(DOC_PUBLICID.equals(publicId)) return "FileValidationRules";
+ if(DOC_PUBLICID_11.equals(publicId)) return "FileValidationRules11";
+ }
return null;
}