Got things finally back working reliably.
Note: You have to use Netbeans 7.x and you have to run it with Java 7 This is extremely unsatisfying!
This commit is contained in:
@@ -88,9 +88,8 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.psi</groupId>
|
||||
<artifactId>cdump</artifactId>
|
||||
<version>0.9.6-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<artifactId>ch.psi.fda.cdump</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.psi</groupId>
|
||||
|
||||
@@ -16,25 +16,30 @@
|
||||
*/
|
||||
package ch.psi.fda.ui.cdump;
|
||||
|
||||
import ch.psi.cdump.CdumpConfiguration;
|
||||
import ch.psi.cdump.CdumpService;
|
||||
import ch.psi.cdump.RunConfiguration;
|
||||
import ch.psi.fda.cdump.Cdump;
|
||||
import ch.psi.fda.cdump.CdumpConfiguration;
|
||||
import ch.psi.fda.serializer.SerializerTXT;
|
||||
import ch.psi.fda.ui.preferences.api.Preferences;
|
||||
import ch.psi.fdaq.FdaqConfiguration;
|
||||
import ch.psi.fdaq.FdaqService;
|
||||
import ch.psi.jcae.ChannelService;
|
||||
import ch.psi.jcae.impl.DefaultChannelService;
|
||||
import com.google.common.eventbus.AsyncEventBus;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.windows.TopComponent;
|
||||
import org.openide.windows.WindowManager;
|
||||
import org.netbeans.api.settings.ConvertAsProperties;
|
||||
import org.openide.DialogDisplayer;
|
||||
import org.openide.NotifyDescriptor;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.windows.IOProvider;
|
||||
import org.openide.windows.InputOutput;
|
||||
import org.openide.windows.TopComponent;
|
||||
import org.openide.windows.WindowManager;
|
||||
|
||||
/**
|
||||
* Top component which displays something.
|
||||
@@ -46,7 +51,8 @@ public final class CdumpExecutionTopComponent extends TopComponent {
|
||||
private static CdumpExecutionTopComponent instance;
|
||||
private static final String PREFERRED_ID = "CdumpExecutionTopComponent";
|
||||
|
||||
private CdumpService service;
|
||||
final ChannelService cservice = new DefaultChannelService();
|
||||
private Cdump service;
|
||||
private FdaqService fdaqService;
|
||||
|
||||
public CdumpExecutionTopComponent() {
|
||||
@@ -80,7 +86,7 @@ public final class CdumpExecutionTopComponent extends TopComponent {
|
||||
jTextField2 = new javax.swing.JTextField();
|
||||
jButton2 = new javax.swing.JButton();
|
||||
|
||||
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(RunConfiguration.rates));
|
||||
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(Cdump.SAMPLING_RATES));
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(CdumpExecutionTopComponent.class, "CdumpExecutionTopComponent.jLabel1.text")); // NOI18N
|
||||
|
||||
@@ -340,27 +346,42 @@ public final class CdumpExecutionTopComponent extends TopComponent {
|
||||
*/
|
||||
public void startAcquisition() {
|
||||
Preferences p = Lookup.getDefault().lookup(Preferences.class);
|
||||
System.setProperty("ch.psi.cdump.home", p.getHome().getAbsolutePath());
|
||||
System.setProperty("ch.psi.fda.cdump.config.file", p.getHome().getAbsolutePath()+"/etc/cdump.properties");
|
||||
|
||||
Logger.getLogger(CdumpExecutionTopComponent.class.getName()).log(Level.INFO, "Start acquisition");
|
||||
|
||||
RunConfiguration c = new RunConfiguration();
|
||||
c.setSamplingRate((String) jComboBox1.getSelectedItem());
|
||||
|
||||
// Calculate data file location/name
|
||||
String fname = jTextField1.getText();
|
||||
CdumpConfiguration cc = CdumpConfiguration.getInstance();
|
||||
String d = cc.getDataDirectory() + "/" + cc.replaceMacros(cc.getFilePrefix(), new Date(), fname) + fname + ".txt";
|
||||
File f = new File(d);
|
||||
// TODO String d = cc.getDataDirectory() + "/" + cc.replaceMacros(cc.getFilePrefix(), new Date(), fname) + fname + ".txt";
|
||||
|
||||
File f = new File(fname);
|
||||
f.getParentFile().mkdirs(); // Create data base directory
|
||||
// Set file to save data
|
||||
c.setDatafile(f);
|
||||
|
||||
// Create execution service
|
||||
EventBus eventbus = new AsyncEventBus(Executors.newSingleThreadExecutor());
|
||||
service = new Cdump(cservice, eventbus, new CdumpConfiguration());
|
||||
|
||||
SerializerTXT serializer = new SerializerTXT(f);
|
||||
serializer.setShowDimensionHeader(false);
|
||||
|
||||
eventbus.register(serializer);
|
||||
|
||||
String samplingRate = (String) jComboBox1.getSelectedItem();
|
||||
service.acquire(samplingRate);
|
||||
|
||||
|
||||
|
||||
// RunConfiguration c = new RunConfiguration();
|
||||
// c.setSamplingRate((String) jComboBox1.getSelectedItem());
|
||||
//
|
||||
// // Calculate data file location/name
|
||||
// String fname = jTextField1.getText();
|
||||
// CdumpConfiguration cc = CdumpConfiguration.getInstance();
|
||||
// String d = cc.getDataDirectory() + "/" + cc.replaceMacros(cc.getFilePrefix(), new Date(), fname) + fname + ".txt";
|
||||
// File f = new File(d);
|
||||
// f.getParentFile().mkdirs(); // Create data base directory
|
||||
// // Set file to save data
|
||||
// c.setDatafile(f);
|
||||
|
||||
// Create execution service
|
||||
service = new CdumpService();
|
||||
|
||||
// Take data
|
||||
service.startAcquisition(c);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -370,7 +391,7 @@ public final class CdumpExecutionTopComponent extends TopComponent {
|
||||
|
||||
if(service != null){
|
||||
Logger.getLogger(CdumpExecutionTopComponent.class.getName()).log(Level.INFO, "Stop acquisition");
|
||||
service.stopAcquisition();
|
||||
service.stop();
|
||||
}
|
||||
|
||||
// // Destroy jca context to let the program abort
|
||||
|
||||
Reference in New Issue
Block a user