Fix NPE, controller not found

This commit is contained in:
Clément Fournier
2018-05-30 18:29:48 +02:00
parent 61a5d1494b
commit 95ac9691d3
3 changed files with 14 additions and 11 deletions

View File

@ -115,8 +115,8 @@ public class MainDesignerController implements Initializable, SettingsOwner {
private SourceEditorController sourceEditorController;
@FXML
private EventLogController eventLogPanelController;
@FXML
private AuxClassPathController auxClassPathController;
private final AuxClassPathController auxClassPathController;
// Other fields
private Stack<File> recentFiles = new LimitedSizeStack<>(5);
@ -127,6 +127,7 @@ public class MainDesignerController implements Initializable, SettingsOwner {
public MainDesignerController(DesignerRoot owner) {
this.designerRoot = owner;
this.auxClassPathController = new AuxClassPathController(designerRoot, this);
}

View File

@ -226,7 +226,6 @@ public class XPathPanelController implements Initializable, SettingsOwner {
public void showExportXPathToRuleWizard() throws IOException {
// doesn't work for some reason
ExportXPathWizardController wizard
= new ExportXPathWizardController(xpathExpressionProperty());

View File

@ -30,19 +30,14 @@ public class AuxClassPathController implements Initializable, SettingsOwner {
@FXML
private Button removeFiles;
@FXML
private TableView fileTable;
@FXML
private Button selectFile;
@FXML
private TableColumn fileList;
@FXML
private TableColumn fileAdd;
@FXML
private final MainDesignerController parent;
@ -71,12 +66,20 @@ public class AuxClassPathController implements Initializable, SettingsOwner {
public void showAuxPathWizard() throws Exception {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("fxml/aux-controller.fxml"));
Parent root1 = (Parent) fxmlLoader.load();
FXMLLoader fxmlLoader = new FXMLLoader(DesignerUtil.getFxml("aux-controller.fxml"));
fxmlLoader.setControllerFactory(type -> {
if (type == AuxClassPathController.class) {
return this;
} else {
throw new IllegalStateException("Wrong controller!");
}
});
Parent root1 = fxmlLoader.load();
Stage stage = new Stage();
stage.setScene(new Scene(root1));
stage.show();
}