do not write to external test script file

This commit is contained in:
fros4943 2010-08-17 15:03:52 +00:00
parent 164d55e39d
commit 49353be13b

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: ScriptRunner.java,v 1.27 2010/02/12 09:28:28 fros4943 Exp $ * $Id: ScriptRunner.java,v 1.28 2010/08/17 15:03:52 fros4943 Exp $
*/ */
package se.sics.cooja.plugins; package se.sics.cooja.plugins;
@ -327,7 +327,8 @@ public class ScriptRunner extends VisPlugin {
examplesButton.setEnabled(false); examplesButton.setEnabled(false);
logTextArea.setText(""); logTextArea.setText("");
scriptTextArea.setEnabled(false); scriptTextArea.setEnabled(false);
setTitle("Contiki Test Editor (ACTIVE)"); setTitle("Contiki Test Editor (ACTIVE) "
+ (scriptFile==null?"":" (" + scriptFile.getName() + ")"));
logger.info("Test script activated"); logger.info("Test script activated");
@ -367,9 +368,10 @@ public class ScriptRunner extends VisPlugin {
toggleButton.setText("Activate"); toggleButton.setText("Activate");
examplesButton.setEnabled(true); examplesButton.setEnabled(true);
scriptTextArea.setEnabled(true); scriptTextArea.setEnabled(scriptFile==null?true:false);
logger.info("Test script deactivated"); logger.info("Test script deactivated");
setTitle("Contiki Test Editor"); setTitle("Contiki Test Editor"
+ (scriptFile==null?"":" (" + scriptFile.getName() + ")"));
} }
} }
@ -558,7 +560,7 @@ public class ScriptRunner extends VisPlugin {
element = new Element("scriptfile"); element = new Element("scriptfile");
element.setText(simulation.getGUI().createPortablePath(scriptFile).getPath().replace('\\', '/')); element.setText(simulation.getGUI().createPortablePath(scriptFile).getPath().replace('\\', '/'));
config.add(element); config.add(element);
StringUtils.saveToFile(scriptFile, scriptTextArea.getText()); /*StringUtils.saveToFile(scriptFile, scriptTextArea.getText());*/
} else { } else {
element = new Element("script"); element = new Element("script");
element.setText(scriptTextArea.getText()); element.setText(scriptTextArea.getText());
@ -593,6 +595,7 @@ public class ScriptRunner extends VisPlugin {
updateScript(script); updateScript(script);
} }
scriptFile = file; scriptFile = file;
scriptTextArea.setEnabled(false);
} else if ("active".equals(name)) { } else if ("active".equals(name)) {
boolean active = Boolean.parseBoolean(element.getText()); boolean active = Boolean.parseBoolean(element.getText());
if (GUI.isVisualized()) { if (GUI.isVisualized()) {