Author: scabanovich
Date: 2011-08-17 19:54:09 -0400 (Wed, 17 Aug 2011)
New Revision: 34027
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorBindingWizardPage.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewStereotypeWizardPage.java
Log:
JBIDE-6517
https://issues.jboss.org/browse/JBIDE-6517
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorBindingWizardPage.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorBindingWizardPage.java 2011-08-17
23:50:54 UTC (rev 34026)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorBindingWizardPage.java 2011-08-17
23:54:09 UTC (rev 34027)
@@ -29,6 +29,7 @@
import org.jboss.tools.cdi.core.ICDIAnnotation;
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IInterceptorBinding;
+import org.jboss.tools.cdi.internal.core.validation.AnnotationValidationDelegate;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.common.java.IAnnotationDeclaration;
@@ -158,7 +159,7 @@
targetStatus = new StatusInfo();
if(interceptorBindings != null && target != null) {
String value = (String)target.getValue();
- boolean hasMethodOrField = value != null && (value.indexOf("METHOD")
>= 0 || value.indexOf("FIELD") >= 0);
+ boolean hasMethodOrField = value != null &&
(value.indexOf(AnnotationValidationDelegate.TARGET_METHOD) >= 0 ||
value.indexOf(AnnotationValidationDelegate.TARGET_FIELD) >= 0);
List list = (List)interceptorBindings.getValue();
for (Object o: list) {
if(o instanceof IInterceptorBinding) {
@@ -166,7 +167,7 @@
IAnnotationDeclaration target =
a.getAnnotationDeclaration(CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
if(target != null) {
Set<String> targets = CDIUtil.getTargetAnnotationValues(target);
- if(targets != null && targets.size() == 1 &&
targets.contains("TYPE") && hasMethodOrField) {
+ if(targets != null && targets.size() == 1 &&
targets.contains(AnnotationValidationDelegate.TARGET_TYPE) && hasMethodOrField) {
String message =
NLS.bind(CDIUIMessages.MESSAGE_INTERCEPTOR_BINDING_IS_NOT_COMPATIBLE,
a.getSourceType().getElementName());
// String message = a.getSourceType().getElementName() + " annotated with
@Target({TYPE}) is not compatible with target";
targetStatus.setWarning(message);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewStereotypeWizardPage.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewStereotypeWizardPage.java 2011-08-17
23:50:54 UTC (rev 34026)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewStereotypeWizardPage.java 2011-08-17
23:54:09 UTC (rev 34027)
@@ -204,7 +204,7 @@
public void propertyChange(PropertyChangeEvent evt) {
Object o = evt.getNewValue();
if(o instanceof List && !((List)o).isEmpty()) {
- target.setValue("TYPE");
+ target.setValue(AnnotationValidationDelegate.TARGET_TYPE);
target.setEnabled(false);
} else {
target.setEnabled(true);
@@ -320,7 +320,7 @@
targetStatus = new StatusInfo();
if(stereotypes != null && target != null) {
String value = (String)target.getValue();
- boolean hasMethodOrField = value != null && (value.indexOf("METHOD")
>= 0 || value.indexOf("FIELD") >= 0);
+ boolean hasMethodOrField = value != null &&
(value.indexOf(AnnotationValidationDelegate.TARGET_METHOD) >= 0 ||
value.indexOf(AnnotationValidationDelegate.TARGET_FIELD) >= 0);
List list = (List)stereotypes.getValue();
for (Object o: list) {
if(o instanceof IStereotype) {
@@ -328,12 +328,12 @@
IAnnotationDeclaration target =
a.getAnnotationDeclaration(CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
if(target != null) {
Set<String> targets = CDIUtil.getTargetAnnotationValues(target);
- if(targets != null && targets.size() == 1 &&
targets.contains("TYPE") && hasMethodOrField) {
+ if(targets != null && targets.size() == 1 &&
targets.contains(AnnotationValidationDelegate.TARGET_TYPE) && hasMethodOrField) {
String message = NLS.bind(CDIUIMessages.MESSAGE_STEREOTYPE_IS_NOT_COMPATIBLE,
a.getSourceType().getElementName());
// String message = a.getSourceType().getElementName() + " annotated with
@Target({TYPE}) is not compatible with target";
targetStatus.setWarning(message);
}
- if(targets != null && !targets.contains("TYPE")) {
+ if(targets != null &&
!targets.contains(AnnotationValidationDelegate.TARGET_TYPE)) {
String message =
NLS.bind(CDIUIMessages.MESSAGE_STEREOTYPE_CANNOT_BE_APPLIED_TO_TYPE,
a.getSourceType().getElementName());
targetStatus.setError(message);
return;