use of com.intellij.execution.configurations.ConfigurationFactory in project buck by facebook.
the class TestExecutionState method attachDebugger.
private void attachDebugger(String title, String port) {
final RemoteConnection remoteConnection = new RemoteConnection(/* useSockets */
true, "localhost", port, /* serverMode */
false);
final RemoteStateState state = new RemoteStateState(mProject, remoteConnection);
final String name = title + " debugger (" + port + ")";
final ConfigurationFactory cfgFactory = ConfigurationTypeUtil.findConfigurationType("Remote").getConfigurationFactories()[0];
RunnerAndConfigurationSettings runSettings = RunManager.getInstance(mProject).createRunConfiguration(name, cfgFactory);
final Executor debugExecutor = DefaultDebugExecutor.getDebugExecutorInstance();
final ExecutionEnvironment env = new ExecutionEnvironmentBuilder(mProject, debugExecutor).runProfile(runSettings.getConfiguration()).build();
final int pollTimeout = 3000;
final DebugEnvironment environment = new DefaultDebugEnvironment(env, state, remoteConnection, pollTimeout);
ApplicationManager.getApplication().invokeLater(() -> {
try {
final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(mProject).attachVirtualMachine(environment);
if (debuggerSession == null) {
return;
}
XDebuggerManager.getInstance(mProject).startSessionAndShowTab(name, null, new XDebugProcessStarter() {
@Override
@NotNull
public XDebugProcess start(@NotNull XDebugSession session) {
return JavaDebugProcess.create(session, debuggerSession);
}
});
} catch (ExecutionException e) {
LOG.error("failed to attach to debugger on port " + port + " with polling timeout " + pollTimeout);
}
});
}
use of com.intellij.execution.configurations.ConfigurationFactory in project buck by facebook.
the class AndroidDebugger method createRunConfiguration.
private static RunnerAndConfigurationSettings createRunConfiguration(Project project, String debugPort) {
final RemoteConfigurationType remoteConfigurationType = RemoteConfigurationType.getInstance();
final ConfigurationFactory factory = remoteConfigurationType.getFactory();
final RunnerAndConfigurationSettings runSettings = RunManager.getInstance(project).createRunConfiguration(getRunConfigurationName(debugPort), factory);
final RemoteConfiguration configuration = (RemoteConfiguration) runSettings.getConfiguration();
configuration.HOST = "localhost";
configuration.PORT = debugPort;
configuration.USE_SOCKET_TRANSPORT = true;
configuration.SERVER_MODE = false;
return runSettings;
}
use of com.intellij.execution.configurations.ConfigurationFactory in project buck by facebook.
the class TestConfigurationTest method testPersistency.
public void testPersistency() throws Exception {
final ConfigurationFactory factory = TestConfigurationType.getInstance().getConfigurationFactories()[0];
final TestConfiguration cfg = new TestConfiguration(getProject(), factory, "test serialization");
cfg.data.target = "//src/com/facebook/buck:test";
cfg.data.testSelectors = "com.facebook.buck.Test";
cfg.data.additionalParams = "--num-threads 239";
final Element testElement = new Element("test_element");
cfg.writeExternal(testElement);
final TestConfiguration cfg2 = new TestConfiguration(getProject(), factory, "test serialization");
cfg2.readExternal(testElement);
Assert.assertEquals("//src/com/facebook/buck:test", cfg2.data.target);
Assert.assertEquals("com.facebook.buck.Test", cfg2.data.testSelectors);
Assert.assertEquals("--num-threads 239", cfg2.data.additionalParams);
}
use of com.intellij.execution.configurations.ConfigurationFactory in project android by JetBrains.
the class AndroidRunConfigurations method createRunConfiguration.
public void createRunConfiguration(@NotNull AndroidFacet facet) {
Module module = facet.getModule();
ConfigurationFactory configurationFactory = AndroidRunConfigurationType.getInstance().getFactory();
List<RunConfiguration> configurations = RunManager.getInstance(module.getProject()).getConfigurationsList(configurationFactory.getType());
for (RunConfiguration configuration : configurations) {
if (configuration instanceof AndroidRunConfiguration && ((AndroidRunConfiguration) configuration).getConfigurationModule().getModule() == module) {
// There is already a run configuration for this module.
return;
}
}
addRunConfiguration(facet, null, TargetSelectionMode.SHOW_DIALOG, null);
}
use of com.intellij.execution.configurations.ConfigurationFactory in project android by JetBrains.
the class PostSyncProjectSetup method setMakeStepInJunitRunConfigurations.
private void setMakeStepInJunitRunConfigurations(@NotNull String makeTaskName) {
ConfigurationType junitConfigurationType = AndroidJUnitConfigurationType.getInstance();
BeforeRunTaskProvider<BeforeRunTask>[] taskProviders = Extensions.getExtensions(BeforeRunTaskProvider.EXTENSION_POINT_NAME, myProject);
BeforeRunTaskProvider targetProvider = null;
for (BeforeRunTaskProvider<? extends BeforeRunTask> provider : taskProviders) {
if (makeTaskName.equals(provider.getName())) {
targetProvider = provider;
break;
}
}
if (targetProvider != null) {
RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(myProject);
// Set the correct "Make step" in the "JUnit Run Configuration" template.
for (ConfigurationFactory configurationFactory : junitConfigurationType.getConfigurationFactories()) {
RunnerAndConfigurationSettings template = runManager.getConfigurationTemplate(configurationFactory);
RunConfiguration runConfiguration = template.getConfiguration();
setMakeStepInJUnitConfiguration(targetProvider, runConfiguration);
}
// Set the correct "Make step" in existing JUnit Configurations.
for (RunConfiguration runConfiguration : runManager.getConfigurationsList(junitConfigurationType)) {
setMakeStepInJUnitConfiguration(targetProvider, runConfiguration);
}
}
}
Aggregations