use of com.intellij.execution.configurations.ModuleBasedConfiguration in project intellij-community by JetBrains.
the class TemplateModuleBuilder method fixModuleName.
private void fixModuleName(Module module) {
List<RunConfiguration> configurations = RunManager.getInstance(module.getProject()).getAllConfigurationsList();
for (RunConfiguration configuration : configurations) {
if (configuration instanceof ModuleBasedConfiguration) {
((ModuleBasedConfiguration) configuration).getConfigurationModule().setModule(module);
}
}
ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel();
for (WizardInputField field : myAdditionalFields) {
ProjectTemplateParameterFactory factory = WizardInputField.getFactoryById(field.getId());
factory.applyResult(field.getValue(), model);
}
model.commit();
}
use of com.intellij.execution.configurations.ModuleBasedConfiguration in project intellij-community by JetBrains.
the class PyRunConfigurationFactoryImpl method createConfigurationSettings.
private static RunnerAndConfigurationSettings createConfigurationSettings(ConfigurationFactory factory, @NotNull final Module module) {
final RunnerAndConfigurationSettings settings = RunManager.getInstance(module.getProject()).createRunConfiguration(module.getName(), factory);
ModuleBasedConfiguration configuration = (ModuleBasedConfiguration) settings.getConfiguration();
configuration.setModule(module);
return settings;
}
use of com.intellij.execution.configurations.ModuleBasedConfiguration in project android by JetBrains.
the class HotswapAction method doUpdate.
@Override
protected void doUpdate(@NotNull AnActionEvent e, @NotNull Project project) {
Presentation presentation = e.getPresentation();
presentation.setEnabled(false);
if (!InstantRunSettings.isInstantRunEnabled()) {
presentation.setText("Apply Changes: Instant Run has been disabled");
return;
}
RunnerAndConfigurationSettings settings = RunManager.getInstance(project).getSelectedConfiguration();
if (settings == null) {
presentation.setText("Apply Changes: No run configuration selected");
return;
}
AndroidSessionInfo session = getAndroidSessionInfo(project, settings);
if (session == null) {
presentation.setText(String.format("Apply Changes: No active '%1$s' launch", settings.getName()));
return;
}
ProcessHandler processHandler = getActiveProcessHandler(project, settings);
if (processHandler == null) {
presentation.setText(String.format("Apply Changes: No active '%1$s' launch", settings.getName()));
return;
}
RunConfiguration configuration = settings.getConfiguration();
if (!(configuration instanceof ModuleBasedConfiguration)) {
presentation.setText(String.format("Apply Changes: '%1$s' is not a module based configuration", settings.getName()));
return;
}
Module module = ((ModuleBasedConfiguration) configuration).getConfigurationModule().getModule();
if (module == null) {
presentation.setText(String.format("Apply Changes: No module specified in '%1$s'", settings.getName()));
return;
}
if (!(configuration instanceof AndroidRunConfigurationBase)) {
presentation.setText(String.format("Apply Changes: '%1$s' is not an Android launch configuration", settings.getName()));
return;
}
if (!((AndroidRunConfigurationBase) configuration).supportsInstantRun()) {
presentation.setText(String.format("Apply Changes: Configuration '%1$s' does not support instant run", settings.getName()));
return;
}
AndroidVersion androidVersion = InstantRunManager.getMinDeviceApiLevel(processHandler);
if (androidVersion == null) {
presentation.setText(String.format("Apply Changes: Cannot locate device from '%1$s'", settings.getName()));
return;
}
if (!InstantRunManager.isInstantRunCapableDeviceVersion(androidVersion)) {
presentation.setText(String.format("Apply Changes: Target device API level (%1$s) too low for Instant Run", androidVersion));
return;
}
InstantRunGradleSupport status = InstantRunGradleUtils.getIrSupportStatus(InstantRunGradleUtils.getAppModel(module), androidVersion);
if (status != SUPPORTED) {
String notification = status.getUserNotification();
if (notification == null) {
notification = status.toString();
}
presentation.setText("Apply Changes: " + notification);
return;
}
presentation.setText("Apply Changes" + getShortcutText());
presentation.setEnabled(true);
}
Aggregations