Another exception in making a test ChromatogramMSD. It seem these data model were tied with eclipse platform.
Exception in thread "main" java.lang.NullPointerException
at org.eclipse.chemclipse.chromatogram.xxd.calculator.preferences.PreferenceSupplier.getPreferenceNode(PreferenceSupplier.java:56)
at org.eclipse.chemclipse.chromatogram.xxd.calculator.preferences.PreferenceSupplier.getPreferences(PreferenceSupplier.java:71)
at org.eclipse.chemclipse.chromatogram.xxd.calculator.preferences.PreferenceSupplier.getSelectedNoiseCalculatorId(PreferenceSupplier.java:82)
at org.eclipse.chemclipse.msd.model.core.AbstractChromatogramMSD.<init>(AbstractChromatogramMSD.java:82)
at org.eclipse.chemclipse.msd.model.implementation.ChromatogramMSD.<init>(ChromatogramMSD.java:20)
at cn.edu.xmu.tidems.control.ChromatogramTest.main(ChromatogramTest.java:28)
public class ChromatogramTest {
public static void main(final String[] args) {
final File file = new File("C:\\Temp\\blank1.ocb");
final IChromatogramMSD msd = new ChromatogramMSD();
final ScanMSD scan = new ScanMSD();
scan.setRetentionTime(0);
for(int i = 0; i < 10000; i++) {
try {
final Ion ion = new Ion(i + 1, (float)Math.random() * 10000);
scan.addIon(ion);
} catch(final Exception e) {
e.printStackTrace();
}
}
msd.addScan(scan);
final ChromatogramWriterMSD writer = new ChromatogramWriterMSD();
try {
writer.writeChromatogram(file, msd, new NullProgressMonitor());
} catch(FileIsNotWriteableException | IOException e) {
e.printStackTrace();
}
}
}