This commit is contained in:
2014-01-22 13:11:35 +01:00
parent a4ffeee271
commit 17b5e98177
16 changed files with 5 additions and 151 deletions

View File

@@ -44,8 +44,6 @@ autostore = false)
public final class CdumpExecutionTopComponent extends TopComponent {
private static CdumpExecutionTopComponent instance;
/** path to the icon used by the component and its open action */
// static final String ICON_PATH = "SET/PATH/TO/ICON/HERE";
private static final String PREFERRED_ID = "CdumpExecutionTopComponent";
private CdumpService service;

View File

@@ -52,8 +52,6 @@ autostore = false)
public final class ConfigurationManagerTopComponent extends TopComponent implements ExplorerManager.Provider {
private static ConfigurationManagerTopComponent instance;
/** path to the icon used by the component and its open action */
// static final String ICON_PATH = "SET/PATH/TO/ICON/HERE";
private static final String PREFERRED_ID = "ConfigurationManagerTopComponent";
private InstanceContent ic = new InstanceContent();
@@ -62,15 +60,8 @@ public final class ConfigurationManagerTopComponent extends TopComponent impleme
// Refresh timer if component is visible
private Timer timer;
/**
* Explorer manager
*/
private ExplorerManager em;
/**
* Component lookup
*/
private Lookup lookup;
private LocalFileSystem fs;
public ConfigurationManagerTopComponent() {
@@ -78,7 +69,6 @@ public final class ConfigurationManagerTopComponent extends TopComponent impleme
initComponents();
setName(NbBundle.getMessage(ConfigurationManagerTopComponent.class, "CTL_ConfigurationManagerTopComponent"));
setToolTipText(NbBundle.getMessage(ConfigurationManagerTopComponent.class, "HINT_ConfigurationManagerTopComponent"));
// setIcon(ImageUtilities.loadImage(ICON_PATH, true));
// Create Explorer Manager and associate lookup with this component
this.em = new ExplorerManager();
@@ -87,7 +77,6 @@ public final class ConfigurationManagerTopComponent extends TopComponent impleme
map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(em));
map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(em));
this.lookup = ExplorerUtils.createLookup(em, map);
// this.associateLookup(this.lookup);
// Create proxy lookup consisting of the two seperat lookups
this.associateLookup(new ProxyLookup(this.lookup, new AbstractLookup(ic)));
@@ -123,43 +112,6 @@ public final class ConfigurationManagerTopComponent extends TopComponent impleme
fs = new LocalFileSystem();
fs.setRootDirectory(file);
final FileObject rootDirectory = fs.getRoot();
// fs.addFileChangeListener(new FileChangeAdapter() {
// @Override
// public void fileDataCreated(FileEvent fe) {
// super.fileDataCreated(fe);
// fs.refresh(true);
// Logger.getLogger(ConfigurationManagerTopComponent.class.getName()).log(Level.INFO, "File created");
// }
//
// @Override
// public void fileChanged(FileEvent fe) {
// super.fileChanged(fe);
// fs.refresh(true);
// Logger.getLogger(ConfigurationManagerTopComponent.class.getName()).log(Level.INFO, "File changed");
// }
//
// @Override
// public void fileDeleted(FileEvent fe) {
// super.fileDeleted(fe);
// fs.refresh(true);
// Logger.getLogger(ConfigurationManagerTopComponent.class.getName()).log(Level.INFO, "File deleted");
// }
//
// @Override
// public void fileFolderCreated(FileEvent fe) {
// super.fileFolderCreated(fe);
// fs.refresh(true);
// Logger.getLogger(ConfigurationManagerTopComponent.class.getName()).log(Level.INFO, "Folder created");
// }
//
// @Override
// public void fileRenamed(FileRenameEvent fe) {
// super.fileRenamed(fe);
// fs.refresh(true);
// Logger.getLogger(ConfigurationManagerTopComponent.class.getName()).log(Level.INFO, "File renamed");
// }
//
// });
fs.refresh(true);
DataObject dao = DataObject.find(rootDirectory);

