Author: dazarov
Date: 2011-10-05 19:54:27 -0400 (Wed, 05 Oct 2011)
New Revision: 35407
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/BeansXmlValidationDelegate.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java
Log:
Quick fixes for problem markers in beans.xml
https://issues.jboss.org/browse/JBIDE-9833
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/BeansXmlValidationDelegate.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/BeansXmlValidationDelegate.java 2011-10-05
23:51:50 UTC (rev 35406)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/BeansXmlValidationDelegate.java 2011-10-05
23:54:27 UTC (rev 35407)
@@ -184,7 +184,7 @@
List<TypeNode> typeNodes = getTypeElements((Element)parentNode,
typeValidator.getTypeElementName());
Map<String, TypeNode> uniqueTypes = new HashMap<String, TypeNode>();
for (TypeNode typeNode : typeNodes) {
- IType type = getType(beansXml, typeNode,
typeValidator.getUnknownTypeErrorMessage());
+ IType type = getType(beansXml, typeNode,
typeValidator.getUnknownTypeErrorMessage(),
typeValidator.getUnknownTypeErrorMessageId());
if(type!=null) {
if(!type.isBinary()) {
validator.getValidationContext().addLinkedCoreResource(CDICoreValidator.SHORT_ID,
beansXml.getFullPath().toOSString(), type.getPath(), false);
@@ -199,17 +199,17 @@
}
if(!typeValidator.validateKindOfType(type)) {
validator.addError(typeValidator.getIllegalTypeErrorMessage(),
CDIPreferences.ILLEGAL_TYPE_NAME_IN_BEANS_XML,
- new String[]{}, typeNode.getLength(), typeNode.getStartOffset(), beansXml);
+ new String[]{}, typeNode.getLength(), typeNode.getStartOffset(), beansXml,
typeValidator.getIllegalTypeErrorMessageId());
} else if(type.isBinary()) {
if(!typeValidator.validateBinaryType(type)) {
validator.addError(typeValidator.getIllegalTypeErrorMessage(),
CDIPreferences.ILLEGAL_TYPE_NAME_IN_BEANS_XML,
- new String[]{}, typeNode.getLength(), typeNode.getStartOffset(), beansXml);
+ new String[]{}, typeNode.getLength(), typeNode.getStartOffset(), beansXml,
typeValidator.getIllegalTypeErrorMessageId());
}
continue;
} else {
if(!typeValidator.validateSourceType(type)) {
validator.addError(typeValidator.getIllegalTypeErrorMessage(),
CDIPreferences.ILLEGAL_TYPE_NAME_IN_BEANS_XML,
- new String[]{}, typeNode.getLength(), typeNode.getStartOffset(), beansXml);
+ new String[]{}, typeNode.getLength(), typeNode.getStartOffset(), beansXml,
typeValidator.getIllegalTypeErrorMessageId());
}
}
TypeNode node = uniqueTypes.get(typeNode.getTypeName());
@@ -252,7 +252,7 @@
return null;
}
- private IType getType(IFile beansXml, TypeNode node, String errorMessage) {
+ private IType getType(IFile beansXml, TypeNode node, String errorMessage, int
errorMessageId) {
IType type = null;
if(node.getTypeName()!=null) {
try {
@@ -268,7 +268,7 @@
if(type==null) {
addLinkedResourcesForUnknownType(beansXml, node.getTypeName());
validator.addError(errorMessage, CDIPreferences.ILLEGAL_TYPE_NAME_IN_BEANS_XML,
- new String[]{}, node.getLength(), node.getStartOffset(), beansXml);
+ new String[]{}, node.getLength(), node.getStartOffset(), beansXml, errorMessageId);
}
return type;
}
@@ -389,8 +389,12 @@
String getParrentElementname();
String getUnknownTypeErrorMessage();
+
+ int getUnknownTypeErrorMessageId();
String getIllegalTypeErrorMessage();
+
+ int getIllegalTypeErrorMessageId();
String getDuplicateTypeErrorMessage();
}
@@ -432,11 +436,19 @@
public String getUnknownTypeErrorMessage() {
return CDIValidationMessages.UNKNOWN_ALTERNATIVE_BEAN_CLASS_NAME;
}
+
+ public int getUnknownTypeErrorMessageId() {
+ return CDIValidationErrorManager.UNKNOWN_ALTERNATIVE_BEAN_CLASS_NAME_ID;
+ }
public String getIllegalTypeErrorMessage() {
return CDIValidationMessages.ILLEGAL_ALTERNATIVE_BEAN_CLASS;
}
+ public int getIllegalTypeErrorMessageId() {
+ return CDIValidationErrorManager.ILLEGAL_ALTERNATIVE_BEAN_CLASS_ID;
+ }
+
public String getDuplicateTypeErrorMessage() {
return CDIValidationMessages.DUPLICATE_ALTERNATIVE_TYPE;
}
@@ -472,10 +484,18 @@
return CDIValidationMessages.UNKNOWN_ALTERNATIVE_ANNOTATION_NAME;
}
+ public int getUnknownTypeErrorMessageId() {
+ return CDIValidationErrorManager.UNKNOWN_ALTERNATIVE_ANNOTATION_NAME_ID;
+ }
+
public String getIllegalTypeErrorMessage() {
return CDIValidationMessages.ILLEGAL_ALTERNATIVE_ANNOTATION;
}
+ public int getIllegalTypeErrorMessageId() {
+ return CDIValidationErrorManager.ILLEGAL_ALTERNATIVE_ANNOTATION_ID;
+ }
+
public String getDuplicateTypeErrorMessage() {
return CDIValidationMessages.DUPLICATE_ALTERNATIVE_TYPE;
}
@@ -500,11 +520,19 @@
public String getUnknownTypeErrorMessage() {
return CDIValidationMessages.UNKNOWN_DECORATOR_BEAN_CLASS_NAME;
}
+
+ public int getUnknownTypeErrorMessageId() {
+ return CDIValidationErrorManager.UNKNOWN_DECORATOR_BEAN_CLASS_NAME_ID;
+ }
public String getIllegalTypeErrorMessage() {
return CDIValidationMessages.ILLEGAL_DECORATOR_BEAN_CLASS;
}
+ public int getIllegalTypeErrorMessageId() {
+ return CDIValidationErrorManager.ILLEGAL_DECORATOR_BEAN_CLASS_ID;
+ }
+
public String getDuplicateTypeErrorMessage() {
return CDIValidationMessages.DUPLICATE_DECORATOR_CLASS;
}
@@ -529,11 +557,19 @@
public String getUnknownTypeErrorMessage() {
return CDIValidationMessages.UNKNOWN_INTERCEPTOR_CLASS_NAME;
}
+
+ public int getUnknownTypeErrorMessageId() {
+ return CDIValidationErrorManager.UNKNOWN_INTERCEPTOR_CLASS_NAME_ID;
+ }
public String getIllegalTypeErrorMessage() {
return CDIValidationMessages.ILLEGAL_INTERCEPTOR_CLASS;
}
+ public int getIllegalTypeErrorMessageId() {
+ return CDIValidationErrorManager.ILLEGAL_INTERCEPTOR_CLASS_ID;
+ }
+
public String getDuplicateTypeErrorMessage() {
return CDIValidationMessages.DUPLICATE_INTERCEPTOR_CLASS;
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2011-10-05
23:51:50 UTC (rev 35406)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2011-10-05
23:54:27 UTC (rev 35407)
@@ -61,6 +61,14 @@
public static final int OBSERVER_IN_INTERCEPTOR_ID = 40;
public static final int SESSION_BEAN_ANNOTATED_INTERCEPTOR_ID = 41;
public static final int SESSION_BEAN_ANNOTATED_DECORATOR_ID = 42;
+ public static final int UNKNOWN_ALTERNATIVE_BEAN_CLASS_NAME_ID = 43;
+ public static final int UNKNOWN_ALTERNATIVE_ANNOTATION_NAME_ID = 44;
+ public static final int ILLEGAL_ALTERNATIVE_BEAN_CLASS_ID = 45;
+ public static final int ILLEGAL_ALTERNATIVE_ANNOTATION_ID = 46;
+ public static final int UNKNOWN_DECORATOR_BEAN_CLASS_NAME_ID = 47;
+ public static final int UNKNOWN_INTERCEPTOR_CLASS_NAME_ID = 48;
+ public static final int ILLEGAL_DECORATOR_BEAN_CLASS_ID = 49;
+ public static final int ILLEGAL_INTERCEPTOR_CLASS_ID = 50;
/*