when internal tools crash, do not add them to the menu

This commit is contained in:
benfry
2012-03-25 14:13:10 +00:00
parent 51eee1ad6b
commit d012e2cc9a
2 changed files with 14 additions and 12 deletions
+12 -10
View File
@@ -952,7 +952,8 @@ public abstract class Editor extends JFrame implements RunnerListener {
return null;
}
protected JMenuItem createToolMenuItem(String className) {
protected void addToolMenuItem(JMenu menu, String className) {
try {
Class<?> toolClass = Class.forName(className);
final Tool tool = (Tool) toolClass.newInstance();
@@ -966,11 +967,12 @@ public abstract class Editor extends JFrame implements RunnerListener {
SwingUtilities.invokeLater(tool);
}
});
return item;
menu.add(item);
// return item;
} catch (Exception e) {
e.printStackTrace();
return null;
// return null;
}
}
@@ -982,13 +984,13 @@ public abstract class Editor extends JFrame implements RunnerListener {
// item.setAccelerator(KeyStroke.getKeyStroke('T', modifiers));
// menu.add(item);
menu.add(createToolMenuItem("processing.app.tools.CreateFont"));
menu.add(createToolMenuItem("processing.app.tools.ColorSelector"));
menu.add(createToolMenuItem("processing.app.tools.Archiver"));
menu.add(createToolMenuItem("processing.app.tools.FixEncoding"));
addToolMenuItem(menu, "processing.app.tools.CreateFont");
addToolMenuItem(menu, "processing.app.tools.ColorSelector");
addToolMenuItem(menu, "processing.app.tools.Archiver");
addToolMenuItem(menu, "processing.app.tools.FixEncoding");
if (Base.DEBUG) {
menu.add(createToolMenuItem("processing.app.tools.ExportExamples"));
addToolMenuItem(menu, "processing.app.tools.ExportExamples");
}
// // These are temporary entries while Android mode is being worked out.
@@ -1003,8 +1005,8 @@ public abstract class Editor extends JFrame implements RunnerListener {
return menu;
}
/*
// testing internal web server to serve up docs from a zip file
item = new JMenuItem("Web Server Test");
+2 -2
View File
@@ -1,7 +1,7 @@
0205 pde
X fix up some of the error messages inside Compiler
X when internal tools crash, don't add them to the menu
X (prevents the PDE from locking up on startup)
X add EditorState class, device-aware placement