Search in sources :

Example 1 with DevicePeripheralSelectionDialogue

use of net.sourceforge.usbdm.peripherals.view.DevicePeripheralSelectionDialogue in project usbdm-eclipse-plugins by podonoghue.

the class TestDevicePeripheralSelectionDialogue method main.

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Selection");
    shell.setLayout(new FillLayout());
    DevicePeripheralSelectionDialogue dialogue;
    try {
        // SVDIdentifier svdIdentifier = new SVDIdentifier(Paths.get("C:/Program Files (x86)/pgo/USBDM 4.11.1.70/DeviceData/Device.SVD/Freescale/MK10D7.svd.xml"));
        // SVDIdentifier svdIdentifier = new SVDIdentifier("[SVDIdentifier:usbdm.arm.devices:FRDM_K64F]");
        SVDIdentifier svdIdentifier = new SVDIdentifier("[SVDIdentifier:path=C:/Users/podonoghue/Documents/Development/USBDM/usbdm-eclipse-plugins/net.sourceforge.usbdm.peripherals.stmicro/data/STM32F40x.svd.xml]");
        // SVDIdentifier svdIdentifier = new SVDIdentifier("[SVDIdentifier:usbdm.arm.devices:S9KEAZN8]");
        svdIdentifier = new SVDIdentifier(svdIdentifier.toString());
        dialogue = new DevicePeripheralSelectionDialogue(shell, svdIdentifier);
    } catch (Exception e) {
        e.printStackTrace();
        return;
    }
    // DeviceSelectDialogue dialogue = new DeviceSelectDialogue(shell, "C:/Users/podonoghue/Development/USBDM/ARM_Devices/Generated/STMicro/STM32F40x.svd.xml");
    int result = dialogue.open();
    if (result != Window.OK) {
        // Cancelled etc
        System.err.println("**** Cancelled ****");
        return;
    }
    SVDIdentifier svdID = dialogue.getSVDId();
    System.err.println("svdID = " + svdID);
    try {
        System.err.println("svdID.getDeviceName() = " + svdID.getDeviceName());
        DevicePeripherals devicePeripherals = svdID.getDevicePeripherals();
        System.err.println("svdID.getDevicePeripherals() = " + devicePeripherals);
        System.err.println("devicePeripherals.getName() = " + devicePeripherals.getName());
        UsbdmDevicePeripheralsModel peripheralModel = UsbdmDevicePeripheralsModel.createModel(null, svdID);
        System.err.println("peripheralModel = " + peripheralModel);
    } catch (Exception e) {
        e.printStackTrace();
    }
    display.dispose();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) UsbdmDevicePeripheralsModel(net.sourceforge.usbdm.peripherals.model.UsbdmDevicePeripheralsModel) DevicePeripherals(net.sourceforge.usbdm.peripheralDatabase.DevicePeripherals) DevicePeripheralSelectionDialogue(net.sourceforge.usbdm.peripherals.view.DevicePeripheralSelectionDialogue) SVDIdentifier(net.sourceforge.usbdm.peripheralDatabase.SVDIdentifier) FillLayout(org.eclipse.swt.layout.FillLayout) Display(org.eclipse.swt.widgets.Display)

Aggregations

DevicePeripherals (net.sourceforge.usbdm.peripheralDatabase.DevicePeripherals)1 SVDIdentifier (net.sourceforge.usbdm.peripheralDatabase.SVDIdentifier)1 UsbdmDevicePeripheralsModel (net.sourceforge.usbdm.peripherals.model.UsbdmDevicePeripheralsModel)1 DevicePeripheralSelectionDialogue (net.sourceforge.usbdm.peripherals.view.DevicePeripheralSelectionDialogue)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 Display (org.eclipse.swt.widgets.Display)1 Shell (org.eclipse.swt.widgets.Shell)1