Beispiel #1
0
  /**
   * FIXME module editing is generally done through descriptor and reload. Although I do not mind
   * exposing add/remove methods here, it should be consistent!
   */
  @Nullable
  public Dependency addDependency(@NotNull SModuleReference moduleRef, boolean reexport) {
    assertCanChange();
    ModuleDescriptor descriptor = getModuleDescriptor();
    if (descriptor == null) {
      return null;
    }
    for (Dependency dep : descriptor.getDependencies()) {
      if (!EqualUtil.equals(dep.getModuleRef(), moduleRef)) {
        continue;
      }

      if (reexport && !dep.isReexport()) {
        dep.setReexport(true);
        dependenciesChanged();
        fireChanged();
        setChanged();
      }
      return dep;
    }

    Dependency dep = new Dependency();
    dep.setModuleRef(moduleRef);
    dep.setReexport(reexport);
    descriptor.getDependencies().add(dep);

    dependenciesChanged();
    fireChanged();
    setChanged();
    return dep;
  }
Beispiel #2
0
 // todo should be replaced with events
 public final void setModuleDescriptor(ModuleDescriptor moduleDescriptor) {
   assertCanChange();
   doSetModuleDescriptor(moduleDescriptor);
   setChanged();
   reloadAfterDescriptorChange();
   fireChanged();
   dependenciesChanged();
 }
Beispiel #3
0
  public void removeDependency(@NotNull Dependency dependency) {
    assertCanChange();
    ModuleDescriptor descriptor = getModuleDescriptor();
    if (descriptor == null) {
      return;
    }
    if (!descriptor.getDependencies().contains(dependency)) {
      return;
    }

    descriptor.getDependencies().remove(dependency);

    dependenciesChanged();
    fireChanged();
    setChanged();
  }
 @Override
 protected void dependenciesChanged() {
   super.dependenciesChanged();
   if (!willLoad()) return;
   fireDependenciesChanged();
 }