use of net.sourceforge.usbdm.deviceEditor.information.DeviceInfo in project usbdm-eclipse-plugins by podonoghue.
the class DeviceVariantModel method modelElementChanged.
@Override
public void modelElementChanged(ObservableModel model) {
if (model instanceof DeviceInfo) {
DeviceInfo deviceInfo = (DeviceInfo) model;
String variantName = deviceInfo.getVariantName();
setValueAsString(variantName);
}
}
use of net.sourceforge.usbdm.deviceEditor.information.DeviceInfo in project usbdm-eclipse-plugins by podonoghue.
the class TestParseXML method main.
public static void main(String[] args) throws Exception {
Path directory = Paths.get("");
// Locate data output directory
Path outputDirectory = directory.resolve("hardware2");
// Create output directories if needed
if (!outputDirectory.toFile().exists()) {
Files.createDirectory(outputDirectory);
}
DirectoryStream<Path> folderStream = Files.newDirectoryStream(directory.resolve("hardware").toAbsolutePath(), sourceFilter);
for (Path filePath : folderStream) {
if (!Files.isRegularFile(filePath)) {
continue;
}
/*
* Process each input file
*/
System.err.println("Processing " + filePath.getFileName() + " ======================== ");
DeviceInfo deviceInfo = DeviceInfo.create(filePath);
// report(deviceInfo);
Path xmlFilePath = outputDirectory.resolve(filePath.getFileName());
FamilyXmlWriter writer = new FamilyXmlWriter(deviceInfo);
writer.writeXmlFile(xmlFilePath);
}
}
use of net.sourceforge.usbdm.deviceEditor.information.DeviceInfo in project usbdm-eclipse-plugins by podonoghue.
the class DeviceEditor method doSave.
@Override
public void doSave(IProgressMonitor monitor) {
SubMonitor.convert(monitor, 100);
if (fFactory == null) {
return;
}
DeviceInfo deviceInfo = fFactory.getDeviceInfo();
if (deviceInfo == null) {
return;
}
deviceInfo.saveSettings(fProject);
Activator activator = Activator.getDefault();
if (activator != null) {
IDialogSettings dialogSettings = activator.getDialogSettings();
if (dialogSettings != null) {
dialogSettings.put("ActiveTab", fTabFolder.getSelectionIndex());
}
}
}
use of net.sourceforge.usbdm.deviceEditor.information.DeviceInfo in project usbdm-eclipse-plugins by podonoghue.
the class DeviceEditor method doSaveAs.
@Override
public void doSaveAs() {
FileDialog dialog = new FileDialog(getSite().getShell(), SWT.SAVE);
dialog.setFilterExtensions(new String[] { "*" + DeviceInfo.PROJECT_FILE_EXTENSION });
dialog.setFilterPath(fPath.getParent().toString());
String result = dialog.open();
if (result != null) {
DeviceInfo deviceInfo = fFactory.getDeviceInfo();
if (deviceInfo == null) {
return;
}
Path path = FileSystems.getDefault().getPath(result);
deviceInfo.saveSettingsAs(path, fProject);
}
}
use of net.sourceforge.usbdm.deviceEditor.information.DeviceInfo in project usbdm-eclipse-plugins by podonoghue.
the class CreateHardwareFiles method main.
public static void main(String[] args) throws Exception {
Path directory = Paths.get("");
// Locate data output directory
Path xmlDirectory = directory.resolve("hardware");
// Create output directories if needed
if (!xmlDirectory.toFile().exists()) {
Files.createDirectory(xmlDirectory);
}
// Path to data folder - csv files describing the device
DirectoryStream<Path> folderStream = Files.newDirectoryStream(directory.resolve("data").toAbsolutePath(), sourceFilter);
for (Path filePath : folderStream) {
if (!Files.isRegularFile(filePath)) {
continue;
}
/*
* Process each input file
*/
System.err.println("Processing " + filePath.getFileName() + " ======================== ");
String sourceName = filePath.getFileName().toString();
String destinationName = sourceName.replaceAll("(^.*)" + Pattern.quote(DeviceInfo.HARDWARE_CSV_FILE_EXTENSION) + "$", "$1" + DeviceInfo.HARDWARE_FILE_EXTENSION);
DeviceInfo deviceInfo = DeviceInfo.create(filePath);
Path xmlFilePath = xmlDirectory.resolve(destinationName);
FamilyXmlWriter writer = new FamilyXmlWriter(deviceInfo);
writer.writeXmlFile(xmlFilePath);
}
}
Aggregations