Search in sources :

Example 16 with RunManagerEx

use of com.intellij.execution.RunManagerEx in project intellij-community by JetBrains.

the class ToggleBeforeRunTaskAction method doIsSelected.

@Override
protected boolean doIsSelected(AnActionEvent e) {
    final DataContext context = e.getDataContext();
    final Pair<MavenProject, String> desc = getTaskDesc(context);
    if (desc != null) {
        final RunManagerEx runManager = getRunManager(context);
        if (runManager == null)
            return false;
        for (MavenBeforeRunTask each : runManager.getBeforeRunTasks(MavenBeforeRunTasksProvider.ID)) {
            if (each.isFor(desc.first, desc.second))
                return true;
        }
    }
    return false;
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) MavenProject(org.jetbrains.idea.maven.project.MavenProject) RunManagerEx(com.intellij.execution.RunManagerEx) MavenBeforeRunTask(org.jetbrains.idea.maven.tasks.MavenBeforeRunTask)

Example 17 with RunManagerEx

use of com.intellij.execution.RunManagerEx in project intellij-community by JetBrains.

the class MavenTasksManager method getDescription.

public String getDescription(MavenProject project, String goal) {
    List<String> result = new ArrayList<>();
    MavenCompilerTask compilerTask = new MavenCompilerTask(project.getPath(), goal);
    synchronized (this) {
        for (Phase phase : Phase.values()) {
            if (myState.getTasks(phase).contains(compilerTask)) {
                result.add(TasksBundle.message(phase.myMessageKey));
            }
        }
    }
    RunManagerEx runManager = RunManagerEx.getInstanceEx(myProject);
    for (MavenBeforeRunTask each : runManager.getBeforeRunTasks(MavenBeforeRunTasksProvider.ID)) {
        if (each.isFor(project, goal)) {
            result.add(TasksBundle.message("maven.tasks.goal.before.run"));
            break;
        }
    }
    return StringUtil.join(result, ", ");
}
Also used : RunManagerEx(com.intellij.execution.RunManagerEx) ArrayList(java.util.ArrayList)

Example 18 with RunManagerEx

use of com.intellij.execution.RunManagerEx in project intellij-community by JetBrains.

the class MavenProjectsNavigator method listenForProjectsChanges.

private void listenForProjectsChanges() {
    myProjectsManager.addProjectsTreeListener(new MyProjectsListener());
    myShortcutsManager.addListener(new MavenShortcutsManager.Listener() {

        @Override
        public void shortcutsUpdated() {
            scheduleStructureRequest(() -> myStructure.updateGoals());
        }
    });
    myTasksManager.addListener(new MavenTasksManager.Listener() {

        @Override
        public void compileTasksChanged() {
            scheduleStructureRequest(() -> myStructure.updateGoals());
        }
    });
    RunManagerEx.getInstanceEx(myProject).addRunManagerListener(new RunManagerListener() {

        @Override
        public void beforeRunTasksChanged() {
            scheduleStructureRequest(() -> myStructure.updateGoals());
        }
    });
    MavenRunner.getInstance(myProject).getSettings().addListener(new MavenRunnerSettings.Listener() {

        @Override
        public void skipTestsChanged() {
            scheduleStructureRequest(() -> myStructure.updateGoals());
        }
    });
    ((RunManagerEx) RunManager.getInstance(myProject)).addRunManagerListener(new RunManagerListener() {

        private void changed() {
            scheduleStructureRequest(() -> myStructure.updateRunConfigurations());
        }

        @Override
        public void runConfigurationAdded(@NotNull RunnerAndConfigurationSettings settings) {
            changed();
        }

        @Override
        public void runConfigurationRemoved(@NotNull RunnerAndConfigurationSettings settings) {
            changed();
        }

        @Override
        public void runConfigurationChanged(@NotNull RunnerAndConfigurationSettings settings) {
            changed();
        }
    });
}
Also used : MavenRunnerSettings(org.jetbrains.idea.maven.execution.MavenRunnerSettings) RunManagerEx(com.intellij.execution.RunManagerEx) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) MavenTasksManager(org.jetbrains.idea.maven.tasks.MavenTasksManager) RunManagerListener(com.intellij.execution.RunManagerListener) MavenShortcutsManager(org.jetbrains.idea.maven.tasks.MavenShortcutsManager)

Example 19 with RunManagerEx

use of com.intellij.execution.RunManagerEx in project intellij-plugins by JetBrains.

the class CfmlRunConfigurationTest method getContextRunConfiguration.

private static CfmlRunConfiguration getContextRunConfiguration(Editor editor) {
    final DataContext dataContext = DataManager.getInstance().getDataContext(editor.getComponent());
    final ConfigurationContext configurationContext = ConfigurationContext.getFromContext(dataContext);
    //this block emulates RunContextAction.perform()
    RunnerAndConfigurationSettings configuration = configurationContext.findExisting();
    if (configuration == null) {
        configuration = configurationContext.getConfiguration();
        if (configuration == null) {
            return null;
        }
        ((RunManagerEx) configurationContext.getRunManager()).setTemporaryConfiguration(configuration);
    }
    //end of the emulated block
    return (CfmlRunConfiguration) configuration.getConfiguration();
}
Also used : ConfigurationContext(com.intellij.execution.actions.ConfigurationContext) RunManagerEx(com.intellij.execution.RunManagerEx) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) CfmlRunConfiguration(com.intellij.coldFusion.UI.runner.CfmlRunConfiguration)

Aggregations

RunManagerEx (com.intellij.execution.RunManagerEx)19 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)14 Project (com.intellij.openapi.project.Project)5 ConfigurationFactoryEx (com.intellij.execution.configuration.ConfigurationFactoryEx)3 ExternalTaskExecutionInfo (com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo)3 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)2 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)2 DataContext (com.intellij.openapi.actionSystem.DataContext)2 ArrayList (java.util.ArrayList)2 CfmlRunConfiguration (com.intellij.coldFusion.UI.runner.CfmlRunConfiguration)1 BeforeRunTask (com.intellij.execution.BeforeRunTask)1 RunManagerListener (com.intellij.execution.RunManagerListener)1 ConfigurationType (com.intellij.execution.configurations.ConfigurationType)1 RunnerAndConfigurationSettingsImpl (com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl)1 AntBeforeRunTask (com.intellij.lang.ant.config.impl.AntBeforeRunTask)1 ExecuteCompositeTargetEvent (com.intellij.lang.ant.config.impl.ExecuteCompositeTargetEvent)1 MetaTarget (com.intellij.lang.ant.config.impl.MetaTarget)1 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)1 ExternalSystemTaskExecutionSettings (com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)1 AbstractExternalSystemTaskConfigurationType (com.intellij.openapi.externalSystem.service.execution.AbstractExternalSystemTaskConfigurationType)1