use of net.sourceforge.usbdm.deviceDatabase.DeviceDatabase in project usbdm-eclipse-plugins by podonoghue.
the class DeviceSelectorPanel method buildTreeModel.
/**
* Build the model representing the device choices
* @param pm
*
* @return
* @throws InterruptedException
*/
void buildTreeModel(IProgressMonitor pm, BaseModel root) throws InterruptedException {
fDeviceName = null;
if ((fDeviceDatabase == null) || (fDeviceDatabase.getTargetType() != fTargetType)) {
fDeviceDatabase = new DeviceDatabase(fTargetType);
}
if (!fDeviceDatabase.isValid()) {
fDeviceText.setText("<Device database invalid>");
return;
}
String currentFamily = null;
BaseModel familyTree = null;
String currentSubFamily = null;
BaseModel subFamilyTree = null;
for (Device device : fDeviceDatabase.getDeviceList()) {
IProgressMonitor sub = new SubProgressMonitor(pm, 1);
try {
if (device.isHidden()) {
continue;
}
String family = getFamilyName(device.getName());
if ((familyTree == null) || (currentFamily == null) || !currentFamily.equalsIgnoreCase(family)) {
familyTree = findCategoryNode(root, family);
}
if (familyTree == null) {
currentFamily = family;
familyTree = new CategoryModel(root, family);
currentSubFamily = null;
subFamilyTree = null;
}
String subFamily = getSubFamilyNamePrefix(device.getName());
if ((subFamilyTree == null) || (currentSubFamily == null) || (!currentSubFamily.equalsIgnoreCase(subFamily))) {
subFamilyTree = findCategoryNode(familyTree, subFamily);
}
if (subFamilyTree == null) {
currentSubFamily = subFamily;
subFamilyTree = new CategoryModel(familyTree, currentSubFamily);
}
if (device.getName().equalsIgnoreCase(currentSubFamily)) {
continue;
}
new DeviceModel(subFamilyTree, device.getName());
if (pm.isCanceled()) {
throw new InterruptedException();
}
} finally {
sub.done();
}
}
}
use of net.sourceforge.usbdm.deviceDatabase.DeviceDatabase in project usbdm-eclipse-plugins by podonoghue.
the class UsbdmDynamicOptionPage_N method main.
// @Override
// public boolean canFlipToNextPage() {
// return isPageComplete();
// }
/**
* Test main
*
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Packages Available");
shell.setLayout(new FillLayout());
Composite composite = new Composite(shell, SWT.NONE);
composite.setLayout(new FillLayout());
String deviceName = "FRDM_K22F";
// String deviceName = "FRDM_KL27Z";
// String deviceName = "MKL27Z64M4";
Map<String, String> paramMap = new HashMap<String, String>();
paramMap.put("linkerFlashSize", "0x100");
paramMap.put("linkerRamSize", "0x100");
paramMap.put("outputType", "xxxxxProjectType.exe");
paramMap.put("targetDevice", deviceName);
// UsbdmDynamicOptionPage_N page = new UsbdmDynamicOptionPage_N(deviceName, paramMap, "usbdm-project-options-page");
// UsbdmDynamicOptionPage_N page = new UsbdmDynamicOptionPage_N(deviceName, paramMap, "kinetis-CPP-abstraction-options-page");
WizardPageInformation wizardPageInfo = new WizardPageInformation("kinetis-sdk-options-page", "Kinetis", "Kinetis description");
DeviceDatabase deviceDatabase = new DeviceDatabase(TargetType.T_ARM);
Device device = deviceDatabase.getDevice(deviceName);
ProjectActionList projectActionList = device.getProjectActionList(paramMap);
UsbdmDynamicOptionPage_N page = new UsbdmDynamicOptionPage_N(device, projectActionList, wizardPageInfo);
page.createControl(composite);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
page.getPageData(paramMap);
display.dispose();
}
Aggregations