diff --git a/pom.xml b/pom.xml
index b0931bb..1df80dc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
info.istlab.IoTP
IoTP
jar
- 0.17
+ 0.18
IoTP
http://maven.apache.org
diff --git a/src/main/java/info/istlab/IoTP/Editor.java b/src/main/java/info/istlab/IoTP/Editor.java
index 16a612d..3df323d 100644
--- a/src/main/java/info/istlab/IoTP/Editor.java
+++ b/src/main/java/info/istlab/IoTP/Editor.java
@@ -119,7 +119,7 @@
runB = new JButton("Run");
runB.addActionListener(this);
topP.add(runB);
- runner = new ScriptRunner(file.getAbsolutePath(), runB, "");
+ runner = new ScriptRunner(file.getAbsolutePath(), null);
} else if (textArea.getSyntaxEditingStyle() == SyntaxConstants.SYNTAX_STYLE_C) {
// compileB = new JButton("Compile");
execB = new JButton("Upload");
@@ -234,7 +234,7 @@
// new ScriptRunner("Upload.sh", execB, file.getName()).startstop();
} else if (e.getActionCommand().equals("Upload")) {
save();
- new ScriptRunner("Upload.sh", execB, file.getName()).startstop();
+ new ScriptRunner("Upload", file.getName()).startstop();
// new JExecutor(file.getAbsolutePath(), comlineOption.getText());
}
diff --git a/src/main/java/info/istlab/IoTP/Launcher.java b/src/main/java/info/istlab/IoTP/Launcher.java
index 3b86c51..eaa825b 100644
--- a/src/main/java/info/istlab/IoTP/Launcher.java
+++ b/src/main/java/info/istlab/IoTP/Launcher.java
@@ -26,7 +26,7 @@
public class Launcher extends JFrame implements MouseInputListener, KeyListener {
public static Launcher theapp;
- public static String version = "0.17";
+ public static String version = "0.18";
// JPanel mainP;
File root;
JTree tree;
@@ -69,7 +69,7 @@
menuBar.add(menu);
JMenuItem mi;
-
+
mi = new JMenuItem("IoTPのバージョン確認");
mi.addActionListener(ae -> JOptionPane.showMessageDialog(this, "IoTP Launcher v" + version));
menu.add(mi);
@@ -86,12 +86,11 @@
mi.addActionListener(ae -> System.exit(0));
menu.add(mi);
-
menu = new JMenu("Serial"); /**************************************************** */
menuBar.add(menu);
mi = new JMenuItem("シリアルモニタを開く");
- mi.addActionListener(ae -> SerialWindow.invoke(true) );
+ mi.addActionListener(ae -> SerialWindow.invoke(true));
menu.add(mi);
menu = new JMenu("File"); /**************************************************** */
@@ -105,10 +104,15 @@
mi.addActionListener(ae -> openExecPath());
menu.add(mi);
+ mi = new JMenuItem("FactoryTestを書き込む");
+ mi.addActionListener(ae -> uploadFactoryTest());
+ menu.add(mi);
+
// menu.addSeparator();
boolean isEnglish = false;
- // menu = new JMenu(isEnglish ? "Process" : "プロセス"); /**************************************************** */
+ // menu = new JMenu(isEnglish ? "Process" : "プロセス");
+ // /**************************************************** */
// menuBar.add(menu);
// mi = new JMenuItem("jps (Javaのプロセス確認)");
@@ -184,8 +188,9 @@
JOptionPane.showMessageDialog(this,
"最新版です : v" + version + "\n(download folder: " + App.execPath.getParent().toString() + ")");
} else {
- int res = JOptionPane.showConfirmDialog(this, "最新版 \n(" + App.latestVersion + ") をダウンロードする?\n(download folder: "
- + App.execPath.getParent().toString() + ")");
+ int res = JOptionPane.showConfirmDialog(this,
+ "最新版 \n(" + App.latestVersion + ") をダウンロードする?\n(download folder: "
+ + App.execPath.getParent().toString() + ")");
if (res == JOptionPane.YES_OPTION) {
App.download();
openExecPath();
@@ -241,6 +246,11 @@
System.out.println(node.toString());
}
+ private void uploadFactoryTest() {
+ new ScriptRunner("_Upload_FactoryTest", null).startstop();
+
+ }
+
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
diff --git a/src/main/java/info/istlab/IoTP/ScriptRunner.java b/src/main/java/info/istlab/IoTP/ScriptRunner.java
index 94905ef..e48018e 100644
--- a/src/main/java/info/istlab/IoTP/ScriptRunner.java
+++ b/src/main/java/info/istlab/IoTP/ScriptRunner.java
@@ -4,24 +4,25 @@
import java.io.IOException;
import java.util.ArrayList;
-import javax.swing.JButton;
-
/**
* スクリプトファイルの実行
*/
public class ScriptRunner implements Runnable {
String scriptfile;
+ String scriptfile_base;
String srcfile;
Thread thread;
Process process;
- JButton runB;
+ // JButton runB;
String originalButtonLabel;
- public ScriptRunner(String shfile, JButton rB, String targetfile) {
- scriptfile = shfile;
+ public ScriptRunner(String shfile, String targetfile) {
+ scriptfile_base = shfile;
+ scriptfile = (App.isWindows) ? scriptfile_base + ".bat" : scriptfile_base + ".sh";
srcfile = targetfile;
- runB = rB;
+
+ prepareComList();
}
public void startstop() {
@@ -37,32 +38,38 @@
}
}
- @Override
- public void run() {
- // Run script
- ArrayList comlist = new ArrayList();
+ ArrayList comlist;
+
+ public void prepareComList() {
+ comlist = new ArrayList();
if (App.isWindows) {
SerialWindow.check(false);
comlist.add("cmd");
comlist.add("/c");
comlist.add("start");
- comlist.add("Upload.bat");
- if (srcfile.length() > 0)
+ comlist.add(scriptfile);
+ if (srcfile != null && srcfile.length() > 0)
comlist.add(srcfile);
if (App.serialName != null)
comlist.add(App.serialName);
} else {
comlist.add("bash");
- comlist.add("Upload.sh");
- if (srcfile.length() > 0)
+ comlist.add(scriptfile);
+ if (srcfile != null && srcfile.length() > 0)
comlist.add(srcfile);
}
- if (App.serialName != null){
+
+ // シリアルコンソールを閉じる
+ if (App.serialName != null) {
SerialWindow swin = SerialWindow.hash.get(App.serialName);
- if (swin != null){
+ if (swin != null) {
swin.closeSerialPort();
}
}
+ }
+
+ @Override
+ public void run() {
ProcessBuilder processBuilder = new ProcessBuilder(comlist);
// ProcessBuilder processBuilder = new ProcessBuilder("pwd");
@@ -72,9 +79,9 @@
JTAConsole con = new JTAConsole("(Exec) " + scriptfile + " " + srcfile);
// con.setMainSrcByFileName(scriptfile);
con.Systemoutprintln("=== 実行開始 ===");
- if (App.isWindows){
+ if (App.isWindows) {
con.Systemoutprintln("=== バッチファイルを実行します ===");
- con.Systemoutprintln(String.join(" ",comlist.toArray(new String[]{})));
+ con.Systemoutprintln(String.join(" ", comlist.toArray(new String[] {})));
}
// con.Systemoutprintln(CommandRunner.prompt+"cd ~" + App.nwpsrc+" (注:~ はチルダ記号〜
// で,ホームディレクトリを表します)");
@@ -103,7 +110,9 @@
con.Systemoutprintln("=== 終了 === (ALT+Wで閉じる)");
thread = null;
// runB.setText("Run");
- SerialWindow.invoke(false); // no serial connectionsのとき、メッセージ表示しない
+ if (scriptfile_base.startsWith("Upload")){
+ SerialWindow.invoke(false); // no serial connectionsのとき、メッセージ表示しない
+ }
if (App.isWindows) {
con.windowClosing(null);
con.frame.dispose();