Search in sources :

Example 1 with CDTProjectManager

use of net.sourceforge.usbdm.cdt.ui.newProjectWizard.CDTProjectManager in project usbdm-eclipse-plugins by podonoghue.

the class KSDKLibraryImportWizard method run.

@Override
public void run(IProgressMonitor progressMonitor) throws InvocationTargetException, InterruptedException {
    System.err.println("KSDKLibraryImportWizard.run()");
    SubMonitor monitor = SubMonitor.convert(progressMonitor);
    monitor.beginTask("Importing KDS Library", 100);
    Map<String, String> paramMap = new HashMap<String, String>();
    try {
        kdsLibraryImportWizardPage.getPageData(paramMap);
        Device device = getDevice(paramMap.get(UsbdmConstants.TARGET_DEVICE_KEY));
        if (device == null) {
            throw new Exception("Failed to obtain device description for " + paramMap.get(UsbdmConstants.TARGET_DEVICE_KEY));
        }
        // Add device options
        ProjectActionList deviceActionList = device.getProjectActionList(paramMap);
        // UsbdmOptionsPanel.getPageData(paramMap, deviceActionLists);
        listParamMap("KSDKLibraryImportWizard.run() - paramMap =================================", paramMap);
        // Create project
        System.err.println("KSDKLibraryImportWizard.run() - Creating project");
        IProject project = new CDTProjectManager().createUSBDMProject(paramMap, monitor.newChild(30));
        // Apply default device project options
        System.err.println("KSDKLibraryImportWizard.run() - Applying deviceActionLists");
        ProcessProjectActions.process(this, project, device, deviceActionList, paramMap, monitor.newChild(30));
        // Apply Library options
        System.err.println("KSDKLibraryImportWizard.run() - Getting libraryActionList");
        ProjectActionList libraryActionList = kdsLibraryImportWizardPage.getProjectActionList();
        System.err.println("KSDKLibraryImportWizard.run() - Applying libraryActionList");
        ProcessProjectActions.process(this, project, device, libraryActionList, paramMap, monitor.newChild(30));
        updateConfigurations(project, monitor.newChild(10));
    } catch (Exception e) {
        e.printStackTrace();
        throw new InvocationTargetException(e);
    } finally {
        monitor.done();
    }
}
Also used : HashMap(java.util.HashMap) Device(net.sourceforge.usbdm.deviceDatabase.Device) SubMonitor(org.eclipse.core.runtime.SubMonitor) CDTProjectManager(net.sourceforge.usbdm.cdt.ui.newProjectWizard.CDTProjectManager) ProjectActionList(net.sourceforge.usbdm.packageParser.ProjectActionList) InvocationTargetException(java.lang.reflect.InvocationTargetException) IProject(org.eclipse.core.resources.IProject) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashMap (java.util.HashMap)1 CDTProjectManager (net.sourceforge.usbdm.cdt.ui.newProjectWizard.CDTProjectManager)1 Device (net.sourceforge.usbdm.deviceDatabase.Device)1 ProjectActionList (net.sourceforge.usbdm.packageParser.ProjectActionList)1 IProject (org.eclipse.core.resources.IProject)1 SubMonitor (org.eclipse.core.runtime.SubMonitor)1