Search in sources :

Example 1 with SceneBuilderInfo

use of org.jetbrains.plugins.javaFX.sceneBuilder.SceneBuilderInfo in project intellij-community by JetBrains.

the class OpenInSceneBuilderAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final VirtualFile virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
    LOG.assertTrue(virtualFile != null);
    final String path = virtualFile.getPath();
    final Project project = getEventProject(e);
    final SceneBuilderInfo info = SceneBuilderInfo.get(project, true);
    if (info == SceneBuilderInfo.EMPTY) {
        return;
    }
    String pathToSceneBuilder = info.path;
    if (SystemInfo.isMac) {
        pathToSceneBuilder += "/Contents/MacOS/";
        if (new File(pathToSceneBuilder, OLD_LAUNCHER).exists()) {
            pathToSceneBuilder += OLD_LAUNCHER;
        } else {
            pathToSceneBuilder += "SceneBuilder";
        }
    }
    final GeneralCommandLine commandLine = new GeneralCommandLine();
    try {
        commandLine.setExePath(FileUtil.toSystemDependentName(pathToSceneBuilder));
        commandLine.addParameter(path);
        commandLine.createProcess();
    } catch (Exception ex) {
        Messages.showErrorDialog("Failed to start SceneBuilder: " + commandLine.getCommandLineString(), CommonBundle.getErrorTitle());
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) SceneBuilderInfo(org.jetbrains.plugins.javaFX.sceneBuilder.SceneBuilderInfo) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Aggregations

GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 SceneBuilderInfo (org.jetbrains.plugins.javaFX.sceneBuilder.SceneBuilderInfo)1