Java Code Examples for com.intellij.execution.impl.RunManagerImpl#getInstanceImpl()
The following examples show how to use
com.intellij.execution.impl.RunManagerImpl#getInstanceImpl() .
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: AbstractImportTestsAction.java From consulo with Apache License 2.0 | 6 votes |
public ExecutionTarget getTarget() { if (myTargetId != null) { if (DefaultExecutionTarget.INSTANCE.getId().equals(myTargetId)) { return DefaultExecutionTarget.INSTANCE; } final RunnerAndConfigurationSettingsImpl settings = new RunnerAndConfigurationSettingsImpl(RunManagerImpl.getInstanceImpl(myProject), myConfiguration, false); for (ExecutionTargetProvider provider : ExecutionTargetProvider.EXTENSION_NAME.getExtensionList()) { for (ExecutionTarget target : provider.getTargets(myProject, settings)) { if (myTargetId.equals(target.getId())) { return target; } } } return null; } return DefaultExecutionTarget.INSTANCE; }
Example 2
Source File: AbstractAutoTestManager.java From consulo with Apache License 2.0 | 6 votes |
public static List<RunConfiguration> loadConfigurations(State state, Project project) { List<RunConfiguration> configurations = ContainerUtil.newArrayList(); RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(project); List<RunConfigurationDescriptor> descriptors = ContainerUtil.notNullize(state.myEnabledRunConfigurations); for (RunConfigurationDescriptor descriptor : descriptors) { if (descriptor.myType != null && descriptor.myName != null) { RunnerAndConfigurationSettings settings = runManager.findConfigurationByTypeAndName(descriptor.myType, descriptor.myName); RunConfiguration configuration = settings != null ? settings.getConfiguration() : null; if (configuration != null) { configurations.add(configuration); } } } return configurations; }
Example 3
Source File: AndroidSyncTest.java From intellij with Apache License 2.0 | 5 votes |
public TestProjectArguments createTestProjectArguments() { Sdk android25 = MockSdkUtil.registerSdk(workspace, "25"); RunManager runManager = RunManagerImpl.getInstanceImpl(getProject()); RunnerAndConfigurationSettings runnerAndConfigurationSettings = runManager.createConfiguration( "Blaze Android Binary Run Configuration", BlazeCommandRunConfigurationType.getInstance().getFactory()); runManager.addConfiguration(runnerAndConfigurationSettings, false); BlazeCommandRunConfiguration configuration = (BlazeCommandRunConfiguration) runnerAndConfigurationSettings.getConfiguration(); TargetInfo target = TargetInfo.builder( Label.create("//java/com/android:app"), ANDROID_BINARY.getKind().getKindString()) .build(); configuration.setTargetInfo(target); workspace.createFile( new WorkspacePath("java/com/google/Source.java"), "package com.google;", "public class Source {}"); workspace.createFile( new WorkspacePath("java/com/google/Other.java"), "package com.google;", "public class Other {}"); VirtualFile javaRoot = workspace.createDirectory(new WorkspacePath("java/com/google")); TargetMap targetMap = targetMap( android_library("//java/com/google:lib") .java_toolchain_version("8") .res("res/values/strings.xml") .src("Source.java", "Other.java"), android_binary("//java/com/android:app")); return new TestProjectArguments(android25, targetMap, javaRoot); }
Example 4
Source File: CleanProjectTargetsSyncAction.java From intellij with Apache License 2.0 | 5 votes |
private static void removeInvalidRunConfigurations(Project project, ImmutableSet<Label> deleted) { RunManagerImpl manager = RunManagerImpl.getInstanceImpl(project); List<RunnerAndConfigurationSettings> toRemove = manager .getConfigurationSettingsList(BlazeCommandRunConfigurationType.getInstance()) .stream() .filter(s -> isDeletedTarget(s.getConfiguration(), deleted)) .collect(Collectors.toList()); if (!toRemove.isEmpty()) { manager.removeConfigurations(toRemove); } }
Example 5
Source File: RunConfigurationSerializer.java From intellij with Apache License 2.0 | 5 votes |
/** * Deserializes the configuration represented by the given XML element, then searches for an * existing run configuration in the project with the same name and type. */ @Nullable @VisibleForTesting static RunnerAndConfigurationSettings findExisting(Project project, Element element) throws InvalidDataException { RunManagerImpl manager = RunManagerImpl.getInstanceImpl(project); RunnerAndConfigurationSettingsImpl settings = new RunnerAndConfigurationSettingsImpl(manager); settings.readExternal(element, /* isShared= */ false); RunConfiguration config = settings.getConfiguration(); if (config == null) { return null; } return manager.findConfigurationByTypeAndName(config.getType().getId(), config.getName()); }
Example 6
Source File: BlazeRunConfigurationSyncListener.java From intellij with Apache License 2.0 | 5 votes |
private static void removeInvalidRunConfigurations(Project project) { RunManagerImpl manager = RunManagerImpl.getInstanceImpl(project); List<RunnerAndConfigurationSettings> toRemove = manager .getConfigurationSettingsList(BlazeCommandRunConfigurationType.getInstance()) .stream() .filter(s -> isInvalidRunConfig(s.getConfiguration())) .collect(Collectors.toList()); if (!toRemove.isEmpty()) { manager.removeConfigurations(toRemove); } }
Example 7
Source File: BlazeRunConfigurationSyncListener.java From intellij with Apache License 2.0 | 5 votes |
/** * On each sync, re-calculate target kind for all existing run configurations, in case the target * map has changed since the last sync. Also force-enable our before-run task on all * configurations. */ private static void updateExistingRunConfigurations(Project project) { RunManagerImpl manager = RunManagerImpl.getInstanceImpl(project); boolean beforeRunTasksChanged = false; for (RunConfiguration config : manager.getConfigurationsList(BlazeCommandRunConfigurationType.getInstance())) { if (config instanceof BlazeCommandRunConfiguration) { ((BlazeCommandRunConfiguration) config).updateTargetKindAsync(null); beforeRunTasksChanged |= enableBlazeBeforeRunTask((BlazeCommandRunConfiguration) config); } } if (beforeRunTasksChanged) { manager.fireBeforeRunTasksUpdated(); } }
Example 8
Source File: BlazeCommandRunConfigurationRunManagerImplTest.java From intellij with Apache License 2.0 | 5 votes |
@Before public final void doSetup() { runManager = RunManagerImpl.getInstanceImpl(getProject()); // Without BlazeProjectData, the configuration editor is always disabled. BlazeProjectDataManager mockProjectDataManager = new MockBlazeProjectDataManager(MockBlazeProjectDataBuilder.builder(workspaceRoot).build()); registerProjectService(BlazeProjectDataManager.class, mockProjectDataManager); type = BlazeCommandRunConfigurationType.getInstance(); RunnerAndConfigurationSettings runnerAndConfigurationSettings = runManager.createConfiguration("Blaze Configuration", type.getFactory()); runManager.addConfiguration(runnerAndConfigurationSettings, false); configuration = (BlazeCommandRunConfiguration) runnerAndConfigurationSettings.getConfiguration(); }
Example 9
Source File: RunConfigurationSerializerTest.java From intellij with Apache License 2.0 | 5 votes |
@Before public final void doSetup() { runManager = RunManagerImpl.getInstanceImpl(getProject()); // Without BlazeProjectData, the configuration editor is always disabled. BlazeProjectDataManager mockProjectDataManager = new MockBlazeProjectDataManager(MockBlazeProjectDataBuilder.builder(workspaceRoot).build()); registerProjectService(BlazeProjectDataManager.class, mockProjectDataManager); RunnerAndConfigurationSettings runnerAndConfigurationSettings = runManager.createConfiguration( "Bazel Configuration", BlazeCommandRunConfigurationType.getInstance().getFactory()); runManager.addConfiguration(runnerAndConfigurationSettings, false); configuration = (BlazeCommandRunConfiguration) runnerAndConfigurationSettings.getConfiguration(); }
Example 10
Source File: CompoundRunConfigurationSettingsEditor.java From consulo with Apache License 2.0 | 5 votes |
public CompoundRunConfigurationSettingsEditor(@Nonnull Project project) { myRunManager = RunManagerImpl.getInstanceImpl(project); myModel = new SortedListModel<>(CompoundRunConfiguration.COMPARATOR); myList = new JBList(myModel); myList.setCellRenderer(new ColoredListCellRenderer() { @Override protected void customizeCellRenderer(@Nonnull JList list, Object value, int index, boolean selected, boolean hasFocus) { RunConfiguration configuration = myModel.get(index); setIcon(configuration.getType().getIcon()); append(configuration.getType().getDisplayName() + " '" + configuration.getName() + "'"); } }); myList.setVisibleRowCount(15); }
Example 11
Source File: CompoundRunConfiguration.java From consulo with Apache License 2.0 | 5 votes |
private void initIfNeed() { if (myInitialized) return; mySetToRun.clear(); RunManagerImpl manager = RunManagerImpl.getInstanceImpl(getProject()); for (Pair<String, String> pair : myPairs) { RunnerAndConfigurationSettings settings = manager.findConfigurationByTypeAndName(pair.first, pair.second); if (settings != null && settings.getConfiguration() != this) { mySetToRun.add(settings.getConfiguration()); } } myInitialized = true; }
Example 12
Source File: ExecutorAction.java From consulo with Apache License 2.0 | 5 votes |
@Nullable private static ConfigurationFromContext createConfiguration(RunConfigurationProducer<?> producer, ConfigurationContext context) { RunConfiguration configuration = producer.createLightConfiguration(context); if (configuration == null) return null; RunnerAndConfigurationSettingsImpl settings = new RunnerAndConfigurationSettingsImpl(RunManagerImpl.getInstanceImpl(context.getProject()), configuration, false); return new ConfigurationFromContextImpl(producer, settings, context.getPsiLocation()); }