diff --git a/pom.xml b/pom.xml index 4982c65..30ef907 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ info.istlab.IoTP IoTP jar - 0.52 + 0.53 IoTP http://maven.apache.org @@ -13,8 +13,8 @@ 8 UTF-8 UTF-8 - 8 - 8 + @@ -67,6 +67,15 @@ + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 8 + + + + org.codehaus.mojo exec-maven-plugin 3.0.0 diff --git a/src/main/java/info/istlab/IoTP/App.java b/src/main/java/info/istlab/IoTP/App.java index 5bc8451..1397bbc 100644 --- a/src/main/java/info/istlab/IoTP/App.java +++ b/src/main/java/info/istlab/IoTP/App.java @@ -41,6 +41,14 @@ } public static void main(String[] args) { + Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { + @Override + public void uncaughtException(Thread t, Throwable e) { + // 例外をログに書き出したり、無視したりできます + // System.err.println("Uncaught exception: " + e.getMessage()); + } + }); + try { App.execPath = getApplicationPath(new App().getClass()); } catch (URISyntaxException e) { diff --git a/src/main/java/info/istlab/IoTP/Editor.java b/src/main/java/info/istlab/IoTP/Editor.java index e0c54fc..ee48c3b 100644 --- a/src/main/java/info/istlab/IoTP/Editor.java +++ b/src/main/java/info/istlab/IoTP/Editor.java @@ -229,12 +229,15 @@ public void save() { String src = textArea.getText(); + PrintWriter out = null; try { - PrintWriter out = new PrintWriter(file.getAbsolutePath(), "UTF-8"); + out = new PrintWriter(file.getAbsolutePath(), "UTF-8"); out.println(src); out.flush(); } catch (FileNotFoundException | UnsupportedEncodingException e) { e.printStackTrace(); + } finally { + out.close(); } System.out.println("保存しました"); saveB.setEnabled(false); @@ -282,7 +285,7 @@ if (e.getKeyCode() == KeyEvent.VK_I || e.getKeyCode() == 84) { // F (format:70) or T(84) fixIndent(); } - if (e.getKeyCode() == KeyEvent.VK_F){ + if (e.getKeyCode() == KeyEvent.VK_F) { searchTF.requestFocus(); } } diff --git a/src/main/java/info/istlab/IoTP/JTAConsole.java b/src/main/java/info/istlab/IoTP/JTAConsole.java index 8516779..7f078fa 100644 --- a/src/main/java/info/istlab/IoTP/JTAConsole.java +++ b/src/main/java/info/istlab/IoTP/JTAConsole.java @@ -22,9 +22,9 @@ import java.util.Stack; import javax.swing.JFrame; -import javax.swing.JScrollPane; import javax.swing.text.BadLocationException; +import org.fife.ui.rtextarea.RTextScrollPane; public class JTAConsole extends MyRSJTextArea implements Runnable, WindowListener, KeyListener, MouseListener, ActionListener { @@ -32,6 +32,7 @@ // static Point lastActivePoint; static Stack winStack = new Stack(); JFrame frame; + RTextScrollPane scrollPane; Process process; Thread thread; InputStream instream; @@ -48,33 +49,18 @@ // pb = prob; frame = new JFrame(title); - frame.getContentPane().add(new JScrollPane(this)); + frame.getContentPane().add(scrollPane = new RTextScrollPane(this)); frame.setSize(500, 200); frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); frame.addWindowListener(this); - // if (winStack.size() > 0) { - // JTAConsole last = winStack.peek(); - // if (last.isVisible()) { - // Point lastFrameP = last.frame.getLocationOnScreen(); - // frame.setLocation(lastFrameP.x + 470, lastFrameP.y); - // } - // } else { - if (Editor.lastOpened != null) { - Point lastEditorP = Editor.lastOpened.getLocationOnScreen(); - Dimension lastEditorD = Editor.lastOpened.getSize(); - frame.setLocation(lastEditorP.x, lastEditorP.y + lastEditorD.height); - } - // } + if (Editor.lastOpened != null) { + Point lastEditorP = Editor.lastOpened.getLocationOnScreen(); + Dimension lastEditorD = Editor.lastOpened.getSize(); + frame.setLocation(lastEditorP.x, lastEditorP.y + lastEditorD.height); + } addKeyListener(this); addMouseListener(this); - // if (lastActivePoint != null){ - // frame.setLocation(lastActivePoint.x+500, lastActivePoint.y); - // } else if (lastWindow != null && lastWindow.isVisible()){ - // Point lastFrameP = lastWindow.frame.getLocationOnScreen(); - // frame.setLocation(lastFrameP.x+500, lastFrameP.y); - // } - // lastWindow = this; winStack.push(this); originalContent = new StringBuilder(); frame.setVisible(true); @@ -229,7 +215,7 @@ } if (e.isControlDown() || e.isAltDown() || e.isAltGraphDown() || e.isMetaDown()) { - if (e.getKeyCode() == 67) { // CTRL+C + if (e.getKeyCode() == 67) { // CTRL+C if (getSelectedText() != null) { // 文字列をクリップボードにコピーする Toolkit kit = Toolkit.getDefaultToolkit(); @@ -282,25 +268,21 @@ @Override public void mousePressed(MouseEvent e) { - // TODO Auto-generated method stub } @Override public void mouseReleased(MouseEvent e) { - // TODO Auto-generated method stub } @Override public void mouseEntered(MouseEvent e) { - // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent e) { - // TODO Auto-generated method stub } @@ -324,8 +306,7 @@ } // public void setMainSrcByFileName(String absolutePath) { - // File f = new File(absolutePath); - // mainSrc = Editor.loadFile(f); + // File f = new File(absolutePath); + // mainSrc = Editor.loadFile(f); // } } - diff --git a/src/main/java/info/istlab/IoTP/Launcher.java b/src/main/java/info/istlab/IoTP/Launcher.java index e6f3ed7..4a7a04a 100644 --- a/src/main/java/info/istlab/IoTP/Launcher.java +++ b/src/main/java/info/istlab/IoTP/Launcher.java @@ -31,7 +31,7 @@ public class Launcher extends JFrame implements MouseInputListener, KeyListener, Runnable { public static Launcher theapp; - public static String version = "0.52"; + public static String version = "0.53"; static int reboot_msec = 2000; // JPanel mainP; File root; @@ -354,43 +354,36 @@ @Override public void mousePressed(MouseEvent e) { - // TODO Auto-generated method stub } @Override public void mouseReleased(MouseEvent e) { - // TODO Auto-generated method stub } @Override public void mouseEntered(MouseEvent e) { - // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent e) { - // TODO Auto-generated method stub } @Override public void mouseDragged(MouseEvent e) { - // TODO Auto-generated method stub } @Override public void mouseMoved(MouseEvent e) { - // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent e) { - // TODO Auto-generated method stub } @@ -411,7 +404,6 @@ @Override public void keyReleased(KeyEvent e) { - // TODO Auto-generated method stub }