Esempio n. 1
0
 /** Cleans empty projects. */
 private void cleanJavaProjects() {
   for (JavaProject jproj : cache.values()) {
     if (jproj.getJavaFiles().size() == 0) {
       cache.remove(jproj.getName());
     }
   }
 }
Esempio n. 2
0
  /** Removes every information about this project stored in the cache. */
  public static void removeAllCache() {
    for (JavaProject jproj : cache.values()) {
      jproj.getJavaPackages().clear();
    }
    cache.clear();

    JavaClass.removeAllClassesInCache();
  }
Esempio n. 3
0
  /**
   * Tests if a given package equals to this.
   *
   * @param jproj the Java project
   * @return <code>true</code> if the given package equals to this, otherwise <code>false</code>
   */
  public boolean equals(JavaProject jproj) {
    if (jproj == null) {
      return false;
    }

    if (this == jproj) {
      return true;
    }

    return getTopDir().compareTo(jproj.getTopDir()) == 0;
  }
Esempio n. 4
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;
  }