This commit is contained in:
x03daop
2016-06-14 09:15:31 +02:00
parent 21b9afe8bc
commit 5418b89172
2 changed files with 43 additions and 0 deletions

42
plugins/DataFile.java Normal file
View File

@@ -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("");
}
}
}