Java Code Examples for com.intellij.execution.ExecutionException#printStackTrace()

The following examples show how to use com.intellij.execution.ExecutionException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestParseIOSDevices.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
    public void listDevices() {
        System.out.println(
                System.getProperty("user.home"));
//        System.getProperties().list(System.out);

        GeneralCommandLine commandLine = RNPathUtil.cmdToGeneralCommandLine(IOSDevicesParser.LIST_Simulator_JSON);

        try {
            String json = ExecUtil.execAndGetOutput(commandLine).getStdout();
            System.out.println("json=" + json);
            Simulators result = new Gson().fromJson(json, Simulators.class);
            System.out.println(result.devices.keySet());
            System.out.println(result.devices.get("iOS 10.3")[0]);
        } catch (ExecutionException e) {
            e.printStackTrace();
            NotificationUtils.errorNotification( "xcrun invocation failed. Please check that Xcode is installed." );
        }

    }
 
Example 2
Source File: TestParseIOSDevices.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
    public void parseCurrentPathFromRNConsoleJsonFile() {
        //        System.out.println(
//                System.getProperty("user.home"));
//        System.getProperties().list(System.out);

        GeneralCommandLine commandLine = RNPathUtil.cmdToGeneralCommandLine(IOSDevicesParser.LIST_DEVICES);
        try {
            String json = ExecUtil.execAndGetOutput(commandLine).getStdout();
            System.out.println(json);
            Arrays.asList(json.split("\n")).forEach(line -> {
                System.out.println(line);
//                Pattern pattern = Pattern
//                        .compile("^([hH][tT]{2}[pP]://|[hH][tT]{2}[pP][sS]://)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\\/])+$");
                boolean device = line.matches("^(.*?) \\((.*?)\\)\\ \\[(.*?)\\]");
                System.out.println("device=" + device);
//                String noSimulator = line.match(/(.*?) \((.*?)\) \[(.*?)\] \((.*?)\)/);
            });

        } catch (ExecutionException e) {
            e.printStackTrace();
            NotificationUtils.errorNotification( "xcrun invocation failed. Please check that Xcode is installed." );
            return;
        }
    }
 
