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();
  }
 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);
   }
 }
  @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();
 }
 private void openDataObject(final DataObject dataObject) {
   final Path objectPath = getContext().getDataObjectPath(dataObject.getClassName());
   if (objectPath != null) {
     BusyPopup.showMessage(
         org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE
             .Loading());
     modelerService
         .call(
             new RemoteCallback<Boolean>() {
               @Override
               public void callback(Boolean exists) {
                 BusyPopup.close();
                 if (Boolean.TRUE.equals(exists)) {
                   placeManager.goTo(new PathPlaceRequest(objectPath));
                 } else {
                   YesNoCancelPopup yesNoCancelPopup =
                       YesNoCancelPopup.newYesNoCancelPopup(
                           CommonConstants.INSTANCE.Warning(),
                           Constants.INSTANCE.objectBrowser_message_file_not_exists_or_renamed(
                               objectPath.toURI()),
                           new Command() {
                             @Override
                             public void execute() {
                               // do nothing.
                             }
                           },
                           CommonConstants.INSTANCE.Close(),
                           ButtonType.WARNING,
                           null,
                           null,
                           null,
                           null,
                           null,
                           null);
                   yesNoCancelPopup.setClosable(false);
                   yesNoCancelPopup.show();
                 }
               }
             },
             new DataModelerErrorCallback(
                 CommonConstants.INSTANCE.ExceptionNoSuchFile0(objectPath.toURI())))
         .exists(objectPath);
   }
 }
  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()));
    }
  }