Added a "version" Property in main.properties and NewConstants that is shown in the error reports.

This commit is contained in:
jendave
2011-08-06 02:45:31 +00:00
parent a48a6f43bb
commit a7c89eff0f
5 changed files with 18 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
program/name=MTG Forge - 10/2009 - http://mtgrares.blogspot.com program/name=MTG Forge - http://mtgrares.blogspot.com
@@ -79,6 +79,8 @@ ErrorViewer/message=Ein Fehler ist aufgetreten. Du kannst diese Nachricht kopier
Falls du keine Konto anlegen willst, schreibe eine Mail an\n\ Falls du keine Konto anlegen willst, schreibe eine Mail an\n\
\t%s\n\n\ \t%s\n\n\
%s\n\n\ %s\n\n\
Version:\n\
%s\n\
Detaillierter Stapelverlauf:\n Detaillierter Stapelverlauf:\n
ErrorViewer/button/save=Speichern... ErrorViewer/button/save=Speichern...
ErrorViewer/button/close=Schlie<EFBFBD>en ErrorViewer/button/close=Schlie<EFBFBD>en

View File

@@ -1,4 +1,4 @@
program/name=MTG Forge - 10/2009 - http://mtgrares.blogspot.com program/name=MTG Forge - http://mtgrares.blogspot.com
@@ -79,6 +79,8 @@ ErrorViewer/message=An error has occured. You can copy/paste this message or sav
If you don't want to register an account, you can mail it directly to\n\ If you don't want to register an account, you can mail it directly to\n\
\t%s\n\n\ \t%s\n\n\
%s\n\n\ %s\n\n\
Version:\n\
%s\n\
Detailed error trace:\n Detailed error trace:\n
ErrorViewer/button/save=Save... ErrorViewer/button/save=Save...
ErrorViewer/button/close=Close ErrorViewer/button/close=Close

View File

@@ -1,5 +1,6 @@
program/mail=mtgrares@yahoo.com program/mail=mtgrares@yahoo.com
program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26 program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26
program/version=MTG Forge 09/11/02
tokens--file=AllTokens.txt tokens--file=AllTokens.txt

View File

