use of org.hibernate.eclipse.console.model.impl.ExporterFactory in project jbosstools-hibernate by jbosstools.
the class ExporterAttributes method saveExporterFactories.
public static void saveExporterFactories(ILaunchConfigurationWorkingCopy configuration, List<ExporterFactory> exporterFactories, Set<ExporterFactory> enabledExporters, Set<String> deletedExporterIds) {
List<String> names = new ArrayList<String>();
for (ExporterFactory ef : exporterFactories) {
// $NON-NLS-1$
configuration.setAttribute(getLaunchAttributePrefix(ef.getId()) + ".extension_id", ef.getExporterDefinition().getId());
boolean enabled = enabledExporters.contains(ef);
// $NON-NLS-1$
String propertiesId = getLaunchAttributePrefix(ef.getId()) + ".properties";
names.add(ef.getId());
ef.setEnabled(configuration, enabled, false);
HashMap<String, String> map = new HashMap<String, String>(ef.getProperties());
if (map.isEmpty()) {
configuration.setAttribute(propertiesId, (Map<String, String>) null);
} else {
configuration.setAttribute(propertiesId, map);
}
}
deletedExporterIds.removeAll(names);
for (String deleted : deletedExporterIds) {
configuration.setAttribute(getLaunchAttributePrefix(deleted), (String) null);
// $NON-NLS-1$
configuration.setAttribute(getLaunchAttributePrefix(deleted) + ".extension_id", (String) null);
// $NON-NLS-1$
configuration.setAttribute(getLaunchAttributePrefix(deleted) + ".properties", (String) null);
}
configuration.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS, names);
}
Aggregations