Trig,
I've added some demo code to your controller. It works now. Please
pull the changes.
cn.edu.xmu.tidems.control.ui.usb9982.ADCardUSB9982ControlView
Effectively, your desired functionality can be achieved by the
following code:
...
private class ActiveAnalysis implements Runnable {
private boolean acquireData = false;
public void startAnalysis() {
acquireData = true;
}
public void stopAnalysis() {
acquireData = false;
}
@Override
public void run() {
if(acquireData && chromatogramSelection != null)
{
display.timerExec(1000, this);
chromatogramSelection.getChromatogramMSD().addScan(getRandomScan(retentionTime));
chromatogramSelection.setStopRetentionTime(retentionTime);
retentionTime += retentionTimeDelta;
chromatogramSelection.fireUpdateChange(true);
}
}
}
...
@Inject
private Display display;
private IChromatogramSelectionMSD chromatogramSelection = null;
private int retentionTimeDelta = 500;
private int retentionTime = 0;
private ActiveAnalysis activeAnalysis;
public ADCardUSB9982ControlView() {
/*
* Initialize the analysis.
*/
activeAnalysis = new ActiveAnalysis();
}
...
final Button buttonStartAcquisition = new Button(pane,
SWT.PUSH);
buttonStartAcquisition.setText("Start Acquire");
buttonStartAcquisition.addSelectionListener(new
SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent event) {
startAcquisitionDemo();
}
});
final Button buttonStopAcquisition = new Button(pane,
SWT.PUSH);
buttonStopAcquisition.setText("Stop Acquire");
buttonStopAcquisition.addSelectionListener(new
SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
stopAcquisitionDemo();
}
});
...
private void startAcquisitionDemo() {
/*
* Initialize the record.
*/
if(chromatogramSelection == null) {
try {
TideMSChromatogram chromatogram = new
TideMSChromatogram();
for(int i = 0; i < 100; i++) {
chromatogram.addScan(getRandomScan(retentionTime));
retentionTime += retentionTimeDelta;
}
//
chromatogramSelection = new
ChromatogramSelectionMSD(chromatogram);
ChromatogramEditorSupport chromatogramEditorSupport
= new ChromatogramEditorSupport();
chromatogramEditorSupport.openEditor(chromatogramSelection.getChromatogramMSD(),
modelService, application, partService);
display.asyncExec(activeAnalysis);
activeAnalysis.startAnalysis();
} catch(ChromatogramIsNullException e) {
logger.warn(e);
}
} else {
/*
* Start/proceed with the analysis.
*/
display.asyncExec(activeAnalysis);
activeAnalysis.startAnalysis();
}
}
private void stopAcquisitionDemo() {
/*
* Stop the analysis.
*/
activeAnalysis.stopAnalysis();
}
Best,
Philip
Am 08.09.2016 um 10:51 schrieb Trig
Chen:
Hi Philip,
Is there any event that can be used by IEventBroker to
handle these updates?
_______________________________________________
chemclipse-dev mailing list
chemclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/chemclipse-dev
--
~~~~~~~~~~~~~~~~~~~~~~~~
OpenChrom - the open source alternative for chromatography / mass spectrometry
Dr. Philip Wenig » Founder » philip.wenig@xxxxxxxxxxxxx » http://www.openchrom.net
~~~~~~~~~~~~~~~~~~~~~~~~ |