@@ -2,6 +2,7 @@
package forge.error; package forge.error;
import static forge.properties.ForgeProps.*;
import static java.awt.event.InputEvent.*; import static java.awt.event.InputEvent.*;
import static java.awt.event.KeyEvent.*; import static java.awt.event.KeyEvent.*;
import static javax.swing.JOptionPane.*; import static javax.swing.JOptionPane.*;
@@ -27,7 +28,6 @@ import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import forge.properties.ForgeProps;
import forge.properties.NewConstants; import forge.properties.NewConstants;
@@ -109,11 +109,10 @@ public class ErrorViewer implements NewConstants, NewConstants.LANG.ErrorViewer
//Button is not modified, String gets the automatic listener to hide the dialog //Button is not modified, String gets the automatic listener to hide the dialog
Object[] options = { Object[] options = {
new JButton(new SaveAction(area)), ForgeProps.getLocalized(BUTTON_CLOSE), new JButton(new SaveAction(area)), getLocalized(BUTTON_CLOSE), new JButton(new ExitAction())};
new JButton(new ExitAction())};
JOptionPane pane = new JOptionPane(new JScrollPane(area), ERROR_MESSAGE, DEFAULT_OPTION, null, options, JOptionPane pane = new JOptionPane(new JScrollPane(area), ERROR_MESSAGE, DEFAULT_OPTION, null, options,
options[1]); options[1]);
JDialog dlg = pane.createDialog(null, ForgeProps.getLocalized(TITLE)); JDialog dlg = pane.createDialog(null, getLocalized(TITLE));
dlg.setResizable(true); dlg.setResizable(true);
dlg.setVisible(true); dlg.setVisible(true);
dlg.dispose(); dlg.dispose();
@@ -126,7 +125,7 @@ public class ErrorViewer implements NewConstants, NewConstants.LANG.ErrorViewer
if(message != null) System.err.println(message); if(message != null) System.err.println(message);
ex.printStackTrace(); ex.printStackTrace();
pw.printf(ForgeProps.getLocalized(MESSAGE), ForgeProps.getProperty(FORUM), ForgeProps.getProperty(MAIL), pw.printf(getLocalized(MESSAGE), getProperty(FORUM), getProperty(MAIL), getProperty(VERSION),
message != null? message:ex.getMessage()); message != null? message:ex.getMessage());
ex.printStackTrace(pw); ex.printStackTrace(pw);
} }
@@ -137,8 +136,7 @@ public class ErrorViewer implements NewConstants, NewConstants.LANG.ErrorViewer
private static void printError(PrintWriter pw, String message) { private static void printError(PrintWriter pw, String message) {
System.err.println(message); System.err.println(message);
pw.printf(ForgeProps.getLocalized(MESSAGE), ForgeProps.getProperty(FORUM), ForgeProps.getProperty(MAIL), pw.printf(getLocalized(MESSAGE), getProperty(FORUM), getProperty(MAIL), getProperty(VERSION), message);
message);
Map<Thread, StackTraceElement[]> traces = Thread.getAllStackTraces(); Map<Thread, StackTraceElement[]> traces = Thread.getAllStackTraces();
for(Entry<Thread, StackTraceElement[]> e:traces.entrySet()) { for(Entry<Thread, StackTraceElement[]> e:traces.entrySet()) {
pw.println(); pw.println();
@@ -158,7 +156,7 @@ public class ErrorViewer implements NewConstants, NewConstants.LANG.ErrorViewer
private JTextArea area; private JTextArea area;
public SaveAction(JTextArea area) { public SaveAction(JTextArea area) {
super(ForgeProps.getLocalized(BUTTON_SAVE)); super(getLocalized(BUTTON_SAVE));
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(VK_S, CTRL_DOWN_MASK)); putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(VK_S, CTRL_DOWN_MASK));
this.area = area; this.area = area;
} }
@@ -181,7 +179,7 @@ public class ErrorViewer implements NewConstants, NewConstants.LANG.ErrorViewer
bw.write(area.getText()); bw.write(area.getText());
bw.close(); bw.close();
} catch(IOException ex) { } catch(IOException ex) {
showError(ex, ForgeProps.getLocalized(ERRORS.SAVE_MESSAGE)); showError(ex, getLocalized(ERRORS.SAVE_MESSAGE));
} }
} }
} }
@@ -191,7 +189,7 @@ public class ErrorViewer implements NewConstants, NewConstants.LANG.ErrorViewer
private static final long serialVersionUID = 276202595758381626L; private static final long serialVersionUID = 276202595758381626L;
public ExitAction() { public ExitAction() {
super(ForgeProps.getLocalized(BUTTON_EXIT)); super(getLocalized(BUTTON_EXIT));
} }
@@ -205,11 +203,11 @@ public class ErrorViewer implements NewConstants, NewConstants.LANG.ErrorViewer
private static final long serialVersionUID = 5638147106706803363L; private static final long serialVersionUID = 5638147106706803363L;
public ShowAllThreadsAction() { public ShowAllThreadsAction() {
super(ForgeProps.getLocalized(SHOW_ERROR)); super(getLocalized(SHOW_ERROR));
} }
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showErrorAllThreads(ForgeProps.getLocalized(ERRORS.SHOW_MESSAGE)); showErrorAllThreads(getLocalized(ERRORS.SHOW_MESSAGE));
} }
} }
} }

View File

@@ -19,6 +19,7 @@ public interface NewConstants {
//General properties //General properties
public static final String MAIL = "program/mail"; public static final String MAIL = "program/mail";
public static final String FORUM = "program/forum"; public static final String FORUM = "program/forum";
public static final String VERSION = "program/version";
public static final String DECKS = "decks"; public static final String DECKS = "decks";
public static final String BOOSTER_DECKS = "booster-decks"; public static final String BOOSTER_DECKS = "booster-decks";