Search in sources :

Example 1 with JstdToolWindowManager

use of com.google.jstestdriver.idea.server.ui.JstdToolWindowManager in project intellij-plugins by JetBrains.

the class JstdRunProgramRunner method execute.

@NotNull
@Override
protected Promise<RunContentDescriptor> execute(@NotNull ExecutionEnvironment environment, @NotNull RunProfileState state) throws ExecutionException {
    JstdRunProfileState jstdState = JstdRunProfileState.cast(state);
    if (jstdState.getRunSettings().isExternalServerType()) {
        return Promise.resolve(start(null, false, state, environment));
    }
    JstdToolWindowManager jstdToolWindowManager = JstdToolWindowManager.getInstance(environment.getProject());
    jstdToolWindowManager.setAvailable(true);
    JstdServer server = JstdServerRegistry.getInstance().getServer();
    if (server != null && !server.isStopped()) {
        return Promise.resolve(start(server, false, state, environment));
    }
    return jstdToolWindowManager.restartServer().thenAsync(it -> {
        try {
            return it == null ? null : Promises.resolvedPromise(start(it, false, state, environment));
        } catch (ExecutionException e) {
            return Promises.rejectedPromise(e);
        }
    });
}
Also used : JstdToolWindowManager(com.google.jstestdriver.idea.server.ui.JstdToolWindowManager) JstdServer(com.google.jstestdriver.idea.server.JstdServer) ExecutionException(com.intellij.execution.ExecutionException) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with JstdToolWindowManager

use of com.google.jstestdriver.idea.server.ui.JstdToolWindowManager in project intellij-plugins by JetBrains.

the class JstdCoverageProgramRunner method execute.

@NotNull
@Override
protected Promise<RunContentDescriptor> execute(@NotNull ExecutionEnvironment environment, @NotNull RunProfileState state) throws ExecutionException {
    if (JstdRunProfileState.cast(state).getRunSettings().isExternalServerType()) {
        return Promise.resolve(null);
    }
    JstdToolWindowManager jstdToolWindowManager = JstdToolWindowManager.getInstance(environment.getProject());
    jstdToolWindowManager.setAvailable(true);
    JstdServer server = JstdServerRegistry.getInstance().getServer();
    if (server != null && !server.isStopped()) {
        return Promise.resolve(start(server, environment));
    }
    return jstdToolWindowManager.restartServer().thenAsync(it -> {
        try {
            return it == null ? null : Promises.resolvedPromise(start(it, environment));
        } catch (ExecutionException e) {
            return Promises.rejectedPromise(e);
        }
    });
}
Also used : JstdToolWindowManager(com.google.jstestdriver.idea.server.ui.JstdToolWindowManager) JstdServer(com.google.jstestdriver.idea.server.JstdServer) ExecutionException(com.intellij.execution.ExecutionException) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

JstdServer (com.google.jstestdriver.idea.server.JstdServer)2 JstdToolWindowManager (com.google.jstestdriver.idea.server.ui.JstdToolWindowManager)2 ExecutionException (com.intellij.execution.ExecutionException)2 NotNull (org.jetbrains.annotations.NotNull)2