com.intellij.execution.RunnerAndConfigurationSettings Java Examples

The following examples show how to use com.intellij.execution.RunnerAndConfigurationSettings. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RunConfigurationNode.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected void update(PresentationData presentation) {
  RunnerAndConfigurationSettings configurationSettings = getConfigurationSettings();
  boolean isStored = RunManager.getInstance(getProject()).hasSettings(configurationSettings);
  presentation.addText(configurationSettings.getName(),
                       isStored ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.GRAY_ATTRIBUTES);
  RunDashboardContributor contributor = RunDashboardContributor.getContributor(configurationSettings.getType());
  Image icon = null;
  if (contributor != null) {
    DashboardRunConfigurationStatus status = contributor.getStatus(this);
    if (DashboardRunConfigurationStatus.STARTED.equals(status)) {
      icon = getExecutorIcon();
    }
    else if (DashboardRunConfigurationStatus.FAILED.equals(status)) {
      icon = status.getIcon();
    }
  }
  if (icon == null) {
    icon = RunManagerEx.getInstanceEx(getProject()).getConfigurationIcon(configurationSettings);
  }
  presentation.setIcon(isStored ? icon : ImageEffects.grayed(icon));

  if (contributor != null) {
    contributor.updatePresentation(presentation, this);
  }
}
 
Example #2
Source File: QuickRunRootMavenGoalAction.java    From MavenHelper with Apache License 2.0 6 votes vote down vote up
@Override
protected void fillActions(final Project currentProject, DefaultActionGroup group, DataContext dataContext) {
	if (currentProject != null) {
		group.addAll(new RootMavenActionGroup() {

			@Override
			protected void addTestFile(List<AnAction> result) {
				QuickRunRootMavenGoalAction.this.addTestFile(result);
			}

			@Override
			protected AnAction getRunConfigurationAction(Project project, RunnerAndConfigurationSettings cfg) {
				return QuickRunRootMavenGoalAction.this.getRunConfigurationAction(project, cfg);
			}
			@Override
			protected AnAction createGoalRunAction(Goal goal, final Icon icon, boolean plugin, MavenProjectInfo mavenProject) {
				return QuickRunRootMavenGoalAction.this.createGoalRunAction(goal, icon, plugin, mavenProject);
			}
		}.getActions(dataContext, currentProject));
	}
}
 
Example #3
Source File: QuickRunMavenGoalAction.java    From MavenHelper with Apache License 2.0 6 votes vote down vote up
@Override
protected void fillActions(final Project currentProject, DefaultActionGroup group, DataContext dataContext) {
	if (currentProject != null) {
		group.addAll(new MainMavenActionGroup() {

			@Override
			protected void addTestFile(List<AnAction> result) {
				QuickRunMavenGoalAction.this.addTestFile(result);
			}

			@Override
			protected AnAction getRunConfigurationAction(Project project, RunnerAndConfigurationSettings cfg) {
				return QuickRunMavenGoalAction.this.getRunConfigurationAction(project, cfg);
			}

			@Override
			protected AnAction createGoalRunAction(Goal goal, final Icon icon, boolean plugin, MavenProjectInfo mavenProject) {
				return QuickRunMavenGoalAction.this.createGoalRunAction(goal, icon, plugin, mavenProject);
			}
		}.getActions(dataContext, currentProject));
	}
}
 
Example #4
Source File: AbstractExternalSystemRuntimeConfigurationProducer.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
protected RunnerAndConfigurationSettings createConfigurationByElement(Location location, ConfigurationContext context) {
  if (!(location instanceof ExternalSystemTaskLocation)) {
    return null;
  }
  
  ExternalSystemTaskLocation taskLocation = (ExternalSystemTaskLocation)location;
  mySourceElement = taskLocation.getPsiElement();

  RunManagerEx runManager = RunManagerEx.getInstanceEx(taskLocation.getProject());
  RunnerAndConfigurationSettings settings = runManager.createConfiguration("", getConfigurationFactory());
  ExternalSystemRunConfiguration configuration = (ExternalSystemRunConfiguration)settings.getConfiguration();
  ExternalSystemTaskExecutionSettings taskExecutionSettings = configuration.getSettings();
  ExternalTaskExecutionInfo task = taskLocation.getTaskInfo();
  taskExecutionSettings.setExternalProjectPath(task.getSettings().getExternalProjectPath());
  taskExecutionSettings.setTaskNames(task.getSettings().getTaskNames());
  configuration.setName(AbstractExternalSystemTaskConfigurationType.generateName(location.getProject(), taskExecutionSettings));
  return settings;
}
 
