Example usage for org.eclipse.jdt.core ILocalVariable getUnderlyingResource

List of usage examples for org.eclipse.jdt.core ILocalVariable getUnderlyingResource

Introduction

In this page you can find the example usage for org.eclipse.jdt.core ILocalVariable getUnderlyingResource.

Prototype

IResource getUnderlyingResource() throws JavaModelException;

Source Link

Document

Returns the smallest underlying resource that contains this element, or null if this element is not contained in a resource.

Usage

From source file:org.jboss.tools.cdi.ui.marker.CDIProblemMarkerResolutionGenerator.java

License:Open Source License

private IQuickFix[] findJavaResolutions(ICompilationUnit compilationUnit, int problemId, int offset,
        ICDIMarkerResolutionGeneratorExtension[] extensions, boolean asYouType) throws JavaModelException {
    if (problemId == CDIValidationErrorManager.ILLEGAL_PRODUCER_FIELD_IN_SESSION_BEAN_ID) {
        IField field = findNonStaticField(compilationUnit, offset);
        if (field != null) {
            return new IQuickFix[] { new MakeFieldStaticMarkerResolution(field) };
        }/*  w w  w .j  a va2  s.c om*/
    } else if (problemId == CDIValidationErrorManager.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN_ID
            || problemId == CDIValidationErrorManager.ILLEGAL_DISPOSER_IN_SESSION_BEAN_ID
            || problemId == CDIValidationErrorManager.ILLEGAL_OBSERVER_IN_SESSION_BEAN_ID) {
        IMethod method = findMethod(compilationUnit, offset);
        if (method != null) {
            List<IType> types = findLocalAnnotattedInterfaces(method);
            if (types.size() == 0 && !Flags.isPublic(method.getFlags())) {
                return new IQuickFix[] { new MakeMethodPublicMarkerResolution(method) };
            } else {
                IQuickFix[] resolutions = new IQuickFix[types.size() + 1];
                for (int i = 0; i < types.size(); i++) {
                    resolutions[i] = new MakeMethodBusinessMarkerResolution(method, types.get(i));
                }
                resolutions[types.size()] = new AddLocalBeanMarkerResolution(method);
                return resolutions;
            }
        }
    } else if (problemId == CDIValidationErrorManager.MULTIPLE_DISPOSERS_FOR_PRODUCER_ID) {
        IMethod method = findMethod(compilationUnit, offset);
        if (method != null) {
            return new IQuickFix[] { new DeleteAllDisposerDuplicantMarkerResolution(method) };
        }
    } else if (problemId == CDIValidationErrorManager.MULTIPLE_INJECTION_CONSTRUCTORS_ID) {
        IMethod method = findMethod(compilationUnit, offset);
        if (method != null) {
            return new IQuickFix[] { new DeleteAllInjectedConstructorsMarkerResolution(method) };
        }
    } else if (problemId == CDIValidationErrorManager.AMBIGUOUS_INJECTION_POINTS_ID
            || problemId == CDIValidationErrorManager.UNSATISFIED_INJECTION_POINTS_ID) {

        List<IMarkerResolution> resolutions = new ArrayList<IMarkerResolution>();

        IInjectionPoint injectionPoint = findInjectionPoint(compilationUnit, offset, asYouType);
        if (injectionPoint != null) {
            List<IBean> beans;
            if (problemId == CDIValidationErrorManager.AMBIGUOUS_INJECTION_POINTS_ID) {
                beans = findBeans(injectionPoint);
            } else {
                beans = findLegalBeans(injectionPoint);
            }

            for (int i = beans.size() - 1; i >= 0; i--) {
                IBean bean = beans.get(i);
                for (ICDIMarkerResolutionGeneratorExtension extension : extensions) {
                    if (extension.shouldBeExtended(problemId, bean)) {
                        List<IQuickFix> addings = extension.getResolutions(problemId, bean);
                        resolutions.addAll(addings);
                        beans.remove(bean);
                        break;
                    }
                }
            }

            if (beans.size() < MARKER_RESULUTION_NUMBER_LIMIT) {
                for (int i = 0; i < beans.size(); i++) {
                    resolutions.add(new MakeInjectedPointUnambiguousMarkerResolution(injectionPoint, beans, i));
                }
            } else {
                resolutions.add(new SelectBeanMarkerResolution(injectionPoint, beans));
            }
        }
        return resolutions.toArray(new IQuickFix[] {});
    } else if (problemId == CDIValidationErrorManager.NOT_PASSIVATION_CAPABLE_BEAN_ID) {
        IType type = findTypeWithNoSerializable(compilationUnit, offset);

        if (type != null) {
            return new IQuickFix[] { new AddSerializableInterfaceMarkerResolution(type) };
        }
    } else if (problemId == CDIValidationErrorManager.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD_ID) {
        IField field = findPublicField(compilationUnit, offset);
        CDICoreNature cdiNature = CDIUtil.getCDINatureWithProgress(field.getUnderlyingResource().getProject());
        if (cdiNature != null) {
            ICDIProject cdiProject = CDIUtil.getCDIProject((IFile) compilationUnit.getUnderlyingResource(),
                    cdiNature, asYouType);

            if (cdiProject != null) {
                Collection<IBean> beans = cdiProject.getBeans(field.getUnderlyingResource().getFullPath());
                if (!beans.isEmpty()) {
                    IBean bean = beans.iterator().next();
                    if (field != null) {
                        return new IQuickFix[] { new MakeFieldProtectedMarkerResolution(field),
                                new MakeBeanScopedDependentMarkerResolution(compilationUnit, bean) };
                    }
                }
            }
        }
    } else if (problemId == CDIValidationErrorManager.MISSING_RETENTION_ANNOTATION_IN_QUALIFIER_TYPE_ID
            || problemId == CDIValidationErrorManager.MISSING_RETENTION_ANNOTATION_IN_SCOPE_TYPE_ID
            || problemId == CDIValidationErrorManager.MISSING_RETENTION_ANNOTATION_IN_STEREOTYPE_TYPE_ID) {

        TypeAndAnnotation ta = findTypeAndAnnotation(compilationUnit, offset,
                CDIConstants.RETENTION_ANNOTATION_TYPE_NAME);
        if (ta != null) {
            if (ta.annotation == null) {
                return new IQuickFix[] { new AddRetentionAnnotationMarkerResolution(ta.type) };
            } else {
                return new IQuickFix[] { new ChangeAnnotationMarkerResolution(ta.annotation,
                        CDIConstants.RETENTION_POLICY_RUNTIME_TYPE_NAME) };

            }
        }
    } else if (problemId == CDIValidationErrorManager.MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE_ID) {
        TypeAndAnnotation ta = findTypeAndAnnotation(compilationUnit, offset,
                CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
        if (ta != null) {
            if (ta.annotation == null) {
                return new IQuickFix[] { new AddTargetAnnotationMarkerResolution(ta.type,
                        new String[] { CDIConstants.ELEMENT_TYPE_TYPE_NAME,
                                CDIConstants.ELEMENT_TYPE_METHOD_NAME, CDIConstants.ELEMENT_TYPE_FIELD_NAME,
                                CDIConstants.ELEMENT_TYPE_PARAMETER_NAME }),
                        new AddTargetAnnotationMarkerResolution(ta.type,
                                new String[] { CDIConstants.ELEMENT_TYPE_FIELD_NAME,
                                        CDIConstants.ELEMENT_TYPE_PARAMETER_NAME }) };
            } else {
                return new IQuickFix[] { new ChangeAnnotationMarkerResolution(ta.annotation,
                        new String[] { CDIConstants.ELEMENT_TYPE_TYPE_NAME,
                                CDIConstants.ELEMENT_TYPE_METHOD_NAME, CDIConstants.ELEMENT_TYPE_FIELD_NAME,
                                CDIConstants.ELEMENT_TYPE_PARAMETER_NAME }),
                        new ChangeAnnotationMarkerResolution(ta.annotation,
                                new String[] { CDIConstants.ELEMENT_TYPE_FIELD_NAME,
                                        CDIConstants.ELEMENT_TYPE_PARAMETER_NAME }) };

            }
        }
    } else if (problemId == CDIValidationErrorManager.MISSING_TARGET_ANNOTATION_IN_STEREOTYPE_TYPE_ID) {
        TypeAndAnnotation ta = findTypeAndAnnotation(compilationUnit, offset,
                CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
        if (ta != null) {
            if (ta.annotation == null) {
                return new IQuickFix[] { new AddTargetAnnotationMarkerResolution(ta.type,
                        new String[] { CDIConstants.ELEMENT_TYPE_TYPE_NAME,
                                CDIConstants.ELEMENT_TYPE_METHOD_NAME, CDIConstants.ELEMENT_TYPE_FIELD_NAME }),
                        new AddTargetAnnotationMarkerResolution(ta.type,
                                new String[] { CDIConstants.ELEMENT_TYPE_METHOD_NAME,
                                        CDIConstants.ELEMENT_TYPE_FIELD_NAME }),
                        new AddTargetAnnotationMarkerResolution(ta.type,
                                new String[] { CDIConstants.ELEMENT_TYPE_TYPE_NAME }),
                        new AddTargetAnnotationMarkerResolution(ta.type,
                                new String[] { CDIConstants.ELEMENT_TYPE_METHOD_NAME }),
                        new AddTargetAnnotationMarkerResolution(ta.type,
                                new String[] { CDIConstants.ELEMENT_TYPE_FIELD_NAME }) };
            } else {
                return new IQuickFix[] { new ChangeAnnotationMarkerResolution(ta.annotation,
                        new String[] { CDIConstants.ELEMENT_TYPE_TYPE_NAME,
                                CDIConstants.ELEMENT_TYPE_METHOD_NAME, CDIConstants.ELEMENT_TYPE_FIELD_NAME }),
                        new ChangeAnnotationMarkerResolution(ta.annotation,
                                new String[] { CDIConstants.ELEMENT_TYPE_METHOD_NAME,
                                        CDIConstants.ELEMENT_TYPE_FIELD_NAME }),
                        new ChangeAnnotationMarkerResolution(ta.annotation,
                                new String[] { CDIConstants.ELEMENT_TYPE_TYPE_NAME }),
                        new ChangeAnnotationMarkerResolution(ta.annotation,
                                new String[] { CDIConstants.ELEMENT_TYPE_METHOD_NAME }),
                        new ChangeAnnotationMarkerResolution(ta.annotation,
                                new String[] { CDIConstants.ELEMENT_TYPE_FIELD_NAME }) };

            }
        }
    } else if (problemId == CDIValidationErrorManager.MISSING_TARGET_ANNOTATION_IN_SCOPE_TYPE_ID) {
        TypeAndAnnotation ta = findTypeAndAnnotation(compilationUnit, offset,
                CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
        if (ta != null) {
            if (ta.annotation == null) {
                return new IQuickFix[] { new AddTargetAnnotationMarkerResolution(ta.type,
                        new String[] { CDIConstants.ELEMENT_TYPE_TYPE_NAME,
                                CDIConstants.ELEMENT_TYPE_METHOD_NAME,
                                CDIConstants.ELEMENT_TYPE_FIELD_NAME }) };
            } else {
                return new IQuickFix[] { new ChangeAnnotationMarkerResolution(ta.annotation,
                        new String[] { CDIConstants.ELEMENT_TYPE_TYPE_NAME,
                                CDIConstants.ELEMENT_TYPE_METHOD_NAME,
                                CDIConstants.ELEMENT_TYPE_FIELD_NAME }) };

            }
        }
    } else if (problemId == CDIValidationErrorManager.MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER_ID
            || problemId == CDIValidationErrorManager.MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_QUALIFIER_TYPE_MEMBER_ID
            || problemId == CDIValidationErrorManager.MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER_ID
            || problemId == CDIValidationErrorManager.MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_QUALIFIER_TYPE_MEMBER_ID) {
        IJavaElement element = findJavaElement(compilationUnit, offset);
        if (element != null) {
            IAnnotation annotation = getAnnotation(element, CDIConstants.NON_BINDING_ANNOTATION_TYPE_NAME);
            if (element instanceof IMember && annotation == null) {
                return new IQuickFix[] { new AddAnnotationMarkerResolution((IMember) element,
                        CDIConstants.NON_BINDING_ANNOTATION_TYPE_NAME) };
            }
        }
    } else if (problemId == CDIValidationErrorManager.DISPOSER_ANNOTATED_INJECT_ID) {
        IJavaElement element = findJavaElement(compilationUnit, offset);
        if (element != null) {
            IJavaElement injectElement = findJavaElementByAnnotation(element,
                    CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
            IJavaElement disposesElement = findJavaElementByAnnotation(element,
                    CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
            if (injectElement != null && disposesElement != null) {
                return new IQuickFix[] {
                        new DeleteAnnotationMarkerResolution(injectElement,
                                CDIConstants.INJECT_ANNOTATION_TYPE_NAME),
                        new DeleteAnnotationMarkerResolution(disposesElement,
                                CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME) };
            }
        }
    } else if (problemId == CDIValidationErrorManager.PRODUCER_ANNOTATED_INJECT_ID) {
        IJavaElement element = findJavaElement(compilationUnit, offset);
        if (element != null) {
            IJavaElement injectElement = findJavaElementByAnnotation(element,
                    CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
            IJavaElement produsesElement = findJavaElementByAnnotation(element,
                    CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME);
            if (injectElement != null && produsesElement != null) {
                return new IQuickFix[] {
                        new DeleteAnnotationMarkerResolution(injectElement,
                                CDIConstants.INJECT_ANNOTATION_TYPE_NAME),
                        new DeleteAnnotationMarkerResolution(produsesElement,
                                CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME) };
            }
        }
    } else if (problemId == CDIValidationErrorManager.OBSERVER_ANNOTATED_INJECT_ID) {
        IJavaElement element = findJavaElement(compilationUnit, offset);
        if (element != null) {
            IJavaElement injectElement = findJavaElementByAnnotation(element,
                    CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
            IJavaElement observerElement = findJavaElementByAnnotation(element,
                    CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME);
            if (injectElement != null && observerElement != null) {
                return new IQuickFix[] {
                        new DeleteAnnotationMarkerResolution(injectElement,
                                CDIConstants.INJECT_ANNOTATION_TYPE_NAME),
                        new DeleteAnnotationMarkerResolution(observerElement,
                                CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME) };
            }
        }
    } else if (problemId == CDIValidationErrorManager.CONSTRUCTOR_PARAMETER_ANNOTATED_OBSERVES_ID) {
        IJavaElement element = findJavaElement(compilationUnit, offset);
        if (element != null) {
            IJavaElement observerElement = findJavaElementByAnnotation(element,
                    CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME);
            if (observerElement != null) {
                return new IQuickFix[] { new DeleteAnnotationMarkerResolution(observerElement,
                        CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME) };
            }
        }
    } else if (problemId == CDIValidationErrorManager.DISPOSER_IN_INTERCEPTOR_ID
            || problemId == CDIValidationErrorManager.DISPOSER_IN_DECORATOR_ID
            || problemId == CDIValidationErrorManager.CONSTRUCTOR_PARAMETER_ANNOTATED_DISPOSES_ID) {
        IJavaElement element = findJavaElement(compilationUnit, offset);
        if (element != null) {
            IJavaElement disposerElement = findJavaElementByAnnotation(element,
                    CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
            if (disposerElement != null) {
                return new IQuickFix[] { new DeleteAnnotationMarkerResolution(disposerElement,
                        CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME) };
            }
        }
    } else if (problemId == CDIValidationErrorManager.PRODUCER_IN_INTERCEPTOR_ID
            || problemId == CDIValidationErrorManager.PRODUCER_IN_DECORATOR_ID) {
        IJavaElement element = findJavaElement(compilationUnit, offset);
        if (element != null) {
            IJavaElement producerElement = findJavaElementByAnnotation(element,
                    CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME);
            if (producerElement != null) {
                return new IQuickFix[] { new DeleteAnnotationMarkerResolution(producerElement,
                        CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME) };
            }
        }
    } else if (problemId == CDIValidationErrorManager.STEREOTYPE_DECLARES_NON_EMPTY_NAME_ID) {
        TypeAndAnnotation ta = findTypeAndAnnotation(compilationUnit, offset,
                CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
        if (ta != null && ta.annotation != null && ta.type != null) {
            return new IQuickFix[] { new ChangeAnnotationMarkerResolution(ta.annotation),
                    new DeleteAnnotationMarkerResolution(ta.type, CDIConstants.NAMED_QUALIFIER_TYPE_NAME) };
        }
    } else if (problemId == CDIValidationErrorManager.INTERCEPTOR_HAS_NAME_ID
            || problemId == CDIValidationErrorManager.DECORATOR_HAS_NAME_ID) {
        TypeAndAnnotation ta = findTypeAndAnnotation(compilationUnit, offset,
                CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
        if (ta != null && ta.type != null) {
            CDICoreNature cdiNature = CDIUtil
                    .getCDINatureWithProgress(ta.type.getUnderlyingResource().getProject());
            if (cdiNature != null) {
                ICDIProject cdiProject = CDIUtil.getCDIProject((IFile) compilationUnit.getUnderlyingResource(),
                        cdiNature, asYouType);
                ;
                IType declarationType = findNamedDeclarationType(cdiProject, ta.type,
                        problemId == CDIValidationErrorManager.DECORATOR_HAS_NAME_ID);
                ArrayList<IMarkerResolution> resolutions = new ArrayList<IMarkerResolution>();
                if (declarationType != null) {
                    IAnnotation annotation = getAnnotation(declarationType,
                            CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
                    if (annotation != null) {
                        resolutions.add(new DeleteAnnotationMarkerResolution(declarationType,
                                CDIConstants.NAMED_QUALIFIER_TYPE_NAME));
                    }

                    if (!declarationType.equals(ta.type)) {
                        annotation = getAnnotation(ta.type, declarationType.getFullyQualifiedName());
                        if (annotation != null) {
                            resolutions.add(new DeleteAnnotationMarkerResolution(ta.type,
                                    declarationType.getFullyQualifiedName()));
                        }
                    }
                }
                if (!resolutions.isEmpty()) {
                    return resolutions.toArray(new IQuickFix[] {});
                }
            }
        }
    } else if (problemId == CDIValidationErrorManager.STEREOTYPE_IS_ANNOTATED_TYPED_ID) {
        TypeAndAnnotation ta = findTypeAndAnnotation(compilationUnit, offset,
                CDIConstants.TYPED_ANNOTATION_TYPE_NAME);
        if (ta != null && ta.annotation != null && ta.type != null) {
            return new IQuickFix[] {
                    new DeleteAnnotationMarkerResolution(ta.type, CDIConstants.TYPED_ANNOTATION_TYPE_NAME) };
        }
    } else if (problemId == CDIValidationErrorManager.INTERCEPTOR_ANNOTATED_SPECIALIZES_ID
            || problemId == CDIValidationErrorManager.DECORATOR_ANNOTATED_SPECIALIZES_ID) {
        TypeAndAnnotation ta = findTypeAndAnnotation(compilationUnit, offset,
                CDIConstants.SPECIALIZES_ANNOTATION_TYPE_NAME);
        if (ta != null && ta.annotation != null && ta.type != null) {
            return new IQuickFix[] { new DeleteAnnotationMarkerResolution(ta.type,
                    CDIConstants.SPECIALIZES_ANNOTATION_TYPE_NAME) };
        }
    } else if (problemId == CDIValidationErrorManager.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_DISPOSES_ID) {
        IJavaElement element = findJavaElement(compilationUnit, offset);
        if (element != null) {
            IJavaElement producerElement = findJavaElementByAnnotation(element,
                    CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME);
            IJavaElement disposerElement = findJavaElementByAnnotation(element,
                    CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
            if (producerElement != null && disposerElement != null) {
                return new IQuickFix[] {
                        new DeleteAnnotationMarkerResolution(producerElement,
                                CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME),
                        new DeleteAnnotationMarkerResolution(disposerElement,
                                CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME) };
            }
        }
    } else if (problemId == CDIValidationErrorManager.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_OBSERVES_ID) {
        IJavaElement element = findJavaElement(compilationUnit, offset);
        if (element != null) {
            IJavaElement producerElement = findJavaElementByAnnotation(element,
                    CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME);
            IJavaElement observerElement = findJavaElementByAnnotation(element,
                    CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME);
            if (producerElement != null && observerElement != null) {
                return new IQuickFix[] {
                        new DeleteAnnotationMarkerResolution(producerElement,
                                CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME),
                        new DeleteAnnotationMarkerResolution(observerElement,
                                CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME) };
            }
        }
    } else if (problemId == CDIValidationErrorManager.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED_ID) {
        IJavaElement element = findJavaElement(compilationUnit, offset);
        if (element != null) {
            IJavaElement disposerElement = findJavaElementByAnnotation(element,
                    CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
            IJavaElement observerElement = findJavaElementByAnnotation(element,
                    CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME);
            if (disposerElement != null && observerElement != null) {
                return new IQuickFix[] {
                        new DeleteAnnotationMarkerResolution(disposerElement,
                                CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME),
                        new DeleteAnnotationMarkerResolution(observerElement,
                                CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME) };
            }
        }
    } else if (problemId == CDIValidationErrorManager.OBSERVER_IN_DECORATOR_ID
            || problemId == CDIValidationErrorManager.OBSERVER_IN_INTERCEPTOR_ID) {
        IJavaElement element = findJavaElement(compilationUnit, offset);
        if (element != null) {
            IJavaElement observerElement = findJavaElementByAnnotation(element,
                    CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME);
            if (observerElement != null) {
                return new IQuickFix[] { new DeleteAnnotationMarkerResolution(observerElement,
                        CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME) };
            }
        }
    } else if (problemId == CDIValidationErrorManager.SESSION_BEAN_ANNOTATED_INTERCEPTOR_ID) {
        IJavaElement element = findJavaElement(compilationUnit, offset);
        if (element != null) {
            IJavaElement interceptorElement = findJavaElementByAnnotation(element,
                    CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME);
            if (interceptorElement != null) {
                return new IQuickFix[] { new DeleteAnnotationMarkerResolution(interceptorElement,
                        CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME) };
            }
        }
    } else if (problemId == CDIValidationErrorManager.SESSION_BEAN_ANNOTATED_DECORATOR_ID) {
        IJavaElement element = findJavaElement(compilationUnit, offset);
        if (element != null) {
            IJavaElement decoratorElement = findJavaElementByAnnotation(element,
                    CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME);
            if (decoratorElement != null) {
                return new IQuickFix[] { new DeleteAnnotationMarkerResolution(decoratorElement,
                        CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME) };
            }
        }
    } else if (problemId == CDIValidationErrorManager.PARAM_INJECTION_DECLARES_EMPTY_NAME_ID) {
        List<IMarkerResolution> resolutions = getAddNameResolutions(compilationUnit, offset, asYouType);
        return resolutions.toArray(new IQuickFix[] {});
    } else if (problemId == CDIValidationErrorManager.MULTIPLE_DISPOSING_PARAMETERS_ID) {
        ILocalVariable parameter = findParameter(compilationUnit, offset);
        if (parameter != null) {
            return new IQuickFix[] { new DeleteAllOtherAnnotationsFromParametersMarkerResolution(
                    CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME, parameter,
                    (IFile) parameter.getUnderlyingResource()) };
        }
    } else if (problemId == CDIValidationErrorManager.MULTIPLE_OBSERVING_PARAMETERS_ID) {
        ILocalVariable parameter = findParameter(compilationUnit, offset);
        if (parameter != null) {
            return new IQuickFix[] { new DeleteAllOtherAnnotationsFromParametersMarkerResolution(
                    CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME, parameter,
                    (IFile) parameter.getUnderlyingResource()) };
        }
    }
    return new IQuickFix[] {};
}