Ejemplo n.º 1
0
  @Override
  public void onRename() {
    final String baseFileName = view.getName();
    final String originalFileName = path.getFileName();
    final String extension =
        (originalFileName.lastIndexOf(".") > 0
            ? originalFileName.substring(originalFileName.lastIndexOf("."))
            : "");
    final String fileName = baseFileName + extension;

    validator.validate(
        fileName,
        new ValidatorWithReasonCallback() {
          @Override
          public void onFailure(final String reason) {
            if (ValidationErrorReason.DUPLICATED_NAME.name().equals(reason)) {
              view.handleDuplicatedFileName();
            } else {
              view.handleInvalidFileName();
            }
          }

          @Override
          public void onSuccess() {
            command.execute(new FileNameAndCommitMessage(baseFileName, view.getCheckInComment()));
          }

          @Override
          public void onFailure() {
            view.handleInvalidFileName();
          }
        });
  }
Ejemplo n.º 2
0
 private void hide() {
   view.hide();
 }
Ejemplo n.º 3
0
 public void show() {
   view.show();
 }