Search in sources :

Example 6 with RunManager

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);
}
Also used : WebBrowser(com.intellij.ide.browsers.WebBrowser) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) JavaScriptDebugConfiguration(com.intellij.javascript.debugger.execution.JavaScriptDebugConfiguration) RunManager(com.intellij.execution.RunManager) Url(com.intellij.util.Url)

Example 7 with RunManager

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);
}
Also used : DartCommandLineRunConfiguration(com.jetbrains.lang.dart.ide.runner.server.DartCommandLineRunConfiguration) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) RunManager(com.intellij.execution.RunManager)

Example 8 with RunManager

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();
    }
}
Also used : Project(com.intellij.openapi.project.Project) Task(com.intellij.openapi.progress.Task) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) NotNull(org.jetbrains.annotations.NotNull) RunManager(com.intellij.execution.RunManager)

Example 9 with RunManager

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));
}
Also used : ConfigurationType(com.intellij.execution.configurations.ConfigurationType) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) RunManager(com.intellij.execution.RunManager) HashSet(com.intellij.util.containers.HashSet) NotNull(org.jetbrains.annotations.NotNull)

Example 10 with RunManager

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;
}
Also used : Project(com.intellij.openapi.project.Project) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) RunManager(com.intellij.execution.RunManager)

Aggregations

RunManager (com.intellij.execution.RunManager)18 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)11 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)3 Nullable (org.jetbrains.annotations.Nullable)3 JSTestOptions (com.intellij.lang.javascript.JSTestOptions)2 Project (com.intellij.openapi.project.Project)2 NotNull (org.jetbrains.annotations.NotNull)2 AndroidRunConfiguration (com.android.tools.idea.run.AndroidRunConfiguration)1 AndroidRunConfigurationBase (com.android.tools.idea.run.AndroidRunConfigurationBase)1 AndroidRunConfigurationType (com.android.tools.idea.run.AndroidRunConfigurationType)1 TargetSelectionMode (com.android.tools.idea.run.TargetSelectionMode)1 PhoneGapConfigurationType (com.github.masahirosuzuka.PhoneGapIntelliJPlugin.runner.PhoneGapConfigurationType)1 PhoneGapRunConfiguration (com.github.masahirosuzuka.PhoneGapIntelliJPlugin.runner.PhoneGapRunConfiguration)1 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)1 ConfigurationType (com.intellij.execution.configurations.ConfigurationType)1 WebBrowser (com.intellij.ide.browsers.WebBrowser)1 UsageDescriptor (com.intellij.internal.statistic.beans.UsageDescriptor)1 JavaScriptDebugConfiguration (com.intellij.javascript.debugger.execution.JavaScriptDebugConfiguration)1 PreferableRunConfiguration (com.intellij.javascript.testFramework.PreferableRunConfiguration)1 FlashRunConfiguration (com.intellij.lang.javascript.flex.run.FlashRunConfiguration)1