use of com.intellij.execution.RunManager in project intellij-plugins by JetBrains.
the class DartProjectTemplate method createWebRunConfiguration.
static void createWebRunConfiguration(@NotNull final Module module, @NotNull final VirtualFile htmlFile) {
DartModuleBuilder.runWhenNonModalIfModuleNotDisposed(() -> {
final WebBrowser dartium = DartiumUtil.getDartiumBrowser();
if (dartium == null)
return;
final Url url = WebBrowserServiceImpl.getDebuggableUrl(PsiManager.getInstance(module.getProject()).findFile(htmlFile));
if (url == null)
return;
final RunManager runManager = RunManager.getInstance(module.getProject());
try {
final RunnerAndConfigurationSettings settings = runManager.createRunConfiguration("", JavascriptDebugConfigurationType.getTypeInstance().getFactory());
((JavaScriptDebugConfiguration) settings.getConfiguration()).setUri(url.toDecodedForm());
((JavaScriptDebugConfiguration) settings.getConfiguration()).setEngineId(dartium.getId().toString());
settings.setName(((JavaScriptDebugConfiguration) settings.getConfiguration()).suggestedName());
runManager.addConfiguration(settings, false);
runManager.setSelectedConfiguration(settings);
} catch (Throwable t) {
/* ClassNotFound in IDEA Community or if JS Debugger plugin disabled */
}
}, module);
}
use of com.intellij.execution.RunManager in project intellij-plugins by JetBrains.
the class DartProjectTemplate method createCmdLineRunConfiguration.
static void createCmdLineRunConfiguration(@NotNull final Module module, @NotNull final VirtualFile mainDartFile) {
DartModuleBuilder.runWhenNonModalIfModuleNotDisposed(() -> {
final RunManager runManager = RunManager.getInstance(module.getProject());
final RunnerAndConfigurationSettings settings = runManager.createRunConfiguration("", DartCommandLineRunConfigurationType.getInstance().getConfigurationFactories()[0]);
final DartCommandLineRunConfiguration runConfiguration = (DartCommandLineRunConfiguration) settings.getConfiguration();
runConfiguration.getRunnerParameters().setFilePath(mainDartFile.getPath());
runConfiguration.getRunnerParameters().setWorkingDirectory(DartCommandLineRunnerParameters.suggestDartWorkingDir(module.getProject(), mainDartFile));
settings.setName(runConfiguration.suggestedName());
runManager.addConfiguration(settings, false);
runManager.setSelectedConfiguration(settings);
}, module);
}
use of com.intellij.execution.RunManager in project intellij-plugins by JetBrains.
the class RubyMotionUtilExt method createMotionRunConfiguration.
public static void createMotionRunConfiguration(final Module module) {
final Project project = module.getProject();
final String title = RBundle.message("rails.facet.builder.run.configuration.server.creating");
final Task task = new Task.Backgroundable(project, title, true) {
public void run(@NotNull ProgressIndicator indicator) {
indicator.setText(RBundle.message("progress.backgnd.indicator.title.please.wait", getTitle()));
final RunManager runManager = RunManager.getInstance(project);
ApplicationManager.getApplication().runReadAction(() -> {
// requires read action
// Rake : "simulator"
final String taskName = RubyMotionUtil.getInstance().getMainRakeTask(module);
final RunnerAndConfigurationSettings simulator = createAndAddRakeConfiguration(taskName, module, runManager);
// Rake : "spec"
createAndAddRakeConfiguration(RakeUtilBase.TASKS_SPEC_FULLCMD, module, runManager);
// make development config active
runManager.setSelectedConfiguration(simulator);
});
}
};
final Runnable taskRunner = () -> ProgressManager.getInstance().run(task);
if (!project.isInitialized()) {
StartupManager.getInstance(project).registerPostStartupActivity(taskRunner);
} else {
taskRunner.run();
}
}
use of com.intellij.execution.RunManager in project intellij-community by JetBrains.
the class AbstractRunConfigurationTypeUsagesCollector method getProjectUsages.
@NotNull
@Override
public final Set<UsageDescriptor> getProjectUsages(@NotNull final Project project) {
final Set<String> runConfigurationTypes = new HashSet<>();
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
if (project.isDisposed())
return;
final RunManager runManager = RunManager.getInstance(project);
for (RunnerAndConfigurationSettings settings : runManager.getAllSettings()) {
RunConfiguration runConfiguration = settings.getConfiguration();
if (runConfiguration != null && isApplicable(runManager, settings)) {
final ConfigurationFactory configurationFactory = runConfiguration.getFactory();
final ConfigurationType configurationType = configurationFactory.getType();
final StringBuilder keyBuilder = new StringBuilder();
keyBuilder.append(configurationType.getId());
if (configurationType.getConfigurationFactories().length > 1) {
keyBuilder.append(".").append(configurationFactory.getName());
}
runConfigurationTypes.add(keyBuilder.toString());
}
}
}
});
return ContainerUtil.map2Set(runConfigurationTypes, runConfigurationType -> new UsageDescriptor(runConfigurationType, 1));
}
use of com.intellij.execution.RunManager in project intellij-community by JetBrains.
the class PyRunConfigurationFactoryImpl method createRunConfiguration.
@Override
public RunnerAndConfigurationSettings createRunConfiguration(Module module, ConfigurationFactory factory) {
final Project project = module.getProject();
final RunManager runManager = RunManager.getInstance(project);
final RunnerAndConfigurationSettings settings = createConfigurationSettings(factory, module);
runManager.addConfiguration(settings, false);
runManager.setSelectedConfiguration(settings);
return settings;
}
Aggregations