コード例 #1
0
  /**
   * Allows to answer if target library dependency is still available at the target project.
   *
   * @param id target library id
   * @return <code>true</code> if target library dependency is still available at the target
   *     project; <code>false</code> otherwise
   */
  public boolean isIntellijLibraryDependencyExist(@NotNull final GradleLibraryDependencyId id) {
    final Module module = findIntellijModuleByName(id.getModuleName());
    if (module == null) {
      return false;
    }

    RootPolicy<Boolean> visitor =
        new RootPolicy<Boolean>() {
          @Override
          public Boolean visitLibraryOrderEntry(
              LibraryOrderEntry libraryOrderEntry, Boolean value) {
            return id.getLibraryName().equals(libraryOrderEntry.getLibraryName());
          }
        };
    for (OrderEntry entry : myFacade.getOrderEntries(module)) {
      if (entry.accept(visitor, false)) {
        return true;
      }
    }
    return false;
  }
コード例 #2
0
 public void addDependency(@NotNull final OrderEntry e) {
   if (!DependenciesFilter.REMOVABLE_DEPENDENCY.apply(e)) return;
   e.accept(ADD, null);
 }
コード例 #3
0
 public boolean contains(@Nullable final OrderEntry e) {
   if (e == null) return false;
   return e.accept(CONTAINS, false);
 }