use of com.intellij.flex.uiDesigner.debug.FlexRunner in project intellij-plugins by JetBrains.
the class AdlUtil method runDebugger.
// http://kb2.adobe.com/cps/407/kb407625.html
public static void runDebugger(final Module module, final Runnable postTask) throws ExecutionException {
final Project project = module.getProject();
final RunnerAndConfigurationSettings settings = RunManager.getInstance(project).createConfiguration("FlashUIDesigner", RemoteFlashRunConfigurationType.getFactory());
final RemoteFlashRunConfiguration configuration = (RemoteFlashRunConfiguration) settings.getConfiguration();
RunManagerEx.disableTasks(project, settings.getConfiguration(), CompileStepBeforeRun.ID, CompileStepBeforeRunNoErrorCheck.ID);
final Executor executor = DefaultDebugExecutor.getDebugExecutorInstance();
ProgramRunner.Callback callback = new ProgramRunner.Callback() {
@Override
public void processStarted(final RunContentDescriptor descriptor) {
final ProcessHandler processHandler = descriptor.getProcessHandler();
assert processHandler != null;
DesignerApplication application = DesignerApplicationManager.getApplication();
if (application != null) {
Disposer.register(application, new Disposable() {
@Override
public void dispose() {
if (!project.isDisposed()) {
ApplicationManager.getApplication().invokeLater(() -> ExecutionManager.getInstance(project).getContentManager().removeRunContent(executor, descriptor));
}
processHandler.destroyProcess();
}
});
postTask.run();
}
}
};
FlexBuildConfiguration buildConfiguration = FlexBuildConfigurationManager.getInstance(module).getActiveConfiguration();
configuration.getRunnerParameters().setModuleName(module.getName());
configuration.getRunnerParameters().setBCName(buildConfiguration.getName());
final FlexRunner runner = new FlexRunner(callback, buildConfiguration);
runner.execute(new ExecutionEnvironment(executor, runner, settings, project));
}
Aggregations