public BrowseApplication() {
    links = new LinkedList<MenuLink>();

    eventTypes = new LinkedList<String>();
    eventTypes.add("filechangeset");

    updater.setApplication(this);
    Manager.getInstance().addProjectListener(updater);
  }
示例#2
0
  public void layout() {
    super.layout();

    add(CSSPackageResource.getHeaderContribution(getClass(), "change.css"));

    Project project = getProject();
    String id = getPageParameters().getString("id");

    if (project == null) {
      notFoundError();
      return;
    }

    String prefix = "";
    Project root = getProject();
    File searchDir = getStorage().getWorkingDirectory(getProject());
    while (root.getParent() != null) {
      prefix = searchDir.getName() + File.separatorChar + prefix;
      root = root.getParent();
      searchDir = searchDir.getParentFile();
    }
    final String stripPrefix = prefix;

    ChangeSet changeSet = Manager.getInstance().getScmService().getChangeSet(root, id);
    if (changeSet == null) {
      notFoundError();
      return;
    }

    revision = changeSet.getId();
    ((HibernateRequestCycle) getRequestCycle()).getHibernateSession().refresh(changeSet);

    if (changeSet.getPrevious() != null) {
      PageParameters params = getProjectPageParameters();
      params.add("id", changeSet.getPrevious().getId());

      addLink(new BookmarkableMenuLink(getClass(), params, "\u25c0 previous changeset"));
    }
    if (changeSet.getNext() != null) {
      PageParameters params = getProjectPageParameters();
      params.add("id", changeSet.getNext().getId());

      addLink(new BookmarkableMenuLink(getClass(), params, "\u25ba next changeset"));
    }

    add(new ChangeSetPanel("changeset", changeSet, stripPrefix));
  }