private void possibleStaticImportFound(Name name) {
    if (fStaticImports == null || fASTRoot == null) {
      return;
    }

    while (name.isQualifiedName()) {
      name = ((QualifiedName) name).getQualifier();
    }
    if (!isAffected(name)) {
      return;
    }

    IBinding binding = name.resolveBinding();
    SimpleName simpleName = (SimpleName) name;
    if (binding == null
        || binding instanceof ITypeBinding
        || !Modifier.isStatic(binding.getModifiers())
        || simpleName.isDeclaration()) {
      return;
    }

    if (binding instanceof IVariableBinding) {
      IVariableBinding varBinding = (IVariableBinding) binding;
      if (varBinding.isField()) {
        varBinding = varBinding.getVariableDeclaration();
        ITypeBinding declaringClass = varBinding.getDeclaringClass();
        if (declaringClass != null && !declaringClass.isLocal()) {
          if (new ScopeAnalyzer(fASTRoot)
              .isDeclaredInScope(
                  varBinding, simpleName, ScopeAnalyzer.VARIABLES | ScopeAnalyzer.CHECK_VISIBILITY))
            return;
          fStaticImports.add(simpleName);
        }
      }
    } else if (binding instanceof IMethodBinding) {
      IMethodBinding methodBinding = ((IMethodBinding) binding).getMethodDeclaration();
      ITypeBinding declaringClass = methodBinding.getDeclaringClass();
      if (declaringClass != null && !declaringClass.isLocal()) {
        if (new ScopeAnalyzer(fASTRoot)
            .isDeclaredInScope(
                methodBinding, simpleName, ScopeAnalyzer.METHODS | ScopeAnalyzer.CHECK_VISIBILITY))
          return;
        fStaticImports.add(simpleName);
      }
    }
  }
Exemple #2
0
 public static boolean isAbstract(IBinding binding) {
   return Modifier.isAbstract(binding.getModifiers());
 }
Exemple #3
0
 public static boolean isPrivate(IBinding binding) {
   return Modifier.isPrivate(binding.getModifiers());
 }
Exemple #4
0
 public static boolean isFinal(IBinding binding) {
   return Modifier.isFinal(binding.getModifiers());
 }
Exemple #5
0
 public static boolean isSynchronized(IBinding binding) {
   return Modifier.isSynchronized(binding.getModifiers());
 }