diff --git a/config/plugins.properties b/config/plugins.properties index b98e0a6f..db9c78b1 100644 --- a/config/plugins.properties +++ b/config/plugins.properties @@ -1,3 +1,4 @@ +DataFile.java=enabled XPSSpectrum.java=enabled HoloScan.java=enabled PhotonEnergy.java=enabled diff --git a/plugins/DataFile.java b/plugins/DataFile.java new file mode 100644 index 00000000..c7810199 --- /dev/null +++ b/plugins/DataFile.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2014 Paul Scherrer Institute. All rights reserved. + */ + +import ch.psi.pshell.ui.Plugin; +import javax.swing.Timer; +import java.awt.event.ActionEvent; +import java.util.logging.Level; + +/** + * + */ +public class DataFile implements Plugin { + Timer timer; + + @Override + public void onInitialize(int runCount) { + if (timer != null) { + timer.stop(); + } + getView().getStatusBar().getAuxLabel().setForeground(new java.awt.Color(100, 100, 100)); + timer = new Timer(2000, (ActionEvent e) -> { + try { + onTimer(); + } catch (Exception ex) { + getLogger().log(Level.FINE, null, ex); + } + }); + timer.start(); + + } + + + void onTimer(){ + String file = getController().getDataManager().getLastOutput(); + if (getState().isNormal() && (file !=null)){ + getView().getStatusBar().setAuxMessage(file); + } else { + getView().getStatusBar().setAuxMessage(""); + } + } +}