private List<Configuration> createConfigurations( final Collection<String> unusedFeatures, final IMonitor monitor, boolean collect) { monitor.setTaskName("Create configurations"); monitor.setRemainingWork(unusedFeatures.size()); final List<Configuration> confs = new LinkedList<Configuration>(); final FileHandler<Configuration> writer = new FileHandler<>(ConfigurationManager.getDefaultFormat()); Configuration configuration = new Configuration(featureModel, false); try { List<List<String>> solutions = configuration.coverFeatures(unusedFeatures, monitor, false); for (List<String> solution : solutions) { configuration = new Configuration(featureModel, false); for (String feature : solution) { if (!"True".equals(feature)) { configuration.setManual(feature, Selection.SELECTED); } } if (collect) { confs.add(configuration); } else { final IFile configurationFile = getConfigurationFile(project.getConfigFolder()); writer.write(Paths.get(configurationFile.getLocationURI()), configuration); } } } catch (TimeoutException e1) { e1.printStackTrace(); } return confs; }
private List<Configuration> createConfigurations( final Collection<String> unusedFeatures, final WorkMonitor monitor, boolean collect) { final List<Configuration> confs = new LinkedList<Configuration>(); try { Configuration configuration = new Configuration(featureModel, false); List<List<String>> solutions = configuration.coverFeatures(unusedFeatures, monitor, false); for (List<String> solution : solutions) { configuration = new Configuration(featureModel, false); for (String feature : solution) { if (!"True".equals(feature)) { configuration.setManual(feature, Selection.SELECTED); } } if (collect) { confs.add(configuration); } else { final ConfigurationWriter writer = new ConfigurationWriter(configuration); writer.saveToFile(getConfigurationFile(project.getConfigFolder())); } } } catch (TimeoutException | CoreException e1) { e1.printStackTrace(); } return confs; }