Search in sources :

Example 1 with UsbdmDevicePeripheralsView

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

the class TestPeripheralView method main.

/**
 * Test main
 *
 * @param args
 */
public static void main(String[] args) {
    try {
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setText("Task List - TableViewer Example");
        shell.setLayout(new FillLayout());
        Composite composite = new Composite(shell, SWT.NONE);
        composite.setBackground(new Color(display, 255, 0, 0));
        composite.setLayout(new FillLayout());
        UsbdmDevicePeripheralsView view = new UsbdmDevicePeripheralsView();
        String os = System.getProperty("os.name");
        System.err.println("os.name      => " + os);
        Path path = null;
        if ((os != null) && os.toUpperCase().contains("LINUX")) {
            path = Paths.get("/usr/share/usbdm/Stationery/Device.SVD/Internal/");
        } else {
            path = Paths.get("C:/Users/podonoghue/Documents/Development/USBDM/usbdm-eclipse-makefiles-build/PackageFiles/Stationery/Device.SVD/Internal/");
        }
        // 
        // DeviceFileList fileList = new DeviceFileList(path.resolve("DeviceList.xml"));
        // Path name = fileList.getSvdFilename("LPC11U24_401");
        // System.err.println("Name = " + name);
        view.createPartControl(composite);
        // SVDIdentifier               svdId = new SVDIdentifier(path.resolve("MKM33Z5.svd.xml"));
        SVDIdentifier svdId = new SVDIdentifier(path.resolve("MKL25Z4.svd.xml"));
        // SVDIdentifier               svdId = new SVDIdentifier(path.resolve("MKW41Z4.svd.xml"));
        // SVDIdentifier               svdId = new SVDIdentifier(path.resolve("LPC13xx.svd.xml"));
        // SVDIdentifier               svdId = new SVDIdentifier(path.resolve("MK22F51212.svd.xml"));
        UsbdmDevicePeripheralsModel peripheralsModel = UsbdmDevicePeripheralsModel.createModel(null, svdId);
        // peripheralsModel = new UsbdmDevicePeripheralsModel(path+"MKL25Z4.svd.xml", null);
        // peripheralsModel = new UsbdmDevicePeripheralsModel(path+"MK20D5.svd.xml", null);
        // peripheralsModel = new UsbdmDevicePeripheralsModel(path+"MK10D10.svd.xml", null);
        // peripheralsModel = new UsbdmDevicePeripheralsModel(path+"MK11D5.svd.xml", null);
        // peripheralsModel = new UsbdmDevicePeripheralsModel(path+"MK64F12.svd.xml", null);
        // peripheralsModel = new UsbdmDevicePeripheralsModel(path+"MCF5225x.svd.xml", null);
        // peripheralsModel = new UsbdmDevicePeripheralsModel(path+"MCF51JF.svd.xml", null);
        // Try illegal path/name
        // peripheralsModel = new UsbdmDevicePeripheralsModel("xxxx", null);
        view.sessionStarted(peripheralsModel);
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
        display.dispose();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Path(java.nio.file.Path) Shell(org.eclipse.swt.widgets.Shell) UsbdmDevicePeripheralsModel(net.sourceforge.usbdm.peripherals.model.UsbdmDevicePeripheralsModel) Composite(org.eclipse.swt.widgets.Composite) Color(org.eclipse.swt.graphics.Color) UsbdmDevicePeripheralsView(net.sourceforge.usbdm.peripherals.view.UsbdmDevicePeripheralsView) SVDIdentifier(net.sourceforge.usbdm.peripheralDatabase.SVDIdentifier) FillLayout(org.eclipse.swt.layout.FillLayout) Display(org.eclipse.swt.widgets.Display)

Aggregations

Path (java.nio.file.Path)1 SVDIdentifier (net.sourceforge.usbdm.peripheralDatabase.SVDIdentifier)1 UsbdmDevicePeripheralsModel (net.sourceforge.usbdm.peripherals.model.UsbdmDevicePeripheralsModel)1 UsbdmDevicePeripheralsView (net.sourceforge.usbdm.peripherals.view.UsbdmDevicePeripheralsView)1 Color (org.eclipse.swt.graphics.Color)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Display (org.eclipse.swt.widgets.Display)1 Shell (org.eclipse.swt.widgets.Shell)1