// reset = null;
// }
// }
else if (message.equals("startscript"))
{
DataStore ds = this.getActiveDataStore();
if (ds == null)
{
return;
}
ds.startScript();
if (ds.hasRunningScript())
{
menu_.enableMenuItem("stopscript", true);
}
}
else if (message.equals("stopscript"))
{
DataStore ds = this.getActiveDataStore();
if (ds == null)
{
return;
}
// Open frame with list of scripts
// Get script name and stop that script
if (ds.hasRunningScript())
{
Set<String> ks = ds.getScriptList().keySet();
Object [] listOfScripts = ks.toArray();
String s = (String)JOptionPane.showInputDialog(
MainWindow.getInstance(),
"Select script to stop",
"Scripts",
JOptionPane.PLAIN_MESSAGE,
null,
listOfScripts,
(String)listOfScripts[0]);
// Stop the selected script.
if ((s != null) && (s.length() > 0))
{
ds.stopScript(s);
}
}
// After we stop the script, check if there is still any running scripts
menu_.enableMenuItem("startscript", true);
if (ds.hasRunningScript())
{
menu_.enableMenuItem("stopscript", true);
}
else
{
menu_.enableMenuItem("stopscript", false);
}
}
else if (message.equals("cancelloadscript"))
{
DataStore ds = this.getActiveDataStore();
if (ds == null)
{
return;
}
menu_.enableMenuItem("startscript", true);
if (ds.hasRunningScript())
{
menu_.enableMenuItem("stopscript", true);
}
else
{
menu_.enableMenuItem("stopscript", false);
}
}
/** Action to change settings and ports **/
else if (message.equals("changeprimaryport"))
{
DataStore ds = this.getActiveDataStore();
if (ds == null)
{
return;
}
int oldPort = ds.getPrimaryPort();
String newValue = JOptionPane.showInputDialog(ds.getFrame(), str_changepport, Integer.toString(oldPort));
//validate the input
if (newValue != null)
{
try {
int integer = Integer.parseInt(newValue);
if (integer > 1023)
{
ds.changePrimaryPort(integer);
}
else
{
throw new NumberFormatException();
}
}
catch (NumberFormatException nfe)
{
MessageBox.Error(ds.getFrame(), str_toosmall, "Error");
}
}
}
else if (message.equals("changestandbyport"))
{
DataStore ds = this.getActiveDataStore();
if (ds == null)
{
return;
}
int oldPort = ds.getStandbyPort();
String newValue = JOptionPane.showInputDialog(ds.getFrame(), str_changesport, Integer.toString(oldPort));
//validate the input
if (newValue != null)
{
try {
int integer = Integer.parseInt(newValue);
if (integer > 1023)
{
ds.changeStandbyPort(integer);
}
else
{
throw new NumberFormatException();
}
}
catch (NumberFormatException nfe)
{
MessageBox.Error(ds.getFrame(), str_toosmall, "Error");
}
}
}
else if (message.equals("settings"))
{