예제 #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();
          }
        });
  }
예제 #2
0
 private void hide() {
   view.hide();
 }
예제 #3
0
 public void show() {
   view.show();
 }