コード例 #1
0
      @Override
      protected void setCurrentUrl(DownloadUrlLink link) {
        widget.setVisible(true);

        String sshPort = "29418";
        String sshAddr = Gerrit.getConfig().getSshdAddress();
        int p = sshAddr.lastIndexOf(':');
        if (p != -1 && !sshAddr.endsWith(":")) {
          sshPort = sshAddr.substring(p + 1);
        }

        StringBuilder cmd = new StringBuilder();
        cmd.append("git clone ");
        cmd.append(link.getUrlData());
        cmd.append(" && scp -p -P ");
        cmd.append(sshPort);
        cmd.append(" ");
        cmd.append(Gerrit.getUserAccount().getUserName());
        cmd.append("@");

        if (sshAddr.startsWith("*:") || p == -1) {
          cmd.append(Window.Location.getHostName());
        } else {
          cmd.append(sshAddr.substring(0, p));
        }

        cmd.append(":hooks/commit-msg ");

        p = project.get().lastIndexOf('/');
        if (p != -1) {
          cmd.append(project.get().substring(p + 1));
        } else {
          cmd.append(project.get());
        }

        cmd.append("/.git/hooks/");

        copyLabel.setText(cmd.toString());
      }
コード例 #2
0
  @Override
  public void onClick(ClickEvent event) {
    event.preventDefault();
    event.stopPropagation();

    select();

    if (Gerrit.isSignedIn()) {
      // If the user is signed-in, remember this choice for future panels.
      //
      AccountGeneralPreferences pref = Gerrit.getUserAccount().getGeneralPreferences();
      pref.setDownloadCommand(cmdType);
      com.google.gerrit.client.account.Util.ACCOUNT_SVC.changePreferences(
          pref,
          new AsyncCallback<VoidResult>() {
            @Override
            public void onFailure(Throwable caught) {}

            @Override
            public void onSuccess(VoidResult result) {}
          });
    }
  }
コード例 #3
0
  private void display(JsArray<ChangeList> result) {
    if (!mine && !hasChanges(result)) {
      // When no results are returned and the data is not for the
      // current user, the target user is presumed to not exist.
      Gerrit.display(getToken(), new NotFoundScreen());
      return;
    }

    ChangeList out = result.get(0);
    ChangeList in = result.get(1);
    ChangeList done = result.get(2);

    if (mine) {
      setWindowTitle(Util.C.myDashboardTitle());
      setPageTitle(Util.C.myDashboardTitle());
    } else {
      // The server doesn't tell us who the dashboard is for. Try to guess
      // by looking at a change started by the owner and extract the name.
      String name = guessName(out);
      if (name == null) {
        name = guessName(done);
      }
      if (name != null) {
        setWindowTitle(name);
        setPageTitle(Util.M.accountDashboardTitle(name));
      } else {
        setWindowTitle(Util.C.unknownDashboardTitle());
        setWindowTitle(Util.C.unknownDashboardTitle());
      }
    }

    Collections.sort(Natives.asList(out), outComparator());

    table.updateColumnsForLabels(out, in, done);
    outgoing.display(out);
    incoming.display(in);
    closed.display(done);
    table.finishDisplay();
  }
コード例 #4
0
 /**
  * Create a star icon for the given change, and current status. Returns null if the user is not
  * signed in and cannot support starred changes.
  */
 public static Icon createIcon(Change.Id source, boolean starred) {
   return Gerrit.isSignedIn() ? new Icon(source, starred) : null;
 }
コード例 #5
0
 public AccountDashboardScreen(final Account.Id id) {
   ownerId = id;
   mine = Gerrit.isSignedIn() && ownerId.equals(Gerrit.getUserAccount().getId());
 }
コード例 #6
0
ファイル: PatchSetsBox.java プロジェクト: web1992/gerrit
 private void onOpenRow(int idx) {
   closeParent();
   Gerrit.display(url(revisions.get(idx)));
 }