use of com.intellij.lang.javascript.flex.flexunit.FlexUnitConnection in project intellij-plugins by JetBrains.
the class FlexRunner method launchWebFlexUnit.
protected RunContentDescriptor launchWebFlexUnit(final Project project, final RunContentDescriptor contentToReuse, final ExecutionEnvironment env, final FlexUnitRunnerParameters params, final String swfFilePath) throws ExecutionException {
final SwfPolicyFileConnection policyFileConnection = new SwfPolicyFileConnection();
policyFileConnection.open(params.getSocketPolicyPort());
final FlexUnitConnection flexUnitConnection = new FlexUnitConnection();
flexUnitConnection.open(params.getPort());
final ProcessHandler processHandler = new DefaultDebugProcessHandler() {
@Override
protected void destroyProcessImpl() {
flexUnitConnection.write("Finish");
flexUnitConnection.close();
policyFileConnection.close();
super.destroyProcessImpl();
}
@Override
public boolean detachIsDefault() {
return false;
}
};
final ExecutionConsole console = createFlexUnitRunnerConsole(project, env, processHandler);
flexUnitConnection.addListener(new FlexUnitListener(processHandler));
launchWithSelectedApplication(swfFilePath, params.getLauncherParameters());
final RunContentBuilder contentBuilder = new RunContentBuilder(new DefaultExecutionResult(console, processHandler), env);
Disposer.register(project, contentBuilder);
return contentBuilder.showRunContent(contentToReuse);
}
use of com.intellij.lang.javascript.flex.flexunit.FlexUnitConnection in project intellij-plugins by JetBrains.
the class FlexDebugProcess method openFlexUnitConnections.
private void openFlexUnitConnections(final int socketPolicyPort, final int port) {
try {
myPolicyFileConnection = new SwfPolicyFileConnection();
myPolicyFileConnection.open(socketPolicyPort);
myFlexUnitConnection = new FlexUnitConnection();
myFlexUnitConnection.addListener(new FlexUnitConnection.Listener() {
@Override
public void statusChanged(FlexUnitConnection.ConnectionStatus status) {
if (status == FlexUnitConnection.ConnectionStatus.CONNECTION_FAILED) {
getSession().stop();
}
}
@Override
public void onData(String line) {
getProcessHandler().notifyTextAvailable(line + "\n", ProcessOutputTypes.STDOUT);
}
@Override
public void onFinish() {
getProcessHandler().detachProcess();
}
});
myFlexUnitConnection.open(port);
} catch (ExecutionException e) {
Notifications.Bus.notify(new Notification(DEBUGGER_GROUP_ID, FlexBundle.message("flex.debugger.startup.error"), FlexBundle.message("flexunit.startup.error", e.getMessage()), NotificationType.ERROR), getSession().getProject());
myFlexUnitConnection = null;
myPolicyFileConnection = null;
}
}
use of com.intellij.lang.javascript.flex.flexunit.FlexUnitConnection in project intellij-plugins by JetBrains.
the class FlexRunner method launchAirFlexUnit.
@Nullable
protected RunContentDescriptor launchAirFlexUnit(final Project project, final RunProfileState state, final RunContentDescriptor contentToReuse, final ExecutionEnvironment env, final FlexUnitRunnerParameters params) throws ExecutionException {
final ExecutionResult executionResult;
final SwfPolicyFileConnection policyFileConnection = new SwfPolicyFileConnection();
policyFileConnection.open(params.getSocketPolicyPort());
final FlexUnitConnection flexUnitConnection = new FlexUnitConnection();
flexUnitConnection.open(params.getPort());
executionResult = state.execute(env.getExecutor(), this);
if (executionResult == null) {
flexUnitConnection.close();
policyFileConnection.close();
return null;
}
flexUnitConnection.addListener(new FlexUnitListener(executionResult.getProcessHandler()));
executionResult.getProcessHandler().addProcessListener(new ProcessAdapter() {
@Override
public void processWillTerminate(ProcessEvent event, boolean willBeDestroyed) {
flexUnitConnection.write("Finish");
}
@Override
public void processTerminated(ProcessEvent event) {
flexUnitConnection.close();
policyFileConnection.close();
}
});
final RunContentBuilder contentBuilder = new RunContentBuilder(executionResult, env);
return contentBuilder.showRunContent(contentToReuse);
}
Aggregations