|
From: Márcio V. d. S. <mv...@us...> - 2007-11-12 21:32:38
|
Update of /cvsroot/tail/TailS/src/java/net/sf/tails/swing/frame In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv17613/src/java/net/sf/tails/swing/frame Modified Files: Index.java Log Message: Ajustando erros relativos ao help. Index: Index.java =================================================================== RCS file: /cvsroot/tail/TailS/src/java/net/sf/tails/swing/frame/Index.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** Index.java 5 Nov 2007 23:20:11 -0000 1.48 --- Index.java 12 Nov 2007 21:32:23 -0000 1.49 *************** *** 25,28 **** --- 25,29 ---- import java.io.OutputStream; import java.io.PrintWriter; + import java.lang.reflect.Method; import java.util.ResourceBundle; *************** *** 62,66 **** import net.sf.tails.swing.helper.CompleteReportGenerator; import net.sf.tails.swing.helper.FrameHelper; - import net.sf.tails.swing.helper.HelpFrame; import org.jfree.chart.ChartPanel; --- 63,66 ---- *************** *** 730,736 **** } protected void helpButtonActionPerformed(ActionEvent evt) { ! new HelpFrame().setVisible(true); } --- 730,763 ---- } + @SuppressWarnings("unchecked") protected void helpButtonActionPerformed(ActionEvent evt) { ! String osName = System.getProperty("os.name"); ! String url = "http://tail.cvs.sourceforge.net/*checkout*/tail/TailS/Data/Help/TailSHelp.html?revision=1.1#Runner"; + try { + if (osName.startsWith("Mac OS")) { + Class fileMgr = Class.forName("com.apple.eio.FileManager"); + Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class}); + openURL.invoke(null, new Object[] {url}); + } + else if (osName.startsWith("Windows")) { + Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); + } + else { + //Unix ou Linux + String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" }; + String browser = null; + for (int count = 0; count < browsers.length && browser == null; count++) + { + if (Runtime.getRuntime().exec( new String[] {"which", browsers[count]}).waitFor() == 0) browser = browsers[count]; + } + if (browser == null) + JOptionPane.showMessageDialog(null, messageBundle.getString("LINUX"), "Error", 0); + else Runtime.getRuntime().exec(new String[] {browser, url}); + } + } + catch (Exception e) { + JOptionPane.showMessageDialog(null, messageBundle.getString("MAC_WIN_LINUX"), "Error", 0); + } } |