diff --git a/src/main/java/spdxedit/MainSceneController.java b/src/main/java/spdxedit/MainSceneController.java index 5792e36..ff55e94 100644 --- a/src/main/java/spdxedit/MainSceneController.java +++ b/src/main/java/spdxedit/MainSceneController.java @@ -158,14 +158,15 @@ private static TreeItem getTreeForPath(final Path base) throws IOException } public void handleNewDocumentClicked(MouseEvent event){ - TextInputDialog dialog = new TextInputDialog(); + TextInputDialog dialog = new TextInputDialog("http://url.example.com/spdx/builder"); ((Stage)dialog.getDialogPane().getScene().getWindow()).getIcons().addAll(UiUtils.ICON_IMAGE_VIEW.getImage()); dialog.setTitle("New SPDX Document"); dialog.setHeaderText("Enter document namespace"); - dialog.setResult("http://url.example.com/spdx/builder"); + Optional result = dialog.showAndWait(); while (result.isPresent() && !SpdxLogic.validateDocumentNamespace(result.orElse(""))){ - dialog.setContentText(result.orElse("")+ "is not a valid document namespace. Please enter a valid document namespace."); + + dialog.setHeaderText("Invalid document namespace. Enter new document namespace."); result = dialog.showAndWait(); } if (result.isPresent()){