OSDN Git Service

open urls in browser
authortama3 <tama3@acee48c3-7b26-0410-bdac-b3d0e5314bbc>
Sat, 7 Jul 2007 03:55:09 +0000 (03:55 +0000)
committertama3 <tama3@acee48c3-7b26-0410-bdac-b3d0e5314bbc>
Sat, 7 Jul 2007 03:55:09 +0000 (03:55 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/stigmata/trunk@147 acee48c3-7b26-0410-bdac-b3d0e5314bbc

src/main/java/jp/naist/se/stigmata/ui/swing/actions/AboutAction.java
src/main/java/jp/naist/se/stigmata/ui/swing/actions/LinkFollower.java [new file with mode: 0755]
src/main/java/jp/naist/se/stigmata/ui/swing/actions/ShowTextAction.java
src/main/resources/resources/about.html [new file with mode: 0755]
src/main/resources/resources/about.txt [deleted file]
src/site/apt/download.apt
src/site/apt/index.apt

index 70fe1ef..adcdc7c 100644 (file)
@@ -26,14 +26,19 @@ public class AboutAction extends ShowTextAction{
     }\r
 \r
     @Override\r
+    public boolean isHtmlDocument(){\r
+        return true;\r
+    }\r
+\r
+    @Override\r
     public String getTitle(){\r
         return Messages.getString("about.dialog.title");\r
     }\r
 \r
     @Override\r
     public String getMessage(){\r
-        String aboutMessage = loadStringFromFile(getClass().getResource("/resources/about.txt"));\r
-        \r
+        String aboutMessage = loadStringFromFile(getClass().getResource("/resources/about.html"));\r
+\r
         Package p = getClass().getPackage();\r
         aboutMessage = aboutMessage.replace("${implementation.version}", p.getImplementationVersion());\r
         aboutMessage = aboutMessage.replace("${implementation.vendor}",  p.getImplementationVendor());\r
@@ -43,7 +48,7 @@ public class AboutAction extends ShowTextAction{
     }\r
 \r
     @Override\r
-    public void updatePanel(JPanel panel){\r
+    protected void updatePanel(JPanel panel){\r
         JLabel logo = new JLabel(Utility.getIcon("stigmata.logo"));\r
         panel.add(logo, BorderLayout.NORTH);\r
     }\r
diff --git a/src/main/java/jp/naist/se/stigmata/ui/swing/actions/LinkFollower.java b/src/main/java/jp/naist/se/stigmata/ui/swing/actions/LinkFollower.java
new file mode 100755 (executable)
index 0000000..3ea658f
--- /dev/null
@@ -0,0 +1,42 @@
+package jp.naist.se.stigmata.ui.swing.actions;\r
+\r
+/*\r
+ * $Id$\r
+ */\r
+\r
+import java.io.IOException;\r
+import java.lang.reflect.Method;\r
+import java.net.URL;\r
+\r
+import javax.swing.JEditorPane;\r
+import javax.swing.event.HyperlinkListener;\r
+import javax.swing.event.HyperlinkEvent;\r
+\r
+/**\r
+ *\r
+ * @author Haruaki Tamada\r
+ * @version $Revision$ $Date$\r
+ */\r
+class LinkFollower implements HyperlinkListener{\r
+    public void hyperlinkUpdate(HyperlinkEvent e){\r
+        JEditorPane text = (JEditorPane)e.getSource();\r
+        if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED){\r
+            URL url = null;\r
+            try{\r
+                url = e.getURL();\r
+                browse(url);\r
+            } catch(RuntimeException ee){\r
+                throw ee;\r
+            } catch(Exception ee){\r
+                ee.printStackTrace();\r
+            }\r
+        }\r
+    }\r
+\r
+    private void browse(URL url) throws Exception{\r
+        Class c = Class.forName("edu.stanford.ejalbert.BrowserLauncher");\r
+        Object o = c.newInstance();\r
+        Method m = c.getMethod("openURLinBrowser", String.class);\r
+        m.invoke(o, url.toString());\r
+    }\r
+}
\ No newline at end of file
index bc26a6b..546d9e8 100644 (file)
@@ -16,10 +16,11 @@ import java.io.StringWriter;
 import java.net.URL;\r
 \r
 import javax.swing.AbstractAction;\r
+import javax.swing.JEditorPane;\r
+import javax.swing.JLabel;\r
 import javax.swing.JOptionPane;\r
 import javax.swing.JPanel;\r
 import javax.swing.JScrollPane;\r
-import javax.swing.JTextArea;\r
 \r
 /**\r
  * \r
@@ -35,21 +36,31 @@ abstract class ShowTextAction extends AbstractAction{
 \r
     public abstract String getMessage();\r
 \r
-    public void updatePanel(JPanel panel){\r
+    protected void updatePanel(JPanel panel){\r
     }\r
 \r
     public abstract String getTitle();\r
 \r
+    public boolean isHtmlDocument(){\r
+        return false;\r
+    }\r
+\r
     public void actionPerformed(ActionEvent e){\r
         String message = getMessage();\r
+        JPanel panel = new JPanel(new BorderLayout());\r
+        JScrollPane scroll = new JScrollPane();\r
+        String mimeType = "text/plain";\r
+        if(isHtmlDocument()){\r
+            mimeType = "text/html";\r
+        }\r
+        JEditorPane text = new JEditorPane(mimeType, message);\r
+        text.addHyperlinkListener(new LinkFollower());\r
 \r
-        JTextArea text = new JTextArea(message);\r
         text.setEditable(false);\r
         text.setCaretPosition(0);\r
-        JScrollPane scroll = new JScrollPane();\r
+        text.setBackground(panel.getBackground());\r
         scroll.setViewportView(text);\r
 \r
-        JPanel panel = new JPanel(new BorderLayout());\r
         panel.add(scroll, BorderLayout.CENTER);\r
         panel.setPreferredSize(new Dimension(500, 300));\r
 \r
@@ -68,7 +79,8 @@ abstract class ShowTextAction extends AbstractAction{
             StringWriter writer = new StringWriter();\r
             PrintWriter out = new PrintWriter(writer);\r
             while((line = in.readLine()) != null){\r
-                out.println(line);\r
+                out.print(line);\r
+                out.println();\r
             }\r
             out.close();\r
             in.close();\r
diff --git a/src/main/resources/resources/about.html b/src/main/resources/resources/about.html
new file mode 100755 (executable)
index 0000000..90a40a8
--- /dev/null
@@ -0,0 +1,32 @@
+<html>\r
+<body>\r
+<p>\r
+Stigmata version: ${implementation.version}\r
+</p><p>\r
+Copyright (C) by Haruaki Tamada, Ph.D.,\r
+${implementation.vendor} 2004-2007,\r
+All right reserved.\r
+</p><p>\r
+Stigmata uses ASM library for engineering Java bytecode.<br>\r
+<a href="http://asm.objectweb.org/">http://asm.objectweb.org/</a>\r
+</p><p>\r
+Stigmata uses libraries developed by Apache Software Foundation.<br>\r
+<a href="http://www.apache.org/">http://www.apache.org/</a>\r
+</p><p>\r
+Stigmata uses Jama (Java matrix package) in calculating MDS.<br>\r
+<a href="http://math.nist.gov/javanumerics/jama/">http://math.nist.gov/javanumerics/jama/</a>\r
+</p><p>\r
+Stigmata uses BrowserLauncher2 for showing clicked URL in browser<br>\r
+<a href="http://browserlaunch2.sourceforge.net/">http://browserlaunch2.sourceforge.net/</a>\r
+</p><p>\r
+Stigmata uses icons provided by FAMFAMFAM.<br>\r
+<a href="http://www.famfamfam.com/">http://www.famfamfam.com/</a>\r
+</p><p>\r
+Stigmata version ${implementation.version}, Copyright (C) 2004-2007 Haruaki TAMADA<br>\r
+Stigmata comes with ABSOLUTELY NO WARRANTY; for details\r
+select menu item named License.  This is free software, \r
+and you are welcome to redistribute it under certain \r
+conditions; select menu item named License for details.\r
+</p>\r
+</body>\r
+</html>\r
diff --git a/src/main/resources/resources/about.txt b/src/main/resources/resources/about.txt
deleted file mode 100755 (executable)
index 9910243..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-Stigmata version: ${implementation.version}\r
-\r
-Copyright (C) by ${implementation.vendor} 2004-2007,\r
-All right reserved.\r
-\r
-Stigmata uses ASM library for engineering Java bytecode.\r
-http://asm.objectweb.org/\r
-\r
-Stigmata uses libraries developed by Apache Software Foundation.\r
-http://www.apache.org/\r
-\r
-Stigmata uses Jama (Java matrix package) in calculating MDS.\r
-http://math.nist.gov/javanumerics/jama/\r
-\r
-Stigmata uses icons provided by FAMFAMFAM.\r
-http://www.famfamfam.com/\r
-\r
-Stigmata version ${implementation.version}, Copyright (C) 2006-2007 Haruaki TAMADA\r
-Stigmata comes with ABSOLUTELY NO WARRANTY; for details\r
-select menu item named License.  This is free software, \r
-and you are welcome to redistribute it under certain \r
-conditions; select menu item named License for details.\r
index f4302a3..66732d3 100755 (executable)
@@ -3,7 +3,7 @@
  ----\r
  Haruaki Tamada\r
  ----\r
- 2007-06-11\r
+ 2007-07-08\r
  ----\r
 \r
 Download\r
@@ -14,7 +14,7 @@ Download
 \r
  Apache License 2.0\r
 \r
- Copyright (C) 2006-2007  Haruaki TAMADA\r
+ Copyright (C) 2006-2007  Haruaki TAMADA, Ph.D.\r
 \r
  Licensed under the Apache License, Version 2.0 (the "License"); you\r
 may not use this file except in compliance with the License. You may\r
@@ -38,16 +38,21 @@ permissions and limitations under the License.
 \r
  *{{{http://math.nist.gov/javanumerics/jama/}Jama}} 1.0.2 (stigmata-1.0.0 or later)\r
 \r
+ *{{{http://browserlaunch2.sourceforge.net/}BrowserLauncher2}} 1.2 (stigmata-1.1.0 or later; as needed)\r
+\r
  *{{{http://www.junit.org/}JUnit}} 4.1\r
 \r
  []\r
 \r
 **How to install requirements into your Maven local repository\r
 \r
- You must install manually Jama, since it does not support Maven 2.\r
-Other libraries can be automatically downloaded by Maven 2.\r
+ If you want to compile stigmata from source codes, you must install\r
+manually Jama and BrowserLauncher2 into your maven2 local repository.\r
+Because maven2 default remote repository do not has them.  Other\r
+libraries can be automatically downloaded by Maven2.\r
 \r
- type below command.\r
+ type below command for nstalling jar product into your maven2 local\r
+repository.\r
 \r
 ----\r
 $ mvn install:install-file \\r
@@ -59,7 +64,7 @@ $ mvn install:install-file \
 ----\r
 \r
  For example, installing Jama-1.0.2.jar into maven local repository,\r
- copy and paste below command.\r
+copy and paste below command.\r
 \r
 ----\r
 $ mvn install:install-file \\r
index c73dbaa..5398e29 100755 (executable)
@@ -3,7 +3,7 @@
  ----\r
  Haruaki Tamada\r
  ----\r
- 2006-12-12\r
+ 2007-07-08\r
  ----\r
 \r
 Overview\r
@@ -18,7 +18,11 @@ from Java class files, and compare them.  Differences from
 \r
  * using {{{http://asm.objectweb.org/}ASM}} instead of {{{http://jakarta.apache.org}BCEL}}.\r
 \r
- * introduce birthmarking context\r
+ * introducing birthmarking context\r
+\r
+ * implementing new birthmarks (k-gram, frequency of used classes, frequency of method calls)\r
+\r
+ * new analysis method for extracted birthmarks\r
 \r
  []\r
 \r
@@ -41,9 +45,11 @@ files, and written in Java 5 with ASM.
 \r
  * pairwise birthmark comparison of Java class files,\r
 \r
- * Jar file and War file support, and\r
+ * Jar file and War file support,\r
+\r
+ * plug-in architecture for new birthmarks, and\r
 \r
- * plug-in architecture for new birthmarks\r
+ * analysis of extracted birthmarks (MDS)\r
 \r
 Related Tools\r
 \r
@@ -83,8 +89,8 @@ Related Tools
 \r
 Contact\r
 \r
- Contact us by emal \<harua-t[ at ]is.naist.jp\>.\r
+ Contact us by emal \<harua-t[ at ]is.naist.jp\>\r
 \r
  *{{{http://sourceforge.jp/developer/sendmessage.php?touser=587}Email sending form}}\r
 \r
-[]
\ No newline at end of file
+[]\r