blob: 32183ef43bd1745841d65ba50fd94ad41bbd44bc [file] [log] [blame]
/*
* Copyright 2016 The Bazel Authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.idea.blaze.android.run.binary;
import com.android.tools.idea.run.ConsoleProvider;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.Executor;
import com.intellij.execution.filters.TextConsoleBuilder;
import com.intellij.execution.filters.TextConsoleBuilderFactory;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.ui.ConsoleView;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
/** Console provider for android_binary */
public class BlazeAndroidBinaryConsoleProvider implements ConsoleProvider {
private final Project project;
public BlazeAndroidBinaryConsoleProvider(Project project) {
this.project = project;
}
@NotNull
@Override
public ConsoleView createAndAttach(
@NotNull Disposable parent, @NotNull ProcessHandler handler, @NotNull Executor executor)
throws ExecutionException {
final TextConsoleBuilder builder =
TextConsoleBuilderFactory.getInstance().createBuilder(project);
ConsoleView console = builder.getConsole();
console.attachToProcess(handler);
return console;
}
}