use of com.intellij.execution.RunnerAndConfigurationSettings in project buck by facebook.
the class AndroidDebugger method attachDebugger.
public static void attachDebugger(final String packageName, final Project project) throws InterruptedException {
IDevice[] devices = AndroidDebugBridge.getBridge().getDevices();
if (devices.length == 0) {
return;
}
IDevice device = devices[0];
Client client;
int currentRetryNumber = 0;
int currentRetryTime = RETRY_TIME;
// It takes some time to get the updated client process list, so wait for it
do {
client = device.getClient(packageName);
currentRetryTime *= 2;
Thread.sleep(currentRetryTime);
currentRetryNumber++;
} while (client == null && currentRetryNumber < MAX_RETRIES);
if (client == null) {
throw new RuntimeException("Connecting to the adb debug server timed out." + "Can't find package with name " + packageName + ".");
}
String debugPort = String.valueOf(client.getDebuggerListenPort());
final RunnerAndConfigurationSettings settings = createRunConfiguration(project, debugPort);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
// Needs read access which is available on the read thread.
ProgramRunnerUtil.executeConfiguration(project, settings, DefaultDebugExecutor.getDebugExecutorInstance());
}
});
}
use of com.intellij.execution.RunnerAndConfigurationSettings in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoBuildingRunner method getOutputFile.
@NotNull
private static File getOutputFile(@NotNull ExecutionEnvironment environment, @NotNull GoApplicationRunningState state) throws ExecutionException {
File outputFile;
String outputDirectoryPath = state.getConfiguration().getOutputFilePath();
RunnerAndConfigurationSettings settings = environment.getRunnerAndConfigurationSettings();
String configurationName = settings != null ? settings.getName() : "application";
if (StringUtil.isEmpty(outputDirectoryPath)) {
try {
outputFile = FileUtil.createTempFile(configurationName, "go", true);
} catch (IOException e) {
throw new ExecutionException("Cannot create temporary output file", e);
}
} else {
File outputDirectory = new File(outputDirectoryPath);
if (outputDirectory.isDirectory() || !outputDirectory.exists() && outputDirectory.mkdirs()) {
outputFile = new File(outputDirectoryPath, GoEnvironmentUtil.getBinaryFileNameForPath(configurationName));
try {
if (!outputFile.exists() && !outputFile.createNewFile()) {
throw new ExecutionException("Cannot create output file " + outputFile.getAbsolutePath());
}
} catch (IOException e) {
throw new ExecutionException("Cannot create output file " + outputFile.getAbsolutePath());
}
} else {
throw new ExecutionException("Cannot create output file in " + outputDirectory.getAbsolutePath());
}
}
if (!prepareFile(outputFile)) {
throw new ExecutionException("Cannot make temporary file executable " + outputFile.getAbsolutePath());
}
return outputFile;
}
use of com.intellij.execution.RunnerAndConfigurationSettings in project intellij-community by JetBrains.
the class RemoveMavenRunConfigurationAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
Project project = e.getProject();
RunnerAndConfigurationSettings settings = MavenDataKeys.RUN_CONFIGURATION.getData(e.getDataContext());
boolean enabled = settings != null && project != null;
e.getPresentation().setEnabledAndVisible(enabled);
}
use of com.intellij.execution.RunnerAndConfigurationSettings in project intellij-community by JetBrains.
the class RemoveMavenRunConfigurationAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
RunnerAndConfigurationSettings settings = MavenDataKeys.RUN_CONFIGURATION.getData(e.getDataContext());
assert settings != null && project != null;
int res = Messages.showYesNoDialog(project, "Delete \"" + settings.getName() + "\"?", "Confirmation", Messages.getQuestionIcon());
if (res == Messages.YES) {
((RunManagerEx) RunManager.getInstance(project)).removeConfiguration(settings);
}
}
use of com.intellij.execution.RunnerAndConfigurationSettings in project intellij-community by JetBrains.
the class ConfigurationsTest method createConfiguration.
private static TestNGConfiguration createConfiguration(final Project project) {
final RunManagerEx manager = RunManagerEx.getInstanceEx(project);
final RunnerAndConfigurationSettings settings = manager.createRunConfiguration("testt", TestNGConfigurationType.getInstance().getConfigurationFactories()[0]);
manager.addConfiguration(settings, false);
return (TestNGConfiguration) settings.getConfiguration();
}
Aggregations