Example #5
Source File: HaxeModuleBuilder.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
private void createDefaultRunConfiguration(Module module, String buildHxmlPath) {
  HaxeModuleSettings settings = HaxeModuleSettings.getInstance(module);
  settings.setHaxeTarget(HaxeTarget.INTERP);
  settings.setBuildConfig(HaxeConfiguration.HXML.asBuildConfigValue());
  settings.setHxmlPath(buildHxmlPath);
  RunManager manager = RunManager.getInstance(module.getProject());
  HaxeRunConfigurationType configType = HaxeRunConfigurationType.getInstance();
  if(manager.getConfigurationsList(configType).isEmpty()) {
    ConfigurationFactory factory = configType.getConfigurationFactories()[0];
    HaxeApplicationConfiguration config = (HaxeApplicationConfiguration)factory.createTemplateConfiguration(module.getProject());
    config.setName("Execute");
    config.setModule(module);
    RunnerAndConfigurationSettings runSettings = manager.createConfiguration(config, factory);
    manager.addConfiguration(runSettings, false);
    manager.setSelectedConfiguration(runSettings);
  }
}
 
Example #6
Source File: HaxeProjectConfigurationUpdater.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
private void setupHxmlRunConfigurations(Module module) {
  RunManager manager = RunManager.getInstance(module.getProject());
  HaxeRunConfigurationType configType = HaxeRunConfigurationType.getInstance();
  ConfigurationFactory factory = configType.getConfigurationFactories()[0];

  HaxeModuleSettings settings = HaxeModuleSettings.getInstance(module);
  String hxmlPath = settings.getHxmlPath();
  if(hxmlPath != null && !hxmlPath.isEmpty()) {
    HaxeApplicationConfiguration config = (HaxeApplicationConfiguration)factory.createTemplateConfiguration(module.getProject());
    config.setName(module.getName() + " " + new File(hxmlPath).getName());
    config.setModule(module);
    RunnerAndConfigurationSettings runSettings = manager.createConfiguration(config, factory);
    manager.addConfiguration(runSettings, false);
    manager.setSelectedConfiguration(runSettings);
  }
}
 
Example #7
Source File: CompoundRunConfigurationSettingsEditor.java    From consulo with Apache License 2.0 6 votes vote down vote up
private boolean canBeAdded(@Nonnull RunConfiguration candidate, @Nonnull final CompoundRunConfiguration root) {
  if (candidate.getType() == root.getType() && candidate.getName().equals(root.getName())) return false;
  List<BeforeRunTask> tasks = myRunManager.getBeforeRunTasks(candidate);
  for (BeforeRunTask task : tasks) {
    if (task instanceof RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask) {
      RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask runTask
              = (RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask)task;
      RunnerAndConfigurationSettings settings = runTask.getSettings();
      if (settings != null) {
        if (!canBeAdded(settings.getConfiguration(), root)) return false;
      }
    }
  }
  if (candidate instanceof CompoundRunConfiguration) {
    Set<RunConfiguration> set = ((CompoundRunConfiguration)candidate).getSetToRun();
    for (RunConfiguration configuration : set) {
      if (!canBeAdded(configuration, root)) return false;
    }
  }
  return true;
}
 
Example #8
Source File: MongoScriptRunConfigurationProducer.java    From nosql4idea with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
protected RunnerAndConfigurationSettings createConfigurationByElement(Location location, ConfigurationContext configurationContext) {
    sourceFile = location.getPsiElement().getContainingFile();
    if (sourceFile != null && sourceFile.getFileType().getName().toLowerCase().contains("javascript")) {
        Project project = sourceFile.getProject();

        VirtualFile file = sourceFile.getVirtualFile();

        RunnerAndConfigurationSettings settings = cloneTemplateConfiguration(project, configurationContext);

        MongoRunConfiguration runConfiguration = (MongoRunConfiguration) settings.getConfiguration();
        runConfiguration.setName(file.getName());

        runConfiguration.setScriptPath(file.getPath());

        Module module = ModuleUtil.findModuleForPsiElement(location.getPsiElement());
        if (module != null) {
            runConfiguration.setModule(module);
        }

        return settings;
    }
    return null;
}
 
