Author: scabanovich
Date: 2011-12-09 14:55:42 -0500 (Fri, 09 Dec 2011)
New Revision: 37186
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/messages.properties
Log:
JBIDE-10190
https://issues.jboss.org/browse/JBIDE-10190
Minor fixes.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java 2011-12-09
19:35:08 UTC (rev 37185)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java 2011-12-09
19:55:42 UTC (rev 37186)
@@ -33,18 +33,25 @@
boolean allowsPrimitive = false;
String implementsType = null;
String extendsType = null;
+ String visualAttr;
public CheckClass(ValidationErrorManager manager, String preference, String attr) {
super(manager, preference, attr);
+ visualAttr = attr;
}
public CheckClass(ValidationErrorManager manager, String preference, String attr,
boolean allowsPrimitive, String implementsType, String extendsType) {
- super(manager, preference, attr);
+ this(manager, preference, attr);
this.allowsPrimitive = allowsPrimitive;
this.implementsType = implementsType;
this.extendsType = extendsType;
}
+ public CheckClass setVisualAttribute(String v) {
+ visualAttr = v;
+ return this;
+ }
+
public void check(XModelObject object) {
if(attr == null) return;
String value = object.getAttributeValue(attr);
@@ -54,12 +61,12 @@
if(value.length() == 0 || isJavaLang(value)) return;
if(isPrimitive(value)) {
if(!allowsPrimitive) {
- fireNotExist(object, preference, attr, value);
+ fireNotExist(object, preference, value);
}
return;
}
if(!checkQualifiedName(value)) {
- fireInvalid(object, attr, attr, value);
+ fireInvalid(object, attr, value);
return;
}
IType type = getValidType(value, object);
@@ -81,18 +88,18 @@
LogHelper.logError("org.jboss.tools.jst.web.verification", e);
//$NON-NLS-1$
}
if(mustImpl != null) {
- fireImplements(object, preference, attr, value, mustImpl);
+ fireImplements(object, preference, value, mustImpl);
}
String mustExtend = null;
try { mustExtend = checkExtends(object, type); } catch (Exception e) {
LogHelper.logError("org.jboss.tools.jst.web.verification", e);
//$NON-NLS-1$
}
if(mustExtend != null) {
- fireExtends(object, preference, attr, value, mustExtend);
+ fireExtends(object, preference, value, mustExtend);
}
return;
}
- fireNotExist(object, preference, attr, value);
+ fireNotExist(object, preference, value);
}
private boolean checkQualifiedName(String value) {
@@ -148,18 +155,18 @@
}
}
- protected void fireImplements(XModelObject object, String id, String attr, String value,
String interfaceName) {
- fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_IMPLEMENTS, new Object[]
{attr, value, interfaceName}));
+ protected void fireImplements(XModelObject object, String id, String value, String
interfaceName) {
+ fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_IMPLEMENTS, new Object[]
{visualAttr, value, interfaceName}));
}
- protected void fireExtends(XModelObject object, String id, String attr, String value,
String superName) {
- fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_EXTENDS, new Object[]
{attr, value, superName}));
+ protected void fireExtends(XModelObject object, String id, String value, String
superName) {
+ fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_EXTENDS, new Object[]
{visualAttr, value, superName}));
}
- protected void fireInvalid(XModelObject object, String id, String attr, String value) {
- fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_VALID, attr, value));
+ protected void fireInvalid(XModelObject object, String id, String value) {
+ fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_VALID, visualAttr,
value));
}
- protected void fireNotExist(XModelObject object, String id, String attr, String value)
{
- fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_EXISTS, attr, value));
+ protected void fireNotExist(XModelObject object, String id, String value) {
+ fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_EXISTS, visualAttr,
value));
}
public static IType getValidType(String className, XModelObject o) {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/messages.properties
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/messages.properties 2011-12-09
19:35:08 UTC (rev 37185)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/messages.properties 2011-12-09
19:55:42 UTC (rev 37186)
@@ -2,16 +2,16 @@
VALIDATING_RESOURCE=project "{0}"; resource "{1}"
VALIDATING_PROJECT=project "{0}"
-PATH_EMPTY=Attribute {0} is empty
-PATH_NOT_EXISTS=Attribute {0} references to {1} that does not exist in web content
-PATH_NOT_TAGLIB=Attribute {0} references to {1} that is not tag library
-PATH_NOT_ICON=Attribute {0} references to {1} that is not an icon file
-PATH_NOT_PAGE=Attribute {0} references to {1} that is not a page file
-CLASS_NOT_EXISTS=Attribute {0} references to non-existent class {1}
-CLASS_NOT_IMPLEMENTS=Attribute {0} references to {1} that does not implement interface
{2}
-CLASS_NOT_EXTENDS=Attribute {0} references to {1} that does not extend {2}
-CLASS_NOT_VALID=Attribute {0} must be valid fully qualified class name
+PATH_EMPTY={0} is empty
+PATH_NOT_EXISTS={0} references to {1} that does not exist in web content
+PATH_NOT_TAGLIB={0} references to {1} that is not tag library
+PATH_NOT_ICON={0} references to {1} that is not an icon file
+PATH_NOT_PAGE={0} references to {1} that is not a page file
+CLASS_NOT_EXISTS={0} references to non-existent class {1}
+CLASS_NOT_IMPLEMENTS={0} references to {1} that does not implement interface {2}
+CLASS_NOT_EXTENDS={0} references to {1} that does not extend {2}
+CLASS_NOT_VALID={0} must be valid fully qualified class name
EMPTY=Attribute {0} is empty
-SERVLET_NOT_EXISTS=Attribute {0} references to {1} that is not a servlet
-FILTER_NOT_EXISTS=Attribute {0} references to {1} that is not a filter
-ROLE_NOT_EXISTS=Attribute {0} references to {1} that is not a role
+SERVLET_NOT_EXISTS={0} references to {1} that is not a servlet
+FILTER_NOT_EXISTS={0} references to {1} that is not a filter
+ROLE_NOT_EXISTS={0} references to {1} that is not a role