/** This will create a new asset wizard with the given preselected package. */
 public NewAssetWizard(
     EditItemEvent event,
     boolean showCategories,
     String format2,
     String title,
     String currentlySelectedPackage) {
   this(event, showCategories, format2, title);
   packageSelector.selectPackage(currentlySelectedPackage);
 }
  /** When OK is pressed, it will update the repository with the new rule. */
  void ok() {

    if (this.showCats && this.initialCategory == null) {
      WarningPopup.showMessage(
          "You have to pick an initial category.", this.getAbsoluteLeft(), this.getAbsoluteTop());
      return;
    } else if (this.name.getText() == null || "".equals(this.name.getText())) {
      WarningPopup.showMessage(
          "Rule must have a name", this.getAbsoluteLeft(), this.getAbsoluteTop());
      return;
    }

    GenericCallback cb =
        new GenericCallback() {
          public void onSuccess(Object result) {
            String uuid = (String) result;
            if (uuid.startsWith("DUPLICATE")) {
              LoadingPopup.close();
              Window.alert(
                  "An asset with that name already exists in the chosen package. Please use another name");
            } else {
              openEditor((String) result);
              hide();
            }
          }
        };

    LoadingPopup.showMessage("Please wait ...");
    RepositoryServiceFactory.getService()
        .createNewRule(
            name.getText(),
            description.getText(),
            initialCategory,
            packageSelector.getSelectedPackage(),
            getFormat(),
            cb);
  }