Example #9
Source File: PantsPythonRunConfigListener.java    From intellij-pants-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public void runConfigurationAdded(@NotNull RunnerAndConfigurationSettings settings) {
  if (myProject.isDefault() || !PantsUtil.isPantsProject(myProject)) {
    return;
  }

  final RunConfiguration runConfiguration = settings.getConfiguration();
  if (runConfiguration instanceof AbstractPythonRunConfiguration) {
    AbstractPythonRunConfiguration<?> configuration = (AbstractPythonRunConfiguration<?>) runConfiguration;
    String workingDirectory = configuration.getWorkingDirectory();
    if (StringUtil.isEmpty(workingDirectory)) {
      PantsUtil.findBuildRoot(myProject)
        .map(VirtualFile::getCanonicalPath)
        .ifPresent(configuration::setWorkingDirectory);
    }
  }
}
 
Example #10
Source File: PantsIntegrationTestCase.java    From intellij-pants-plugin with Apache License 2.0 6 votes vote down vote up
protected void assertAndRunPantsMake(JUnitConfiguration runConfiguration) {

    RunManager runManager = RunManager.getInstance(myProject);
    assertTrue(runManager instanceof RunManagerImpl);
    RunManagerImpl runManagerImpl = (RunManagerImpl) runManager;

    RunnerAndConfigurationSettings runnerAndConfigurationSettings =
      runManagerImpl.createConfiguration(runConfiguration, JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
    runManagerImpl.addConfiguration(runnerAndConfigurationSettings, false);

    // Make sure PantsMake is the one and only task before JUnit run.
    List<BeforeRunTask<?>> beforeRunTaskList = runManagerImpl.getBeforeRunTasks(runConfiguration);
    assertEquals(1, beforeRunTaskList.size());
    BeforeRunTask task = beforeRunTaskList.iterator().next();
    assertEquals(PantsMakeBeforeRun.ID, task.getProviderId());

    /*
     * Manually invoke BeforeRunTask as {@link ExecutionManager#compileAndRun} launches another task asynchronously,
     * and there is no way to catch that.
     */
    BeforeRunTaskProvider provider = BeforeRunTaskProvider.getProvider(myProject, task.getProviderId());
    assertNotNull(String.format("Cannot find BeforeRunTaskProvider for id='%s'", task.getProviderId()), provider);
    assertTrue(provider.executeTask(null, runConfiguration, null, task));
  }
 
Example #11
Source File: RunConfigurationProducer.java    From consulo with Apache License 2.0 6 votes vote down vote up
/**
 * Searches the list of existing run configurations to find one created from this context. Returns one if found, or tries to create
 * a new configuration from this context if not found.
 *
 * @param context contains the information about a location in the source code.
 * @return a configuration (new or existing) matching the context, or null if the context is not applicable to this producer.
 */
@javax.annotation.Nullable
public ConfigurationFromContext findOrCreateConfigurationFromContext(ConfigurationContext context) {
  Location location = context.getLocation();
  if (location == null) {
    return null;
  }

  ConfigurationFromContext fromContext = createConfigurationFromContext(context);
  if (fromContext != null) {
    final PsiElement psiElement = fromContext.getSourceElement();
    final Location<PsiElement> _location = PsiLocation.fromPsiElement(psiElement, location.getModule());
    if (_location != null) {
      // replace with existing configuration if any
      final RunManager runManager = RunManager.getInstance(context.getProject());
      final RunnerAndConfigurationSettings settings = findExistingConfiguration(context);
      if (settings != null) {
        fromContext.setConfigurationSettings(settings);
      } else {
        runManager.setUniqueNameIfNeed(fromContext.getConfiguration());
      }
    }
  }

  return fromContext;
}
 
Example #12
Source File: AutoSwitcher.java    From JHelper with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void addSelectedConfigurationListener() {
	RunManagerImpl.getInstanceImpl(project).addRunManagerListener(new RunManagerListener() {
		@Override
		public void runConfigurationSelected(RunnerAndConfigurationSettings selectedConfiguration) {
			if (selectedConfiguration == null) {
				return;
			}
			RunConfiguration configuration = selectedConfiguration.getConfiguration();
			if (busy || !(configuration instanceof TaskConfiguration)) {
				return;
			}
			busy = true;
			String pathToClassFile = ((TaskConfiguration) configuration).getCppPath();
			VirtualFile toOpen = project.getBaseDir().findFileByRelativePath(pathToClassFile);
			if (toOpen != null) {
				TransactionGuard.getInstance().submitTransactionAndWait(() -> FileEditorManager.getInstance(project).openFile(
						toOpen,
						true
				));
			}
			busy = false;
		}
	});
}
 
Example #13
Source File: TaskUtils.java    From JHelper with GNU Lesser General Public License v3.0 6 votes vote down vote up
private static void createConfigurationForTask(Project project, TaskData taskData) {
	TaskConfigurationType configurationType = new TaskConfigurationType();
	ConfigurationFactory factory = configurationType.getConfigurationFactories()[0];

	RunManager manager = RunManager.getInstance(project);
	TaskConfiguration taskConfiguration = new TaskConfiguration(
			project,
			factory
	);
	taskConfiguration.setFromTaskData(taskData);
	RunnerAndConfigurationSettings configuration = manager.createConfiguration(
			taskConfiguration,
			factory
	);
	manager.addConfiguration(configuration, true);

	manager.setSelectedConfiguration(configuration);
}
 
Example #14
Source File: TaskConfigurationTargetProvider.java    From JHelper with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public @NotNull List<ExecutionTarget> getTargets(
		@NotNull Project project,
		@NotNull RunConfiguration configuration
) {
	if (!(configuration instanceof TaskConfiguration)) {
		return Collections.emptyList();
	}
	RunnerAndConfigurationSettings testRunner = TaskRunner.getRunnerSettings(project);
	if (testRunner == null) {
		return Collections.emptyList();
	}
	List<ExecutionTarget> runnerTargets = ExecutionTargetManager.getInstance(project).getTargetsFor(testRunner.getConfiguration());
	List<ExecutionTarget> myTargets = new ArrayList<>();
	for (ExecutionTarget target : runnerTargets) {
		myTargets.add(new TaskConfigurationExecutionTarget(target));
	}
	return myTargets;
}
 
Example #15
Source File: RunConfigurationSerializer.java    From intellij with Apache License 2.0 6 votes vote down vote up
/**
 * Returns true if there's either no matching configuration already in the project, or the
 * matching configuration is marked as 'keep in sync'.
 */
@VisibleForTesting
static boolean shouldLoadConfiguration(Project project, Element element)
    throws InvalidDataException {
  RunnerAndConfigurationSettings existing = findExisting(project, element);
  if (existing == null) {
    return true;
  }
  RunConfiguration config = existing.getConfiguration();
  if (!(config instanceof BlazeRunConfiguration)) {
    // always overwrite non-blaze run configurations
    return true;
  }
  BlazeRunConfiguration blazeConfig = (BlazeRunConfiguration) config;
  Boolean keepInSync = blazeConfig.getKeepInSync();
  if (keepInSync == null) {
    // if the matching configuration was never previously imported, don't overwrite, but activate
    // the UI option to keep it in sync.
    blazeConfig.setKeepInSync(false);
    return false;
  }
  return keepInSync;
}
 
Example #16
Source File: RunConfigurationsSEContributor.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
private static Executor findExecutor(@Nonnull RunnerAndConfigurationSettings settings, @MagicConstant(intValues = {RUN_MODE, DEBUG_MODE}) int mode) {
  Executor runExecutor = DefaultRunExecutor.getRunExecutorInstance();
  Executor debugExecutor = ExecutorRegistry.getInstance().getExecutorById(ToolWindowId.DEBUG);

  Executor executor = mode == RUN_MODE ? runExecutor : debugExecutor;
  if (executor == null) {
    return null;
  }

  RunConfiguration runConf = settings.getConfiguration();
  if (ProgramRunner.getRunner(executor.getId(), runConf) == null) {
    executor = runExecutor == executor ? debugExecutor : runExecutor;
  }

  return executor;
}
 
Example #17
Source File: BlazeRunConfigurationSyncListener.java    From intellij with Apache License 2.0 6 votes vote down vote up
/**
 * Adds a run configuration for an android_binary target if there is not already a configuration
 * for that target.
 */
private static void maybeAddRunConfiguration(
    Project project, BlazeProjectData blazeProjectData, Label label) {
  RunManager runManager = RunManager.getInstance(project);

  for (BlazeRunConfigurationFactory configurationFactory :
      BlazeRunConfigurationFactory.EP_NAME.getExtensions()) {
    if (configurationFactory.handlesTarget(project, blazeProjectData, label)) {
      final RunnerAndConfigurationSettings settings =
          configurationFactory.createForTarget(project, runManager, label);
      runManager.addConfiguration(settings, /* isShared= */ false);
      if (runManager.getSelectedConfiguration() == null) {
        runManager.setSelectedConfiguration(settings);
      }
      break;
    }
  }
}
 
Example #18
Source File: BaseRunConfigurationAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void update(final AnActionEvent event) {
  final ConfigurationContext context = ConfigurationContext.getFromContext(event.getDataContext());
  final Presentation presentation = event.getPresentation();
  final RunnerAndConfigurationSettings existing = context.findExisting();
  RunnerAndConfigurationSettings configuration = existing;
  if (configuration == null) {
    configuration = context.getConfiguration();
  }
  if (configuration == null) {
    presentation.setEnabled(false);
    presentation.setVisible(false);
  }
  else {
    presentation.setEnabled(true);
    presentation.setVisible(true);
    final List<ConfigurationFromContext> fromContext = getConfigurationsFromContext(context);
    if (existing == null && !fromContext.isEmpty()) {
      //todo[nik,anna] it's dirty fix. Otherwise wrong configuration will be returned from context.getConfiguration()
      context.setConfiguration(fromContext.get(0).getConfigurationSettings());
    }
    final String name = suggestRunActionName((LocatableConfiguration)configuration.getConfiguration());
    updatePresentation(presentation, existing != null || fromContext.size() <= 1 ? name : "", context);
  }
}
 
Example #19
Source File: EditTestsAction.java    From JHelper with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected void performAction(AnActionEvent e) {
	Project project = e.getProject();
	RunnerAndConfigurationSettings selectedConfiguration =
			RunManagerImpl.getInstanceImpl(project).getSelectedConfiguration();
	if (selectedConfiguration == null) {
		return;
	}
	RunConfiguration configuration = selectedConfiguration.getConfiguration();
	if (configuration instanceof TaskConfiguration) {
		TaskConfiguration taskConfiguration = (TaskConfiguration) configuration;
		Test[] originalTests = taskConfiguration.getTests();
		EditTestsDialog dialog = new EditTestsDialog(originalTests, project);
		dialog.show();
		if (!dialog.isOK()) {
			return;
		}
		Test[] newTests = dialog.getTests();
		taskConfiguration.setTests(newTests);

		// @todo: save configuration
	}
}
 
Example #20
Source File: ProjectUtils.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 6 votes vote down vote up
/**
 * adds run configuration dynamically
 * @param module
 * @param mainClass
 * @param boardName
 */
public static void addProjectConfiguration(final Module module, final String mainClass, final String boardName) {
    final Runnable r = new Runnable() {
        @Override
        public void run() {
            final RunManager runManager = RunManager.getInstance(module.getProject());
            final RunnerAndConfigurationSettings settings = runManager.
                    createRunConfiguration(module.getName(), EmbeddedLinuxJVMConfigurationType.getInstance().getFactory());
            final EmbeddedLinuxJVMRunConfiguration configuration = (EmbeddedLinuxJVMRunConfiguration) settings.getConfiguration();

            configuration.setName(EmbeddedLinuxJVMBundle.message("runner.name", boardName));
            configuration.getRunnerParameters().setRunAsRoot(true);
            configuration.getRunnerParameters().setMainclass(mainClass);

            runManager.addConfiguration(settings, false);
            runManager.setSelectedConfiguration(settings);

            final Notification notification = new Notification(
                    Notifications.GROUPDISPLAY_ID,
                    EmbeddedLinuxJVMBundle.getString("pi.connection.required"), EmbeddedLinuxJVMBundle.message("pi.connection.notsetup", boardName),
                    NotificationType.INFORMATION);
            com.intellij.notification.Notifications.Bus.notify(notification);
        }
    };
    r.run();
}
 
Example #21
Source File: BeforeRunStepsPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
void doReset(RunnerAndConfigurationSettings settings) {
  myRunConfiguration = settings.getConfiguration();

  originalTasks.clear();
  RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(myRunConfiguration.getProject());
  originalTasks.addAll(runManager.getBeforeRunTasks(myRunConfiguration));
  myModel.replaceAll(originalTasks);
  myShowSettingsBeforeRunCheckBox.setSelected(settings.isEditBeforeRun());
  myShowSettingsBeforeRunCheckBox.setEnabled(!(isUnknown()));
  myPanel.setVisible(checkBeforeRunTasksAbility(false));
  updateText();
}
 
Example #22
Source File: DebugConfigurationAction.java    From MavenHelper with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(final AnActionEvent event) {
	if (!myEnabled) return;

	final RunnerAndConfigurationSettings configurationSettings = clone(mySettings);
	addForkMode(configurationSettings);

	MavenDebugConfigurationType.debugConfiguration(myProject, null, configurationSettings, myExecutor);
}
 
Example #23
Source File: MavenDebugConfigurationType.java    From MavenHelper with Apache License 2.0 5 votes vote down vote up
public static void debugConfiguration(Project project, @NotNull MavenRunnerParameters params,
		@Nullable MavenGeneralSettings settings, @Nullable MavenRunnerSettings runnerSettings,
		@Nullable ProgramRunner.Callback callback) {

	RunnerAndConfigurationSettings configSettings = MavenRunConfigurationType.createRunnerAndConfigurationSettings(
			settings, runnerSettings, params, project);
	final Executor executor = DefaultDebugExecutor.getDebugExecutorInstance();

	debugConfiguration(project, callback, configSettings, executor);
}
 
Example #24
Source File: CreateAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static BaseCreatePolicy choosePolicy(final ConfigurationContext context) {
  final RunnerAndConfigurationSettings configuration = context.findExisting();
  if (configuration == null) return CREATE_AND_EDIT;
  final RunManager runManager = context.getRunManager();
  if (runManager.getSelectedConfiguration() != configuration) return SELECT;
  if (configuration.isTemporary()) return SAVE;
  return SELECTED_STABLE;
}
 
Example #25
Source File: BaseRunConfigurationAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public boolean canBePerformed(DataContext dataContext) {
  final ConfigurationContext context = ConfigurationContext.getFromContext(dataContext);
  final RunnerAndConfigurationSettings existing = context.findExisting();
  if (existing == null) {
    final List<ConfigurationFromContext> fromContext = getConfigurationsFromContext(context);
    return fromContext.size() <= 1;
  }
  return true;
}
 
Example #26
Source File: DeleteTaskAction.java    From JHelper with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void selectSomeTaskConfiguration(RunManagerEx runManager) {
	for (RunnerAndConfigurationSettings settings : runManager.getAllSettings()) {
		if (settings.getConfiguration() instanceof TaskConfiguration) {
			runManager.setSelectedConfiguration(settings);
			return;
		}
	}
}
 
Example #27
Source File: ConfigurationSettingsEditorWrapper.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void doApply(final RunnerAndConfigurationSettings settings) {
  final RunConfiguration runConfiguration = settings.getConfiguration();
  final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(runConfiguration.getProject());
  runManager.setBeforeRunTasks(runConfiguration, myBeforeRunStepsPanel.getTasks(true), false);
  RunnerAndConfigurationSettings runManagerSettings = runManager.getSettings(runConfiguration);
  if (runManagerSettings != null) {
    runManagerSettings.setEditBeforeRun(myBeforeRunStepsPanel.needEditBeforeRun());
  }
  else {
    settings.setEditBeforeRun(myBeforeRunStepsPanel.needEditBeforeRun());
  }
}
 
Example #28
Source File: IDEUtils.java    From JHelper with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void chooseConfigurationAndTarget(
		Project project,
		RunnerAndConfigurationSettings runConfiguration,
		ExecutionTarget target
) {
	RunManager.getInstance(project).setSelectedConfiguration(runConfiguration);
	ExecutionTargetManager.getInstance(project).setActiveTarget(target);
}
 
Example #29
Source File: FlutterModuleUtils.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Ensures a Flutter run configuration is selected in the run pull down.
 */
public static void ensureRunConfigSelected(@NotNull Project project) {
  if (project.isDisposed()) return;
  final FlutterRunConfigurationType configType = FlutterRunConfigurationType.getInstance();

  final RunManager runManager = RunManager.getInstance(project);
  if (!runManager.getConfigurationsList(configType).isEmpty()) {
    if (runManager.getSelectedConfiguration() == null) {
      final List<RunnerAndConfigurationSettings> flutterConfigs = runManager.getConfigurationSettingsList(configType);
      if (!flutterConfigs.isEmpty()) {
        runManager.setSelectedConfiguration(flutterConfigs.get(0));
      }
    }
  }
}
 
Example #30
Source File: RunConfigurationDashboardGroupingRule.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public DashboardGroup getGroup(AbstractTreeNode<?> node) {
  if (node instanceof DashboardRunConfigurationNode) {
    RunnerAndConfigurationSettings configurationSettings = ((DashboardRunConfigurationNode)node).getConfigurationSettings();
    return new DashboardGroupImpl<>(configurationSettings, configurationSettings.getName(), configurationSettings.getConfiguration().getIcon());
  }
  return null;
}