@Override public void configureBeforeRunTaskDefaults(Key<? extends BeforeRunTask> providerID, BeforeRunTask task) { super.configureBeforeRunTaskDefaults(providerID, task); if (providerID == CompileStepBeforeRun.ID) { task.setEnabled(false); } } }
@Override public boolean shouldAccept(AbstractTestProxy test) { Location location = test.getLocation(project, searchScope); return location instanceof PsiLocation && location.getPsiElement() instanceof GoFunctionOrMethodDeclaration; } });
@Override public void readExternal(Element element) { super.readExternal(element); String command = element.getAttributeValue(COMMAND_ATTRIBUTE); if (command != null) { myCommand = command; } }
commandLine = createCommandLine(); GeneralCommandLine finalCommandLine = commandLine; myProcessHandler = new KillableColoredProcessHandler(finalCommandLine, true) { @Override public void startNotify() { myProcessHandler.addProcessListener(historyProcessListener); for (ProcessListener listener : myProcessListeners) { myProcessHandler.addProcessListener(listener); myProcessHandler.addProcessListener(processAdapter); myProcessHandler.startNotify(); ExecutionModes.SameThreadMode sameThreadMode = new ExecutionModes.SameThreadMode(getPresentableName()); ExecutionHelper.executeExternalProcess(myProject, myProcessHandler, sameThreadMode, commandLine); ExecutionHelper.showErrors(myProject, Collections.singletonList(e), getPresentableName(), null); showNotification(StringUtil.notNullize(e.getMessage(), "Unknown error, see logs for details"), NotificationType.ERROR); String commandLineInfo = commandLine != null ? commandLine.getCommandLineString() : "not constructed"; LOGGER.debug("Finished `" + getPresentableName() + "` with an exception. Commandline: " + commandLineInfo, e); return false;
File outputFile; String outputDirectoryPath = state.getConfiguration().getOutputFilePath(); RunnerAndConfigurationSettings settings = environment.getRunnerAndConfigurationSettings(); String configurationName = settings != null ? settings.getName() : "application"; if (StringUtil.isEmpty(outputDirectoryPath)) { try { throw new ExecutionException("Cannot create temporary output file", e); try { if (!outputFile.exists() && !outputFile.createNewFile()) { throw new ExecutionException("Cannot create output file " + outputFile.getAbsolutePath()); throw new ExecutionException("Cannot create output file " + outputFile.getAbsolutePath()); throw new ExecutionException("Cannot create output file in " + outputDirectory.getAbsolutePath()); throw new ExecutionException("Cannot make temporary file executable " + outputFile.getAbsolutePath());
private ExecutionResult getExecutionResults(@NotNull RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException { // Start debugger. ExecutionResult executionResult = state.execute(env.getExecutor(), new BallerinaDebugger()); if (executionResult == null) { throw new ExecutionException("Cannot run debugger"); } return executionResult; }
private void showOutput(@NotNull OSProcessHandler originalHandler, @NotNull GoHistoryProcessListener historyProcessListener) { if (myShowOutputOnError) { BaseOSProcessHandler outputHandler = new KillableColoredProcessHandler(originalHandler.getProcess(), null); RunContentExecutor runContentExecutor = new RunContentExecutor(myProject, outputHandler) .withTitle(getPresentableName()) .withActivateToolWindow(myShowOutputOnError) .withFilter(new GoConsoleFilter(myProject, myModule, myWorkDirectory != null ? VfsUtilCore.pathToUrl(myWorkDirectory) : null)); Disposer.register(myProject, runContentExecutor); runContentExecutor.run(); historyProcessListener.apply(outputHandler); } if (myShowNotificationsOnError) { showNotification("Failed to run", NotificationType.ERROR); } }
@NotNull @Override public XDebugProcess start(@NotNull XDebugSession session) throws ExecutionException { // Get the remote host address. String address = getRemoteAddress(env); if (address == null || address.isEmpty()) { throw new ExecutionException("Invalid remote address."); } // Create a new connector. This will be used to communicate with the debugger. BallerinaWebSocketConnector ballerinaDebugSession = new BallerinaWebSocketConnector(address); return new BallerinaDebugProcess(session, ballerinaDebugSession, null); } }).getRunContentDescriptor();
public boolean isDebug() { return DefaultDebugExecutor.EXECUTOR_ID.equals(getEnvironment().getExecutor().getId()); }
@Override public void checkConfiguration() throws RuntimeConfigurationException { GoModuleBasedConfiguration configurationModule = getConfigurationModule(); Module module = configurationModule.getModule(); if (module != null) { if (GoSdkService.getInstance(module.getProject()).getSdkHomePath(module) == null) { throw new RuntimeConfigurationWarning("Go SDK is not specified for module '" + module.getName() + "'"); } } else { String moduleName = configurationModule.getModuleName(); if (moduleName != null) { throw new RuntimeConfigurationError(ExecutionBundle.message("module.doesn.t.exist.in.project.error.text", moduleName)); } throw new RuntimeConfigurationError(ExecutionBundle.message("module.not.specified.error.text")); } if (myWorkingDirectory.isEmpty()) { throw new RuntimeConfigurationError("Working directory is not specified"); } }
public BallerinaDebugProcess(@NotNull XDebugSession session, @NotNull BallerinaWebSocketConnector connector, @Nullable ExecutionResult executionResult) { super(session); myConnector = connector; myProcessHandler = executionResult == null ? super.getProcessHandler() : executionResult.getProcessHandler(); myExecutionConsole = executionResult == null ? super.createConsole() : executionResult.getExecutionConsole(); myEditorsProvider = new BallerinaDebuggerEditorsProvider(); myBreakPointHandler = new BallerinaBreakpointHandler(); if (executionResult == null) { isRemoteDebugMode = true; } }
@NotNull @Override public ExecutionConsole createConsole() { ExecutionResult executionResult = getExecutionResult(); return executionResult == null ? super.createConsole() : executionResult.getExecutionConsole(); }
private static Icon getTestStateIcon(@NotNull String url, @NotNull Project project) { TestStateStorage.Record state = TestStateStorage.getInstance(project).getState(url); if (state != null) { TestStateInfo.Magnitude magnitude = TestIconMapper.getMagnitude(state.magnitude); if (magnitude != null) { switch (magnitude) { case ERROR_INDEX: case FAILED_INDEX: return AllIcons.RunConfigurations.TestState.Red2; case PASSED_INDEX: case COMPLETE_INDEX: return AllIcons.RunConfigurations.TestState.Green2; default: } } } return AllIcons.RunConfigurations.TestState.Run; } }
@Override public void configureBeforeRunTaskDefaults(Key<? extends BeforeRunTask> providerID, BeforeRunTask task) { super.configureBeforeRunTaskDefaults(providerID, task); if (providerID == GoBeforeRunTaskProvider.ID && task instanceof GoCommandBeforeRunTask && ((GoCommandBeforeRunTask)task).getCommand() == null) { task.setEnabled(true); ((GoCommandBeforeRunTask)task).setCommand("test -i"); } } }
@Override public void writeExternal(Element element) { super.writeExternal(element); if (myCommand != null) { element.setAttribute(COMMAND_ATTRIBUTE, myCommand); } }
@NotNull private RunningState createRunningState(ExecutionEnvironment env) throws ExecutionException { GoModuleBasedConfiguration configuration = getConfigurationModule(); Module module = configuration.getModule(); if (module == null) { throw new ExecutionException("Go isn't configured for run configuration: " + getName()); } return newRunningState(env, module); }
/** * Indicates whether the debugging is invoked or not. * * @return {@code true} if debugging is running, {@code false} otherwise. */ private boolean isDebug() { return DefaultDebugExecutor.EXECUTOR_ID.equals(getEnvironment().getExecutor().getId()); } }
@Override public void configureBeforeRunTaskDefaults(Key<? extends BeforeRunTask> providerID, BeforeRunTask task) { super.configureBeforeRunTaskDefaults(providerID, task); if (providerID == CompileStepBeforeRun.ID) { task.setEnabled(false); } } }
@NotNull private RunningState createRunningState(ExecutionEnvironment env) throws ExecutionException { BallerinaModuleBasedConfiguration configuration = getConfigurationModule(); Module module = configuration.getModule(); if (module == null) { throw new ExecutionException("Ballerina isn't configured for run configuration: " + getName()); } return newRunningState(env, module); }
/** * Indicates whether the debugging is invoked or not. * * @return {@code true} if debugging is running, {@code false} otherwise. */ private boolean isDebug() { return DefaultDebugExecutor.EXECUTOR_ID.equals(getEnvironment().getExecutor().getId()); }