Search in sources :

Example 16 with ExporterFactory

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);
}
Also used : ExporterFactory(org.hibernate.eclipse.console.model.impl.ExporterFactory) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Aggregations

ExporterFactory (org.hibernate.eclipse.console.model.impl.ExporterFactory)16 ArrayList (java.util.ArrayList)4 CoreException (org.eclipse.core.runtime.CoreException)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 GridData (org.eclipse.swt.layout.GridData)4 UpDownListComposite (org.hibernate.eclipse.console.wizards.UpDownListComposite)4 HashMap (java.util.HashMap)3 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 HashSet (java.util.HashSet)2 Iterator (java.util.Iterator)2 Map (java.util.Map)2 Properties (java.util.Properties)2 IPath (org.eclipse.core.runtime.IPath)2 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)2 ICheckStateListener (org.eclipse.jface.viewers.ICheckStateListener)2 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)2 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)2