View File

@@ -53,7 +53,6 @@ public final class ConvertMAT2DAction implements ActionListener {
@Override
public void run() {
try{
// Convert file
cservice.convert(input, output, ConversionService.Reader.TXT, ConversionService.Writer.MAT_2D);
}
catch(Exception e){

View File

@@ -53,7 +53,6 @@ public final class ConvertMAT2DZAction implements ActionListener {
@Override
public void run() {
try{
// Convert file
cservice.convert(input, output, ConversionService.Reader.TXT, ConversionService.Writer.MAT_2D_Z);
}
catch(Exception e){

View File

@@ -51,7 +51,6 @@ public final class ConvertMATAction implements ActionListener {
@Override
public void run() {
// Convert file
cservice.convert(input, output, ConversionService.Reader.TXT, ConversionService.Writer.MAT);
}
});

View File

@@ -52,7 +52,6 @@ public final class ConvertMDAAction implements ActionListener {
@Override
public void run() {
// Convert file
cservice.convert(input, output, ConversionService.Reader.TXT, ConversionService.Writer.MDA);
}
});

View File

@@ -31,7 +31,6 @@ import javax.swing.text.DefaultEditorKit;
import org.openide.util.NbBundle;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
//import org.openide.util.ImageUtilities;
import org.netbeans.api.settings.ConvertAsProperties;
import org.openide.explorer.ExplorerManager;
import org.openide.explorer.ExplorerUtils;
@@ -53,23 +52,15 @@ autostore = false)
public final class DataManagerTopComponent extends TopComponent implements ExplorerManager.Provider {
private static DataManagerTopComponent instance;
/** path to the icon used by the component and its open action */
// static final String ICON_PATH = "SET/PATH/TO/ICON/HERE";
private static final String PREFERRED_ID = "DataManagerTopComponent";
// Timer for automatic refresh
private Timer timer;
/**
* Explorer manager
*/
private ExplorerManager em;
/**
* Component lookup
*/
private Lookup lookup;
private InstanceContent ic = new InstanceContent();
private final InstanceContent ic = new InstanceContent();
MyRefreshCapability refreshCap = new MyRefreshCapability();
private LocalFileSystem fs;
@@ -80,7 +71,6 @@ public final class DataManagerTopComponent extends TopComponent implements Explo
setName(NbBundle.getMessage(DataManagerTopComponent.class, "CTL_DataManagerTopComponent"));
setToolTipText(NbBundle.getMessage(DataManagerTopComponent.class, "HINT_DataManagerTopComponent"));
// setIcon(ImageUtilities.loadImage(ICON_PATH, true));
// Create Explorer Manager and associate lookup with this component
this.em = new ExplorerManager();

View File

@@ -17,11 +17,6 @@
package ch.psi.fda.ui.cm.fs;
/**
*
* @author ebner
*/
public interface RefreshCapability {
public void refresh();
}

View File

@@ -28,7 +28,6 @@ public final class AbortAllAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
Logger.getLogger(AbortAllAction.class.getName()).log(Level.INFO, "Abort all scans");
// Find Execution service
ExecutionService eservice = Lookup.getDefault().lookup(ExecutionService.class);
eservice.abortAll();
}

View File

@@ -31,20 +31,13 @@ import java.util.logging.Logger;
import org.netbeans.api.progress.ProgressHandle;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.util.Exceptions;
import org.openide.windows.IOProvider;
import org.openide.windows.InputOutput;
/**
*
* @author ebner
*/
public class ExecutionExecutable implements Runnable {
private Acquisition acquisition;
private boolean abortFlag = false; // Workaround
Configuration c;
PlotVisualizerTopComponent tc;
ProgressHandle handle;
@@ -65,7 +58,6 @@ public class ExecutionExecutable implements Runnable {
public boolean cancelExecution() {
try {
acquisition.abort();
abortFlag = true;
return (true);
} catch (Exception e) {
return (false);
@@ -74,22 +66,13 @@ public class ExecutionExecutable implements Runnable {
@Override
public void run() {
// Clear and close output window
InputOutput iotab = IOProvider.getDefault().getIO("Error", false);
iotab.closeInputOutput();
abortFlag = false;
Visualizer visualizer = null;
ExecutorService executor=null;
try {
// Read in base configuration
// AcquisitionEngineConfiguration configuration = AcquisitionEngineConfiguration.getInstance();
// configuration.load(cfile);
handle.progress(25);
executor = Executors.newSingleThreadExecutor();
@@ -98,10 +81,6 @@ public class ExecutionExecutable implements Runnable {
acquisition.initalize(ebus, c);
visualizer = new Visualizer(VisualizationMapper.mapVisualizations(c.getVisualization()));
// Configure visualizer that visualizing Thread terminates automatically
// visualizer.setAutoTerminate(true);
// visualizer.setAutoTerminateAt(c.getNumberOfExecution());
// visualizer.setTerminateAtEOS(true);
if(c.getScan() != null && c.getScan().getCdimension()!=null){
// If there is a continuous dimension only update the plot a the end of a line.
// Improvement of performance
@@ -111,13 +90,9 @@ public class ExecutionExecutable implements Runnable {
}
ebus.register(visualizer);
tc.updatePanel(visualizer.getPlotPanels());
handle.switchToIndeterminate();
// Execute acquisition logic
acquisition.execute();
}
@@ -137,7 +112,6 @@ public class ExecutionExecutable implements Runnable {
if(e.getCause() != null){
io.getErr().println(" > "+e.getCause().getMessage());
}
// e.printStackTrace(io.getErr());
io.getOut().close();
io.getErr().close();
@@ -146,7 +120,6 @@ public class ExecutionExecutable implements Runnable {
if(acquisition!=null){
acquisition.destroy();
}
// acquisition = null;
Logger.getLogger(ExecutionExecutable.class.getName()).log(Level.INFO, "Stop visualizer");
if(executor!=null){

View File

@@ -17,14 +17,6 @@
package ch.psi.fda.ui.ee;
/**
*
* @author ebner
*/
public interface ExportCapability {
/**
* Export visualizations as PNGs
*/
public void exportAllAsPNG();
}

View File

@@ -40,7 +40,6 @@ public class Installer extends ModuleInstall {
ApplicationConfigurator c = new ApplicationConfigurator();
c.initializeApplication();
// Configuration.getInstance().getConfiguration().loadConfiguration();
// Register a change listener to reconfigure scan engine when the home directory changes
p.addPropertyChangeListener(new PropertyChangeListener() {
@@ -52,8 +51,6 @@ public class Installer extends ModuleInstall {
ApplicationConfigurator c = new ApplicationConfigurator();
c.initializeApplication();
// Configuration.getInstance().getConfiguration().loadConfiguration();
}
});

View File

@@ -30,7 +30,6 @@ import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
//import org.openide.util.ImageUtilities;
import org.netbeans.api.settings.ConvertAsProperties;
import org.openide.util.lookup.AbstractLookup;
import org.openide.util.lookup.InstanceContent;
@@ -49,8 +48,6 @@ public final class PlotVisualizerTopComponent extends TopComponent {
private List<JPanel> panelList = null;
private static PlotVisualizerTopComponent instance;
/** path to the icon used by the component and its open action */
// static final String ICON_PATH = "SET/PATH/TO/ICON/HERE";
private static final String PREFERRED_ID = "PlotVisualizerTopComponent";
public PlotVisualizerTopComponent(List<JPanel> list) {
@@ -72,7 +69,6 @@ public final class PlotVisualizerTopComponent extends TopComponent {
setName(NbBundle.getMessage(PlotVisualizerTopComponent.class, "CTL_PlotVisualizerTopComponent"));
setToolTipText(NbBundle.getMessage(PlotVisualizerTopComponent.class, "HINT_PlotVisualizerTopComponent"));
// setIcon(ImageUtilities.loadImage(ICON_PATH, true));
}

View File

@@ -17,19 +17,7 @@
package ch.psi.fda.ui.ee;
import ch.psi.fda.ConversionMain;
//import ch.psi.fda.deserializer.DataDeserializer;
//import ch.psi.fda.deserializer.DataDeserializerMDA;
//import ch.psi.fda.deserializer.DataDeserializerTXT;
//import ch.psi.fda.serializer.DataSerializer;
//import ch.psi.fda.serializer.DataSerializerMAT;
//import ch.psi.fda.serializer.DataSerializerMAT2D;
//import ch.psi.fda.serializer.DataSerializerMAT2DZigZag;
//import ch.psi.fda.serializer.DataSerializerMDA;
//import ch.psi.fda.serializer.DataSerializerTXT;
//import ch.psi.fda.serializer.DataSerializerTXT2D;
//import ch.psi.fda.serializer.DataSerializerTXTSplit;
import ch.psi.fda.ui.ee.api.ConversionService;
//import com.google.common.eventbus.EventBus;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -39,10 +27,7 @@ import org.openide.util.lookup.ServiceProvider;
import org.openide.windows.IOProvider;
import org.openide.windows.InputOutput;
/**
*
* @author ebner
*/
@ServiceProvider(service = ConversionService.class)
public class SimpleConversionService implements ConversionService {

View File

@@ -49,16 +49,11 @@ public class SimpleExecutionService implements ExecutionService {
private BlockingQueue<ExecutionExecutable> queue = new LinkedBlockingQueue<ExecutionExecutable>();
// private File cfile;
private ExecutorService executorService;
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
private ExecutionExecutable runningInstance;
public SimpleExecutionService(){
executorService = Executors.newSingleThreadExecutor();
Future<?> f = executorService.submit(new Runnable() {
@Override

View File

@@ -36,10 +36,6 @@ import org.openide.util.lookup.ServiceProvider;
import org.openide.windows.IOProvider;
import org.openide.windows.InputOutput;
/**
*
* @author ebner
*/
@ServiceProvider(service = VisualizationService.class)
public class SimpleVisualizationService implements VisualizationService {
@@ -51,7 +47,7 @@ public class SimpleVisualizationService implements VisualizationService {
final PlotVisualizerTopComponent tc = PlotVisualizerTopComponent.findInstance(); //(PlotVisualizerTopComponent) WindowManager.getDefault().findTopComponent("PlotVisualizerTopComponent");
tc.open();
tc.requestActive();
tc.setTabName(file.getName()); // Set filename
tc.setTabName(file.getName());
Thread t = new Thread(new Runnable() {
@@ -82,9 +78,8 @@ public class SimpleVisualizationService implements VisualizationService {
EventBus ebus = new AsyncEventBus(Executors.newSingleThreadExecutor());
DataDeserializer deserializer = new DataDeserializerTXT(ebus, file);
// Create Visualizer
Visualizer visualizer = new Visualizer(VisualizationMapper.mapVisualizations(c.getVisualization()));
// visualizer.setTerminateAtEOS(true);
visualizer.setUpdateAtStreamElement(false);
visualizer.setUpdateAtStreamDelimiter(false);
visualizer.setUpdateAtEndOfStream(true);
@@ -93,17 +88,8 @@ public class SimpleVisualizationService implements VisualizationService {
tc.updatePanel(visualizer.getPlotPanels());
// Start deserializer and visualizer
Logger.getLogger(SimpleVisualizationService.class.getName()).log(Level.INFO, "Visualization started");
deserializer.read();
Logger.getLogger(SimpleVisualizationService.class.getName()).log(Level.INFO, "Deserializiation finished");
// visualizer.visualize();
Logger.getLogger(SimpleVisualizationService.class.getName()).log(Level.INFO, "Visualization ended");
} catch (Exception e) {
// Inform the user without waiting for its response
NotifyDescriptor d = new NotifyDescriptor.Message("An error occured while visualizing '"+file.getName()+"':\n" + e.getMessage(), NotifyDescriptor.ERROR_MESSAGE);