Ejemplo n.º 1
0
  /**
   * Tests if the used type is contained in the project containing the type use.
   *
   * @param tbinding the type binding of the type use
   * @return <code>true</code> if the used type is contained in the project, otherwise <code>false
   *     </code>
   */
  private boolean isInProject(ITypeBinding tbinding) {
    IJavaProject project = jproject.getJavaProject();
    if (project == null) {
      return true;
    }

    try {
      IType type = project.findType(tbinding.getQualifiedName());
      if (type != null) {
        String pdir = project.getPath().toString();
        String tname = type.getPath().toString();
        return pdir != null && tname != null && tname.startsWith(pdir);
      }
    } catch (JavaModelException e) {
      return false;
    }
    return false;
  }