コード例 #1
0
  @Override
  public void removeRepository(IPapyrusRepository repository) {
    if (repository.isConnected()) {
      throw new IllegalArgumentException("repository is still connected"); // $NON-NLS-1$
    }

    repositories.remove(repository.getURL());
    EcoreUtil.delete(((PapyrusRepository) repository).getModel());

    fireElementRemovedEvent(repository);
  }
コード例 #2
0
  @Override
  public void setURL(IPapyrusRepository repository, String url) {
    if (!Objects.equal(repository.getURL(), url)) {
      if (getRepository(url) != null) {
        throw new IllegalArgumentException("repository already exists"); // $NON-NLS-1$
      }

      if (repository.isConnected()) {
        throw new IllegalStateException("repository is connected"); // $NON-NLS-1$
      }

      PapyrusRepository internalRepository = (PapyrusRepository) repository;
      repositories.remove(internalRepository.getURL());
      internalRepository.getModel().setURL(url);
      repositories.put(url, internalRepository);
    }
  }