コード例 #1
0
 protected void rename() {
   if (isDirty()) {
     YesNoCancelPopup yesNoCancelPopup =
         YesNoCancelPopup.newYesNoCancelPopup(
             CommonConstants.INSTANCE.Information(),
             Constants.INSTANCE.modelEditor_confirm_save_before_rename(),
             new Command() {
               @Override
               public void execute() {
                 rename(true);
               }
             },
             new Command() {
               @Override
               public void execute() {
                 rename(false);
               }
             },
             new Command() {
               @Override
               public void execute() {
                 // do nothing.
               }
             });
     yesNoCancelPopup.setClosable(false);
     yesNoCancelPopup.show();
   } else {
     // just rename.
     rename(false);
   }
 }
コード例 #2
0
  private void showParseErrorsDialog(
      final String message,
      final boolean publishErrors,
      final List<DataModelerError> errors,
      final Command command) {

    if (publishErrors && errors != null && !errors.isEmpty()) {
      publishSystemMessages(getCurrentMessageType(), true, errors);
    }

    YesNoCancelPopup yesNoCancelPopup =
        YesNoCancelPopup.newYesNoCancelPopup(
            CommonConstants.INSTANCE.Information(),
            message,
            new Command() {
              @Override
              public void execute() {
                command.execute();
              }
            },
            CommonConstants.INSTANCE.OK(),
            null,
            null,
            null,
            null);
    yesNoCancelPopup.setClosable(false);
    yesNoCancelPopup.show();
  }
  @Override
  public void showYesNoDialog(
      String message, Command yesCommand, Command noCommand, Command cancelCommand) {

    YesNoCancelPopup yesNoCancelPopup =
        YesNoCancelPopup.newYesNoCancelPopup(
            CommonConstants.INSTANCE.Information(), message, yesCommand, noCommand, cancelCommand);

    yesNoCancelPopup.setClosable(false);
    yesNoCancelPopup.show();
  }
 void generateNoRightsPopup() {
   YesNoCancelPopup popup =
       YesNoCancelPopup.newYesNoCancelPopup(
           CommonConstants.INSTANCE.Information(),
           Constants.INSTANCE.Error_NoAccessRights(),
           null,
           null,
           new Command() {
             @Override
             public void execute() {
               // do nothing, just to show the cancel button.
             }
           });
   popup.setClosable(false);
   popup.show();
 }
コード例 #5
0
  private void saveFile(final JavaTypeInfo newTypeInfo) {

    String currentFileName =
        DataModelerUtils.extractSimpleFileName(versionRecordManager.getPathToLatest());

    if (hasPackageNameChanged(newTypeInfo)) {

      YesNoCancelPopup yesNoCancelPopup =
          YesNoCancelPopup.newYesNoCancelPopup(
              CommonConstants.INSTANCE.Information(),
              Constants.INSTANCE.modelEditor_confirm_file_package_refactoring(
                  newTypeInfo.getPackageName()),
              new Command() {
                @Override
                public void execute() {
                  saveOperationService.save(
                      versionRecordManager.getPathToLatest(),
                      getSaveCommand(newTypeInfo, versionRecordManager.getPathToLatest()));
                }
              },
              Constants.INSTANCE.modelEditor_action_yes_refactor_directory(),
              ButtonType.PRIMARY,
              new Command() {
                @Override
                public void execute() {
                  saveOperationService.save(
                      versionRecordManager.getPathToLatest(),
                      getSaveCommand(null, versionRecordManager.getPathToLatest()));
                }
              },
              Constants.INSTANCE.modelEditor_action_no_dont_refactor_directory(),
              ButtonType.DANGER,
              new Command() {
                @Override
                public void execute() {
                  // do nothing
                }
              },
              null,
              null);

      yesNoCancelPopup.setClosable(false);
      yesNoCancelPopup.show();

    } else if (hasFileNameChanged(newTypeInfo, currentFileName)) {

      YesNoCancelPopup yesNoCancelPopup =
          YesNoCancelPopup.newYesNoCancelPopup(
              CommonConstants.INSTANCE.Information(),
              Constants.INSTANCE.modelEditor_confirm_file_name_refactoring(newTypeInfo.getName()),
              new Command() {
                @Override
                public void execute() {
                  saveOperationService.save(
                      versionRecordManager.getPathToLatest(),
                      getSaveCommand(newTypeInfo, versionRecordManager.getPathToLatest()));
                }
              },
              Constants.INSTANCE.modelEditor_action_yes_refactor_file_name(),
              ButtonType.PRIMARY,
              new Command() {
                @Override
                public void execute() {
                  saveOperationService.save(
                      versionRecordManager.getPathToLatest(),
                      getSaveCommand(null, versionRecordManager.getPathToLatest()));
                }
              },
              Constants.INSTANCE.modelEditor_action_no_dont_refactor_file_name(),
              ButtonType.DANGER,
              new Command() {
                @Override
                public void execute() {
                  // do nothing
                }
              },
              null,
              null);

      yesNoCancelPopup.setClosable(false);
      yesNoCancelPopup.show();

    } else {
      new SaveOperationService()
          .save(
              versionRecordManager.getPathToLatest(),
              getSaveCommand(null, versionRecordManager.getPathToLatest()));
    }
  }