use of com.intellij.execution.process.ProcessHandler in project android by JetBrains.
the class HotswapAction method getActiveProcessHandler.
@Nullable
private static ProcessHandler getActiveProcessHandler(@Nullable Project project, @Nullable RunnerAndConfigurationSettings settings) {
if (project == null || settings == null) {
return null;
}
AndroidSessionInfo session = getAndroidSessionInfo(project, settings);
if (session == null) {
return null;
}
ProcessHandler processHandler = session.getProcessHandler();
if (processHandler.isProcessTerminated() || processHandler.isProcessTerminating()) {
return null;
}
return processHandler;
}
use of com.intellij.execution.process.ProcessHandler in project android by JetBrains.
the class HotswapAction method doUpdate.
@Override
protected void doUpdate(@NotNull AnActionEvent e, @NotNull Project project) {
Presentation presentation = e.getPresentation();
presentation.setEnabled(false);
if (!InstantRunSettings.isInstantRunEnabled()) {
presentation.setText("Apply Changes: Instant Run has been disabled");
return;
}
RunnerAndConfigurationSettings settings = RunManager.getInstance(project).getSelectedConfiguration();
if (settings == null) {
presentation.setText("Apply Changes: No run configuration selected");
return;
}
AndroidSessionInfo session = getAndroidSessionInfo(project, settings);
if (session == null) {
presentation.setText(String.format("Apply Changes: No active '%1$s' launch", settings.getName()));
return;
}
ProcessHandler processHandler = getActiveProcessHandler(project, settings);
if (processHandler == null) {
presentation.setText(String.format("Apply Changes: No active '%1$s' launch", settings.getName()));
return;
}
RunConfiguration configuration = settings.getConfiguration();
if (!(configuration instanceof ModuleBasedConfiguration)) {
presentation.setText(String.format("Apply Changes: '%1$s' is not a module based configuration", settings.getName()));
return;
}
Module module = ((ModuleBasedConfiguration) configuration).getConfigurationModule().getModule();
if (module == null) {
presentation.setText(String.format("Apply Changes: No module specified in '%1$s'", settings.getName()));
return;
}
if (!(configuration instanceof AndroidRunConfigurationBase)) {
presentation.setText(String.format("Apply Changes: '%1$s' is not an Android launch configuration", settings.getName()));
return;
}
if (!((AndroidRunConfigurationBase) configuration).supportsInstantRun()) {
presentation.setText(String.format("Apply Changes: Configuration '%1$s' does not support instant run", settings.getName()));
return;
}
AndroidVersion androidVersion = InstantRunManager.getMinDeviceApiLevel(processHandler);
if (androidVersion == null) {
presentation.setText(String.format("Apply Changes: Cannot locate device from '%1$s'", settings.getName()));
return;
}
if (!InstantRunManager.isInstantRunCapableDeviceVersion(androidVersion)) {
presentation.setText(String.format("Apply Changes: Target device API level (%1$s) too low for Instant Run", androidVersion));
return;
}
InstantRunGradleSupport status = InstantRunGradleUtils.getIrSupportStatus(InstantRunGradleUtils.getAppModel(module), androidVersion);
if (status != SUPPORTED) {
String notification = status.getUserNotification();
if (notification == null) {
notification = status.toString();
}
presentation.setText("Apply Changes: " + notification);
return;
}
presentation.setText("Apply Changes" + getShortcutText());
presentation.setEnabled(true);
}
use of com.intellij.execution.process.ProcessHandler in project android by JetBrains.
the class AndroidRunConfiguration method getConsoleProvider.
@NotNull
@Override
protected ConsoleProvider getConsoleProvider() {
return new ConsoleProvider() {
@NotNull
@Override
public ConsoleView createAndAttach(@NotNull Disposable parent, @NotNull ProcessHandler handler, @NotNull Executor executor) throws ExecutionException {
Project project = getConfigurationModule().getProject();
final TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
ConsoleView console = builder.getConsole();
console.attachToProcess(handler);
return console;
}
};
}
use of com.intellij.execution.process.ProcessHandler in project intellij-plugins by JetBrains.
the class CfmlUnitRunConfiguration method getState.
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException {
return new RunProfileState() {
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
final ProcessHandler processHandler = new MyProcessHandler();
final ConsoleView console = createConsole(getProject(), processHandler, env, executor);
console.addMessageFilter(new CfmlStackTraceFilterProvider(getProject()));
// processHandler.startNotify();
runTests(processHandler);
return new DefaultExecutionResult(console, processHandler);
}
};
}
use of com.intellij.execution.process.ProcessHandler in project intellij-plugins by JetBrains.
the class FlexRunner method doExecute.
@Override
protected RunContentDescriptor doExecute(@NotNull final RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException {
final BCBasedRunnerParameters parameters = ((RemoteFlashRunConfiguration) env.getRunProfile()).getRunnerParameters();
RunContentDescriptor runContentDescriptor = XDebuggerManager.getInstance(env.getProject()).startSession(env, new XDebugProcessStarter() {
@Override
@NotNull
public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException {
try {
return DebugPathManager.IS_DEV ? new MyFlexDebugProcessAbleToResolveFileDebugId(callback, session, buildConfiguration, parameters) : new MyFlexDebugProcess(callback, session, buildConfiguration, parameters);
} catch (IOException e) {
throw new ExecutionException(e.getMessage(), e);
} finally {
buildConfiguration = null;
}
}
}).getRunContentDescriptor();
ProcessHandler processHandler = runContentDescriptor.getProcessHandler();
assert processHandler != null;
//noinspection deprecation
processHandler.putUserData(ProcessHandler.SILENTLY_DESTROY_ON_CLOSE, true);
return runContentDescriptor;
}
Aggregations