From 67d252f5c6fbd835d129011f20dda14a68e05b6e Mon Sep 17 00:00:00 2001 From: Yev Bronshteyn Date: Wed, 14 Sep 2016 03:28:57 -0400 Subject: [PATCH] Cleanup of illegal document namespace handling. --- src/main/java/spdxedit/MainSceneController.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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()){