SceneBuilderInfo (Project project, boolean choosePathIfEmpty) { JavaFxSettings settings = JavaFxSettings.getInstance(); String pathToSceneBuilder = settings.getPathToSceneBuilder(); if (StringUtil.isEmptyOrSpaces(pathToSceneBuilder) || !new File(pathToSceneBuilder).exists()) { VirtualFile sceneBuilderFile = null; if (choosePathIfEmpty) { sceneBuilderFile = FileChooser.chooseFile(JavaFxSettingsConfigurable.createSceneBuilderDescriptor(), project, getPredefinedPath()); } if (sceneBuilderFile == null) { return EMPTY; } pathToSceneBuilder = FileUtil.toSystemIndependentName(sceneBuilderFile.getPath()); settings.setPathToSceneBuilder(pathToSceneBuilder); } File sceneBuilderLibsFile; if (SystemInfo.isMac) { sceneBuilderLibsFile = new File(new File(pathToSceneBuilder, "Contents"), "Java"); } else if (SystemInfo.isWindows) { File sceneBuilderRoot = new File(pathToSceneBuilder); File sceneBuilderRootDir = sceneBuilderRoot.getParentFile(); if (sceneBuilderRootDir == null) { final File foundInPath = PathEnvironmentVariableUtil.findInPath(pathToSceneBuilder); if (foundInPath != null) { sceneBuilderRootDir = foundInPath.getParentFile(); } } sceneBuilderRoot = sceneBuilderRootDir != null ? sceneBuilderRootDir.getParentFile() : null; if (sceneBuilderRoot != null) { final File appFile = new File(sceneBuilderRootDir, "app"); if (appFile.isDirectory()) { sceneBuilderLibsFile = appFile; } else { final File libFile = new File(sceneBuilderRoot, "lib"); sceneBuilderLibsFile = libFile.isDirectory() ? libFile : null; } } else { sceneBuilderLibsFile = null; } } else { sceneBuilderLibsFile = new File(new File(pathToSceneBuilder).getParent(), "app"); } if (sceneBuilderLibsFile != null && (!sceneBuilderLibsFile.exists() || !sceneBuilderLibsFile.isDirectory())) { sceneBuilderLibsFile = null; } return new SceneBuilderInfo(pathToSceneBuilder, sceneBuilderLibsFile == null ? null : sceneBuilderLibsFile.getAbsolutePath()); }