use of com.intellij.execution.util.JreVersionDetector in project intellij-community by JetBrains.
the class CreateSnapShotAction method promptForSnapshotConfiguration.
@Nullable
private static RunnerAndConfigurationSettings promptForSnapshotConfiguration(final Project project, final List<RunnerAndConfigurationSettings> configurations) {
if (configurations.isEmpty()) {
Messages.showMessageDialog(project, UIDesignerBundle.message("snapshot.no.configuration.error"), UIDesignerBundle.message("snapshot.title"), Messages.getInformationIcon());
return null;
}
for (int i = configurations.size() - 1; i >= 0; i--) {
final JreVersionDetector detector = new JreVersionDetector();
final ApplicationConfiguration configuration = (ApplicationConfiguration) configurations.get(i).getConfiguration();
if (!detector.isJre50Configured(configuration) && !detector.isModuleJre50Configured(configuration)) {
configurations.remove(i);
}
}
if (configurations.isEmpty()) {
Messages.showMessageDialog(project, UIDesignerBundle.message("snapshot.no.compatible.configuration.error"), UIDesignerBundle.message("snapshot.title"), Messages.getInformationIcon());
return null;
}
final RunnerAndConfigurationSettings snapshotConfiguration;
if (configurations.size() == 1) {
final int rc = Messages.showYesNoDialog(project, UIDesignerBundle.message("snapshot.confirm.configuration.prompt", configurations.get(0).getConfiguration().getName()), UIDesignerBundle.message("snapshot.title"), Messages.getQuestionIcon());
if (rc == Messages.NO) {
return null;
}
snapshotConfiguration = configurations.get(0);
} else {
String[] names = new String[configurations.size()];
for (int i = 0; i < configurations.size(); i++) {
names[i] = configurations.get(i).getConfiguration().getName();
}
int rc = Messages.showChooseDialog(project, UIDesignerBundle.message("snapshot.choose.configuration.prompt"), UIDesignerBundle.message("snapshot.title"), Messages.getQuestionIcon(), names, names[0]);
if (rc < 0)
return null;
snapshotConfiguration = configurations.get(rc);
}
((ApplicationConfiguration) snapshotConfiguration.getConfiguration()).ENABLE_SWING_INSPECTOR = true;
return snapshotConfiguration;
}
Aggregations