Exemple #1
0
 private void onCreateNewCollection(ActionEvent ev) {
   TextInputDialog dialog = new TextInputDialog();
   dialog.setContentText("Enter Name:");
   dialog.setHeaderText("Create new collection");
   dialog
       .showAndWait()
       .ifPresent(
           r -> {
             DbTreeValue value = treeView.getSelectionModel().getSelectedItem().getValue();
             value.getMongoDatabase().createCollection(dialog.getResult());
             reloadSelectedTreeItem();
           });
 }
Exemple #2
0
  public void onCreateNewDb(ActionEvent ev) {
    TreeItem<DbTreeValue> selectedItem = treeView.getSelectionModel().getSelectedItem();
    if (selectedItem == null
        || selectedItem.getValue().getValueType() != TreeValueType.CONNECTION) {
      return;
    }

    TextInputDialog dialog = new TextInputDialog();
    dialog.setContentText("Enter Name:");
    dialog.setHeaderText("Create new db");
    dialog
        .showAndWait()
        .ifPresent(
            r ->
                selectedItem
                    .getChildren()
                    .add(
                        createDbItem(
                            selectedItem
                                .getValue()
                                .getMongoConnection()
                                .createMongoDB(dialog.getResult()))));
  }