Example 3
Source File: VueSettingsPage.java    From vue-for-idea with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void getVersion() {
    if (settings != null &&
            areEqual(nodeInterpreterField, settings.node) &&
            areEqual(rtBinField, settings.vueExePath) &&
            settings.cwd.equals(project.getBasePath())
            ) {
        return;
    }
    settings = new VueSettings();
    settings.node = nodeInterpreterField.getChildComponent().getText();
    settings.vueExePath = rtBinField.getChildComponent().getText();
    settings.cwd = project.getBasePath();
    try {
        String version = VueRunner.runVersion(settings);
        versionLabel.setText("vue-cli version: "+version.trim());
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
}
 
Example 4
Source File: JscsSettingsPage.java    From jscs-plugin with MIT License 6 votes vote down vote up
private void getVersion() {
    if (settings != null &&
        areEqual(nodeInterpreterField, settings.node) &&
        areEqual(jscsBinField, settings.jscsExecutablePath) &&
        settings.cwd.equals(project.getBasePath())
            ) {
        return;
    }
    settings = new JscsSettings();
    settings.node = nodeInterpreterField.getChildComponent().getText();
    settings.jscsExecutablePath = jscsBinField.getChildComponent().getText();
    settings.cwd = project.getBasePath();
    try {
        String version = JscsRunner.version(settings);
        versionLabel.setText(version.trim());
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
}
 
Example 5
Source File: ESLintSettingsPage.java    From eslint-plugin with MIT License 6 votes vote down vote up
private void getVersion() {
    if (settings != null &&
            areEqual(nodeInterpreterField, settings.node) &&
            areEqual(eslintBinField2, settings.eslintExecutablePath) &&
            settings.cwd.equals(project.getBasePath())
            ) {
        return;
    }
    settings = new ESLintRunner.ESLintSettings();
    settings.node = nodeInterpreterField.getChildComponent().getText();
    settings.eslintExecutablePath = eslintBinField2.getChildComponent().getText();
    settings.cwd = project.getBasePath();
    try {
        String version = ESLintRunner.runVersion(settings);
        versionLabel.setText(version.trim());
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
}
 
Example 6
Source File: RNUtil.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void runGradleCI(Project project, String... params) {
        String path = RNPathUtil.getRNProjectPath(project);
        String gradleLocation = RNPathUtil.getAndroidProjectPath(path);
        if (gradleLocation == null) {
            NotificationUtils.gradleFileNotFound();
        } else {
            GeneralCommandLine commandLine = new GeneralCommandLine();
//    ExecutionEnvironment environment = getEnvironment();
            commandLine.setWorkDirectory(gradleLocation);
            commandLine.setExePath("." + File.separator + "gradlew");
            commandLine.addParameters(params);

//            try {
////            Process process = commandLine.createProcess();
//                OSProcessHandler processHandler = new KillableColoredProcessHandler(commandLine);
//                RunnerUtil.showHelperProcessRunContent("Update AAR", processHandler, project, DefaultRunExecutor.getRunExecutorInstance());
//                // Run
//                processHandler.startNotify();
//            } catch (ExecutionException e) {
//                e.printStackTrace();
//                NotificationUtils.errorNotification("Can't execute command: " + e.getMessage());
//            }

            // commands process
            try {
                processCommandline(project, commandLine);
            } catch (ExecutionException e) {
                e.printStackTrace();
            }
        }
    }
 
Example 7
Source File: RNUtil.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void build(Project project) {
    GeneralCommandLine commandLine = new GeneralCommandLine();
    commandLine.setWorkDirectory(project.getBasePath());
    commandLine.setExePath("python");
    commandLine.addParameter("freeline.py");
    // debug
    commandLine.addParameter("-d");

    // commands process
    try {
        processCommandline(project, commandLine);
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
}
 
Example 8
Source File: ShowConsoleRefreshAnrdoidAction.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
    public void actionPerformed(AnActionEvent anActionEvent) {
//        ReactNativeConsole.getInstance(currentProject).initAndActiveRunRefresh(anActionEvent.getInputEvent());
        GeneralCommandLine commandLine = RNPathUtil.createFullPathCommandLine(command(), null);
        try {
            ExecUtil.execAndGetOutput(commandLine);
            NotificationUtils.infoNotification("Android Reload JS done.");
        } catch (ExecutionException e) {
            e.printStackTrace();
            NotificationUtils.errorNotification( "Android Reload JS failed. Please check that adb is installed." );
        }
    }
 
Example 9
Source File: ADB.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public Collection<Device> getDevicesConnectedByUSB() {
  try {
    GeneralCommandLine commandLine = RNPathUtil.createFullPathCommandLine("adb devices -l", null);
    String adbDevicesOutput = ExecUtil.execAndGetOutput(commandLine).getStdout();
    return adbParser.parseGetDevicesOutput(adbDevicesOutput);
  } catch (ExecutionException e) {
    e.printStackTrace();
  }

  return new ArrayList<>();
}
 
Example 10
Source File: FreelineUtil.java    From freeline with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void build(Project project) {
    GeneralCommandLine commandLine = new GeneralCommandLine();
    commandLine.setWorkDirectory(project.getBasePath());
    commandLine.setExePath("python");
    commandLine.addParameter("freeline.py");
    // debug
    commandLine.addParameter("-d");

    // commands process
    try {
        processCommandline(project, commandLine);
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
}
 
Example 11
Source File: SassLintRunnerTest.java    From sass-lint-plugin with MIT License 5 votes vote down vote up
@Test
public void testVersion() {
    SassLintRunner.SassLintSettings settings = createSettings();
    try {
        String out = SassLintRunner.runVersion(settings);
        assertEquals("version should be", "1.4.0", out);
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
}
 
Example 12
Source File: VueGeneratorPeer.java    From vue-for-idea with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void run() {
    try {
        ProcessOutput out = NodeRunner.execute(cmd, NodeRunner.TIME_OUT);
        callback.onEnd(out);
    } catch (ExecutionException e) {
        e.printStackTrace();
        callback.onFaild(e);
    }
}
 
Example 13
Source File: JscsRunnerTest.java    From jscs-plugin with MIT License 5 votes vote down vote up
@Test
public void testVersion() {
    JscsSettings settings = createSettings();
    try {
        String version = JscsRunner.version(settings);
        assertEquals("version should be", "1.6.1", version);
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
}
 
Example 14
Source File: ESLintRunner.java    From eslint-plugin with MIT License 5 votes vote down vote up
@NotNull
public static Result lint(@NotNull String cwd, @NotNull String path, @NotNull ESLintProjectComponent component) {
    ESLintRunner.ESLintSettings settings = ESLintRunner.buildSettings(cwd, path, component);
    try {
        ProcessOutput output = ESLintRunner.lint(settings);
        return Result.processResults(output);
    } catch (ExecutionException e) {
        LOG.warn("Could not lint file", e);
        ESLintProjectComponent.showNotification("Error running ESLint inspection: " + e.getMessage() + "\ncwd: " + cwd + "\ncommand: " + component.eslintExecutable, NotificationType.WARNING);
        e.printStackTrace();
        return Result.createError(e.getMessage());
    }
}
 
Example 15
Source File: ESLintFixAction.java    From eslint-plugin with MIT License 5 votes vote down vote up
public void actionPerformed(AnActionEvent e) {
        final Project project = e.getProject();
        if (project == null) return;
        final VirtualFile file = (VirtualFile) e.getDataContext().getData(DataConstants.VIRTUAL_FILE);

        // TODO handle multiple selection
        if (file == null) {
//            File[] rtFiles = RTFile.DATA_KEY.getData(e.getDataContext());
//            if (rtFiles == null || rtFiles.length == 0) {
//                System.out.println("No file for rt compile");
//                return;
//            }
//            // handle all files
//            for (RTFile rtFile : rtFiles) {
//                RTFileListener.compile(rtFile.getRtFile().getVirtualFile(), project);
//            }
        } else {
            ESLintProjectComponent component = project.getComponent(ESLintProjectComponent.class);
            if (!component.isSettingsValid() || !component.isEnabled()) {
                return;
            }
//            Result result = ESLintRunner.lint(project.getBasePath(), relativeFile, component.nodeInterpreter, component.eslintExecutable, component.eslintRcFile, component.customRulesPath);

            if (project.getBasePath() != null) {
                ESLintRunner.ESLintSettings settings = ESLintRunner.buildSettings(project.getBasePath(), file.getPath(), component);
                try {
                    ESLintRunner.fix(settings);
                    file.refresh(false, false);
                } catch (ExecutionException e1) {
                    e1.printStackTrace();
                }
            }
        }
    }
 
Example 16
Source File: IOSDevicesParser.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
     * All devices include simulator.
     * @param noSimulator 是否不包含模拟器
     * @return
     */
    public static List<IOSDeviceInfo> getAllIOSDevicesList(boolean noSimulator) {
        List<IOSDeviceInfo> deviceInfos = new ArrayList<>();

        GeneralCommandLine commandLine = RNPathUtil.createFullPathCommandLine(IOSDevicesParser.LIST_DEVICES, null);
        try {
            String json = ExecUtil.execAndGetOutput(commandLine).getStdout();
            String regex = "/(.*?) \\((.*?)\\) \\[(.*?)\\]/";
            String simulatorRegex = "/(.*?) \\((.*?)\\) \\[(.*?)\\] \\((.*?)\\)/";

            Arrays.asList(json.split("\n")).forEach(line -> {
//                System.out.println("parsing " + line);
                String[] device = JSExec.jsMatchExpr(line, regex);
                String[] noSimulatorDevice = null;
                if(device != null) {
//                    System.out.println("result = " + device[1]);
                    IOSDeviceInfo deviceInfo = new IOSDeviceInfo();
                    deviceInfo.name = device[1];
                    deviceInfo.version = device[2];
                    deviceInfo.udid = device[3];

//                    noSimulatorDevice = JSExec.jsMatchExpr(line, simulatorRegex);

//                    deviceInfo.simulator = (noSimulatorDevice != null);
                    deviceInfo.simulator = line.endsWith("(Simulator)");// To enable quick exec

                    if(noSimulator) {
                        if(!deviceInfo.simulator) {
                            deviceInfos.add(deviceInfo);
                        }
                    } else {
                        deviceInfos.add(deviceInfo);
                    }
                }
            });
        } catch (ExecutionException e) {
            e.printStackTrace();
            NotificationUtils.errorNotification( "xcrun invocation failed. Please check that Xcode is installed." );
            return null;
        }

        return deviceInfos;
    }