diff --git a/src/StellarisDK/GUI/guiController.java b/src/StellarisDK/GUI/guiController.java index 6cf8107..245be87 100644 --- a/src/StellarisDK/GUI/guiController.java +++ b/src/StellarisDK/GUI/guiController.java @@ -49,6 +49,23 @@ public guiController() { } catch (IOException e) { throw new RuntimeException(e); } + + // Can probably cut some RAM cost by using Cell Factories + itemView.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> { + if (event.getClickCount() >= 2) { + Node node = event.getPickResult().getIntersectedNode(); + if (node instanceof Text || (node instanceof TreeCell && ((TreeCell) node).getText() != null && + ((TreeCell) node).getChildrenUnmodifiable().size() == 1)) { + System.out.println("Starting Editor"); + Object temp; + if ((node instanceof LabeledText)) { + temp = ((TreeCell) node.getParent()).getTreeItem().getValue(); + } else + temp = ((TreeCell) node).getTreeItem().getValue(); + open((GenericData) temp); + } + } + }); } public void setStage(Stage stage) { @@ -102,23 +119,6 @@ protected void openMod() { itemView.getRoot().getChildren().add(new TreeItem(mainMd)); itemView.getRoot().setExpanded(true); - // Can probably cut some RAM cost by using Cell Factories - itemView.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> { - if (event.getClickCount() >= 2) { - Node node = event.getPickResult().getIntersectedNode(); - if (node instanceof Text || (node instanceof TreeCell && ((TreeCell) node).getText() != null && - ((TreeCell) node).getChildrenUnmodifiable().size() == 1)) { - System.out.println("Starting Editor"); - Object temp; - if ((node instanceof LabeledText)) { - temp = ((TreeCell) node.getParent()).getTreeItem().getValue(); - } else - temp = ((TreeCell) node).getTreeItem().getValue(); - open((GenericData) temp); - } - } - }); - if (mainMd.getValue("path") != null) { mainLoadPath = modPath.getParentFile().getParent() + "\\" + (mainMd.getValue("path").toString().replaceAll("/", "\\\\")); loadMod();