private void changeFormat(
      @NotNull final WCInfo wcInfo, @NotNull final Collection<WorkingCopyFormat> supportedFormats) {
    ChangeFormatDialog dialog =
        new ChangeFormatDialog(myProject, new File(wcInfo.getPath()), false, !wcInfo.isIsWcRoot());

    dialog.setSupported(supportedFormats);
    dialog.setData(wcInfo.getFormat());
    dialog.show();
    if (!dialog.isOK()) {
      return;
    }
    final WorkingCopyFormat newFormat = dialog.getUpgradeMode();
    if (!wcInfo.getFormat().equals(newFormat)) {
      ApplicationManager.getApplication().saveAll();
      final Task.Backgroundable task =
          new SvnFormatWorker(myProject, newFormat, wcInfo) {
            @Override
            public void onSuccess() {
              super.onSuccess();
              myRefreshLabel.doClick();
            }
          };
      ProgressManager.getInstance().run(task);
    }
  }
Exemplo n.º 2
0
 private void changeFormat(final WCInfo wcInfo) {
   ChangeFormatDialog dialog =
       new ChangeFormatDialog(myProject, new File(wcInfo.getPath()), false, !wcInfo.isIsWcRoot());
   dialog.setData(true, wcInfo.getFormat().getOption());
   dialog.show();
   if (!dialog.isOK()) {
     return;
   }
   final String newMode = dialog.getUpgradeMode();
   if (!wcInfo.getFormat().getOption().equals(newMode)) {
     final WorkingCopyFormat newFormat = WorkingCopyFormat.getInstance(newMode);
     final Task.Backgroundable task =
         new SvnFormatWorker(myProject, newFormat, wcInfo) {
           @Override
           public void onSuccess() {
             super.onSuccess();
             myRefreshLabel.doClick();
           }
         };
     ProgressManager.getInstance().run(task);
   }
 }
Exemplo n.º 3
0
  private String formatWc(WCInfo info) {
    final StringBuilder sb =
        new StringBuilder()
            .append("<html><head>")
            .append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont()))
            .append("</head><body><table bgColor=\"")
            .append(ColorUtil.toHex(UIUtil.getPanelBackground()))
            .append("\">");

    sb.append("<tr valign=\"top\"><td colspan=\"3\"><b>")
        .append(info.getPath())
        .append("</b></td></tr>");
    sb.append("<tr valign=\"top\"><td>URL:</td><td colspan=\"2\">")
        .append(info.getRootUrl())
        .append("</td></tr>");
    if (!WorkingCopyFormat.ONE_DOT_SEVEN.equals(info.getFormat())) {
      // can convert
      sb.append("<tr valign=\"top\"><td>Format:</td><td>")
          .append(info.getFormat().getName())
          .append("</td><td><a href=\"")
          .append(CHANGE_FORMAT)
          .append("\">Change</a></td></tr>");
    } else {
      sb.append("<tr valign=\"top\"><td>Format:</td><td colspan=\"2\">")
          .append(info.getFormat().getName())
          .append("</td></tr>");
    }

    if (!SVNDepth.INFINITY.equals(info.getStickyDepth())) {
      // can fix
      sb.append("<tr valign=\"top\"><td>Depth:</td><td>")
          .append(info.getStickyDepth().getName())
          .append("</td><td><a href=\"")
          .append(FIX_DEPTH)
          .append("\">Fix</a></td></tr>");
    } else {
      sb.append("<tr valign=\"top\"><td>Depth:</td><td colspan=\"2\">")
          .append(info.getStickyDepth().getName())
          .append("</td></tr>");
    }

    final NestedCopyType type = info.getType();
    if (NestedCopyType.external.equals(type) || NestedCopyType.switched.equals(type)) {
      sb.append("<tr valign=\"top\"><td colspan=\"3\"><i>")
          .append(type.getName())
          .append("</i></td></tr>");
    }
    if (info.isIsWcRoot()) {
      sb.append("<tr valign=\"top\"><td colspan=\"3\"><i>")
          .append("Working copy root</i></td></tr>");
    }
    sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"")
        .append(CONFIGURE_BRANCHES)
        .append("\">Configure Branches</a></td></tr>");
    sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"")
        .append(MERGE_FROM)
        .append("\"><b>Merge From...</b></a></i></td></tr>");

    sb.append("</table></body></html>");
    return sb.toString();
  }
  @SuppressWarnings("MethodMayBeStatic")
  private String formatWc(
      @NotNull WCInfo info, @NotNull Collection<WorkingCopyFormat> upgradeFormats) {
    final StringBuilder sb =
        new StringBuilder()
            .append("<html><head>")
            .append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont()))
            .append("</head><body><table bgColor=\"")
            .append(ColorUtil.toHex(UIUtil.getPanelBackground()))
            .append("\">");

    sb.append("<tr valign=\"top\"><td colspan=\"3\"><b>")
        .append(info.getPath())
        .append("</b></td></tr>");
    if (info.hasError()) {
      sb.append("<tr valign=\"top\"><td>URL:</td><td colspan=\"2\" color=\"")
          .append(ColorUtil.toHex(JBColor.red))
          .append("\">")
          .append(info.getErrorMessage())
          .append("</td></tr>");
    } else {
      sb.append("<tr valign=\"top\"><td>URL:</td><td colspan=\"2\">")
          .append(info.getRootUrl())
          .append("</td></tr>");
    }
    if (upgradeFormats.size() > 1) {
      sb.append("<tr valign=\"top\"><td>Format:</td><td>")
          .append(info.getFormat().getName())
          .append("</td><td><a href=\"")
          .append(CHANGE_FORMAT)
          .append("\">Change</a></td></tr>");
    } else {
      sb.append("<tr valign=\"top\"><td>Format:</td><td colspan=\"2\">")
          .append(info.getFormat().getName())
          .append("</td></tr>");
    }

    if (!Depth.INFINITY.equals(info.getStickyDepth()) && !info.hasError()) {
      // can fix
      sb.append("<tr valign=\"top\"><td>Depth:</td><td>")
          .append(info.getStickyDepth().getName())
          .append("</td><td><a href=\"")
          .append(FIX_DEPTH)
          .append("\">Fix</a></td></tr>");
    } else {
      sb.append("<tr valign=\"top\"><td>Depth:</td><td colspan=\"2\">")
          .append(info.getStickyDepth().getName())
          .append("</td></tr>");
    }

    final NestedCopyType type = info.getType();
    if (NestedCopyType.external.equals(type) || NestedCopyType.switched.equals(type)) {
      sb.append("<tr valign=\"top\"><td colspan=\"3\"><i>")
          .append(type.getName())
          .append("</i></td></tr>");
    }
    if (info.isIsWcRoot()) {
      sb.append("<tr valign=\"top\"><td colspan=\"3\"><i>")
          .append("Working copy root</i></td></tr>");
    }
    if (!info.hasError()) {
      if (info.getFormat().isOrGreater(WorkingCopyFormat.ONE_DOT_SEVEN)) {
        sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"")
            .append(CLEANUP)
            .append("\">Cleanup</a></td></tr>");
      }
      sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"")
          .append(CONFIGURE_BRANCHES)
          .append("\">Configure Branches</a></td></tr>");
      sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"")
          .append(MERGE_FROM)
          .append("\"><b>Merge From...</b></a></i></td></tr>");

      sb.append("</table></body></html>");
    }
    return sb.toString();
  }