PageRenderTime 22ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-3-pre5/macros/Misc/Make_Bug_Report.bsh

#
Unknown | 118 lines | 108 code | 10 blank | 0 comment | 0 complexity | 7e51f0d8807d362ce4e173e6324e1bbc MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. /*
  2. * Make_Bug_Report.bsh - a BeanShell macro script for the
  3. * jEdit text editor - creates a new buffer with installation and
  4. * error information extracted from jEdit's Activity Log.
  5. * Copyright (C) 2001 John Gellene
  6. * jgellene@nyc.rr.com
  7. * http://community.jedit.org
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. *
  23. * $Id: Make_Bug_Report.bsh 3873 2001-11-06 17:57:35Z jgellene $
  24. *
  25. * Checked for jEdit 4.0 API
  26. *
  27. */
  28. makeBugReport()
  29. {
  30. Log.flushStream();
  31. path = jEdit.getSettingsDirectory() + File.separator
  32. + "activity.log";
  33. try
  34. {
  35. file = new FileInputStream(path);
  36. reader = new BufferedReader(new InputStreamReader(file));
  37. }
  38. catch(IOException e)
  39. {
  40. Macros.error(view, "Error opening Activity Log.");
  41. return;
  42. }
  43. report = new StringBuffer();
  44. report.append("Activity log entries that might be useful in a bug report:\n\n");
  45. lastError = new StringBuffer();
  46. insideError = false;
  47. startupDone = false;
  48. activityLogHeaderLines = 9;
  49. try
  50. {
  51. for(i = 0; i < activityLogHeaderLines; ++i)
  52. {
  53. report.append(reader.readLine()).append('\n');
  54. }
  55. while((line = reader.readLine()) != null)
  56. {
  57. if(!startupDone &&
  58. (line.startsWith("[message] jEdit:")
  59. || line.startsWith("[notice] jEdit:")
  60. || line.startsWith("[notice] JARClassLoader:")))
  61. {
  62. report.append(line).append('\n');
  63. if(line.equals("[message] jEdit: Startup complete"))
  64. {
  65. startupDone = true;
  66. }
  67. }
  68. else if(line.startsWith("[error]"))
  69. {
  70. if(!insideError)
  71. {
  72. lastError.setLength(0);
  73. insideError = true;
  74. }
  75. lastError.append(line).append('\n');
  76. }
  77. else
  78. insideError = false;
  79. }
  80. reader.close();
  81. }
  82. catch(IOException e)
  83. {
  84. Macros.error(view, "Error reading Activity Log");
  85. }
  86. report.append(lastError.toString());
  87. newBuffer = jEdit.newFile(view);
  88. newBuffer.insert(0, report.toString());
  89. }
  90. makeBugReport();
  91. /*
  92. jEdit macro index data (DocBook format)
  93. <listitem>
  94. <para><filename>Make_Bug_Report.bsh</filename></para>
  95. <abstract><para>
  96. Creates a new buffer with installation and error information
  97. extracted from the Activity Log.
  98. </para></abstract>
  99. <para>
  100. The macro extracts initial messages written to the Activity Log
  101. describing the user's operating system, JDK, jEdit version and
  102. installed plugins. It then appends the last set of error messages
  103. written to the Activity Log. The new text buffer can be saved and
  104. attached to an email message or a bug report made on SourceForge.
  105. </para>
  106. </listitem>
  107. */
  108. // end Make_Bug_Report.bsh