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(); private static final int SHORTCUT_KEY = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
public static final int COMPONENT_TAB = 0; 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 // 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 = new ComponentTree(document);
tree.setSelectionModel(componentSelectionModel); tree.setSelectionModel(componentSelectionModel);

View File

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

View File

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