/*
  * (non-Javadoc)
  * @see
  * org.eclipse.pde.api.tools.internal.search.AbstractProblemDetector#isProblem
  * (org.eclipse.pde.api.tools.internal.provisional.model.IReference)
  */
 @Override
 protected boolean isProblem(IReference reference) {
   // the reference must be in the system library
   try {
     IApiMember member = reference.getMember();
     IApiComponent apiComponent = member.getApiComponent();
     String[] lowestEEs = apiComponent.getLowestEEs();
     if (lowestEEs == null) {
       // this should not be true for Eclipse bundle as they should
       // always have a EE set
       return false;
     }
     loop:
     for (int i = 0, max = lowestEEs.length; i < max; i++) {
       String lowestEE = lowestEEs[i];
       int eeValue = ProfileModifiers.getValue(lowestEE);
       if (eeValue == ProfileModifiers.NO_PROFILE_VALUE) {
         return false;
       }
       if (!((Reference) reference).resolve(eeValue)) {
         /*
          * Make sure that the resolved reference doesn't below to
          * one of the imported package of the current component
          */
         if (apiComponent instanceof BundleComponent) {
           BundleDescription bundle = ((BundleComponent) apiComponent).getBundleDescription();
           ImportPackageSpecification[] importPackages = bundle.getImportPackages();
           String referencedTypeName = reference.getReferencedTypeName();
           int index = referencedTypeName.lastIndexOf('.');
           String packageName = referencedTypeName.substring(0, index);
           for (int j = 0, max2 = importPackages.length; j < max2; j++) {
             ImportPackageSpecification importPackageSpecification = importPackages[j];
             // get the IPackageDescriptor for the element
             // descriptor
             String importPackageName = importPackageSpecification.getName();
             if (importPackageName.equals(packageName)) {
               continue loop;
             }
           }
         }
         if (this.referenceEEs == null) {
           this.referenceEEs = new HashMap<IReference, Integer>(3);
         }
         this.referenceEEs.put(reference, new Integer(eeValue));
         return true;
       }
     }
   } catch (CoreException e) {
     ApiPlugin.log(e);
   }
   return false;
 }
 /*
  * (non-Javadoc)
  * @see org.eclipse.pde.api.tools.internal.builder.AbstractProblemDetector#
  * getMessageArgs
  * (org.eclipse.pde.api.tools.internal.provisional.builder.IReference)
  */
 @Override
 protected String[] getMessageArgs(IReference reference) throws CoreException {
   IApiMember member = reference.getMember();
   String eeValue = ProfileModifiers.getName(this.referenceEEs.get(reference).intValue());
   String simpleTypeName = Signatures.getSimpleTypeName(reference.getReferencedTypeName());
   if (simpleTypeName.indexOf('$') != -1) {
     simpleTypeName = simpleTypeName.replace('$', '.');
   }
   switch (reference.getReferenceType()) {
     case IReference.T_TYPE_REFERENCE:
       {
         return new String[] {
           getDisplay(member, false), simpleTypeName, eeValue,
         };
       }
     case IReference.T_FIELD_REFERENCE:
       {
         return new String[] {
           getDisplay(member, false), simpleTypeName,
           reference.getReferencedMemberName(), eeValue,
         };
       }
     case IReference.T_METHOD_REFERENCE:
       {
         String referenceMemberName = reference.getReferencedMemberName();
         if (Util.isConstructor(referenceMemberName)) {
           return new String[] {
             getDisplay(member, false),
             Signature.toString(
                 reference.getReferencedSignature(), simpleTypeName, null, false, false),
             eeValue,
           };
         } else {
           return new String[] {
             getDisplay(member, false),
             simpleTypeName,
             Signature.toString(
                 reference.getReferencedSignature(), referenceMemberName, null, false, false),
             eeValue,
           };
         }
       }
     default:
       break;
   }
   return null;
 }