Merge pull request #170 from kruland2607/master

Bug fixes.
This commit is contained in:
kruland2607 2013-12-16 20:20:49 -08:00
commit ff572bf4b5
3 changed files with 120 additions and 96 deletions

View File

@ -119,7 +119,8 @@ public class BasicFrame extends JFrame {
private static final int SHORTCUT_KEY = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
public static final int COMPONENT_TAB = 0;
public static final int SIMULATION_TAB = 1;
public static final int CONFIGURATION_TAB = 1;
public static final int SIMULATION_TAB = 2;
/**
@ -266,7 +267,7 @@ public class BasicFrame extends JFrame {
// Upper-left segment, component tree
JPanel panel = new JPanel(new MigLayout("fill, flowy", "", "[grow]"));
JPanel panel = new JPanel(new MigLayout("fill, flowy", "[grow][grow 0]","[grow]"));
tree = new ComponentTree(document);
tree.setSelectionModel(componentSelectionModel);

View File

@ -170,10 +170,10 @@ public class SwingExceptionHandler implements Thread.UncaughtExceptionHandler, E
log.info("Showing out-of-memory dialog");
JOptionPane.showMessageDialog(null,
new Object[] {
"OpenRocket is out of available memory!",
"You should immediately close unnecessary design windows,",
"save any unsaved designs and restart OpenRocket!"
}, "Out of memory", JOptionPane.ERROR_MESSAGE);
"OpenRocket is out of available memory!",
"You should immediately close unnecessary design windows,",
"save any unsaved designs and restart OpenRocket!"
}, "Out of memory", JOptionPane.ERROR_MESSAGE);
return;
}
@ -188,11 +188,11 @@ public class SwingExceptionHandler implements Thread.UncaughtExceptionHandler, E
log.info("Showing Error dialog");
JOptionPane.showMessageDialog(null,
new Object[] {
"An unknown Java error occurred:",
msg,
"<html>You should immediately close unnecessary design windows,<br>" +
"save any unsaved designs and restart OpenRocket!"
}, "Unknown Java error", JOptionPane.ERROR_MESSAGE);
"An unknown Java error occurred:",
msg,
"<html>You should immediately close unnecessary design windows,<br>" +
"save any unsaved designs and restart OpenRocket!"
}, "Unknown Java error", JOptionPane.ERROR_MESSAGE);
return;
}
@ -202,13 +202,13 @@ public class SwingExceptionHandler implements Thread.UncaughtExceptionHandler, E
int selection = JOptionPane.showOptionDialog(null, new Object[] {
"OpenRocket encountered an uncaught exception. This typically signifies " +
"a bug in the software.",
"<html><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + msg + "</em>",
" ",
"Please take a moment to report this bug to the developers.",
"This can be done automatically if you have an Internet connection."
"<html><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + msg + "</em>",
" ",
"Please take a moment to report this bug to the developers.",
"This can be done automatically if you have an Internet connection."
}, "Uncaught exception", JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE, null,
new Object[] { "View bug report", "Close" }, "View bug report");
JOptionPane.ERROR_MESSAGE, null,
new Object[] { "View bug report", "Close" }, "View bug report");
if (selection != 0) {
// User cancelled
@ -326,7 +326,7 @@ public class SwingExceptionHandler implements Thread.UncaughtExceptionHandler, E
if (elements.length >= 3 &&
(buggyClass.equals(elements[0].getClassName()) ||
buggyClass.equals(elements[1].getClassName()) ||
buggyClass.equals(elements[2].getClassName()))) {
buggyClass.equals(elements[2].getClassName()))) {
log.warn("Ignoring Sun JRE bug 6828938: " +
"(see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6828938): " + t);
return true;
@ -402,6 +402,24 @@ public class SwingExceptionHandler implements Thread.UncaughtExceptionHandler, E
}
}
/*
* Detect and ignore DnD bug in component tree - related to 6560955 in Sun JRE.
*/
if (t instanceof NullPointerException) {
StackTraceElement[] trace = t.getStackTrace();
if (trace.length > 2 &&
trace[0].getClassName().equals("javax.swing.tree.TreePath") &&
trace[0].getMethodName().equals("pathByAddingChild") &&
trace[1].getClassName().equals("javax.swing.plaf.basic.BasicTreeUI") &&
trace[1].getMethodName().equals("getDropLineRect")) {
log.warn("Ignoring Sun JRE bug updating drop location " +
"(see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6560955): " + t);
return true;
}
}
return false;
}

View File

@ -10,6 +10,7 @@ import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.ToolTipManager;
import net.miginfocom.layout.LayoutUtil;
import net.sf.openrocket.arch.SystemInfo;
import net.sf.openrocket.arch.SystemInfo.Platform;
import net.sf.openrocket.communication.UpdateInfo;
@ -51,6 +52,10 @@ public class SwingStartup {
// Check for "openrocket.debug" property before anything else
checkDebugStatus();
if (System.getProperty("openrocket.debug.layout") != null) {
LayoutUtil.setGlobalDebugMillis(100);
}
// Initialize logging first so we can use it
initializeLogging();
log.info("Starting up OpenRocket version " + BuildProperties.getVersion());