|
55 | 55 | import processing.app.tools.ZipDeflater; |
56 | 56 |
|
57 | 57 | import javax.swing.*; |
| 58 | + |
58 | 59 | import java.awt.*; |
59 | 60 | import java.awt.event.*; |
60 | 61 | import java.io.*; |
61 | 62 | import java.util.*; |
62 | 63 | import java.util.List; |
| 64 | +import java.util.logging.Handler; |
| 65 | +import java.util.logging.Level; |
| 66 | +import java.util.logging.Logger; |
63 | 67 |
|
64 | 68 | import static processing.app.I18n._; |
65 | 69 |
|
@@ -134,6 +138,8 @@ static public void guardedMain(String args[]) throws Exception { |
134 | 138 |
|
135 | 139 | BaseNoGui.initLogger(); |
136 | 140 |
|
| 141 | + initLogger(); |
| 142 | + |
137 | 143 | BaseNoGui.notifier = new GUIUserNotifier(); |
138 | 144 |
|
139 | 145 | initPlatform(); |
@@ -212,6 +218,34 @@ static public void guardedMain(String args[]) throws Exception { |
212 | 218 | INSTANCE = new Base(args); |
213 | 219 | } |
214 | 220 |
|
| 221 | + |
| 222 | + static public void initLogger() { |
| 223 | + Handler consoleHandler = new ConsoleLogger(); |
| 224 | + consoleHandler.setLevel(Level.ALL); |
| 225 | + consoleHandler.setFormatter(new LogFormatter("%1$tl:%1$tM:%1$tS [%4$7s] %2$s: %5$s%n")); |
| 226 | + |
| 227 | + Logger globalLogger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); |
| 228 | + globalLogger.setLevel(consoleHandler.getLevel()); |
| 229 | + |
| 230 | + // Remove default |
| 231 | + Handler[] handlers = globalLogger.getHandlers(); |
| 232 | + for(Handler handler : handlers) { |
| 233 | + globalLogger.removeHandler(handler); |
| 234 | + } |
| 235 | + Logger root = Logger.getLogger(""); |
| 236 | + handlers = root.getHandlers(); |
| 237 | + for(Handler handler : handlers) { |
| 238 | + root.removeHandler(handler); |
| 239 | + } |
| 240 | + |
| 241 | + globalLogger.addHandler(consoleHandler); |
| 242 | + |
| 243 | + Logger.getLogger("cc.arduino.packages.autocomplete").setParent(globalLogger); |
| 244 | + Logger.getLogger("br.com.criativasoft.cpluslibparser").setParent(globalLogger); |
| 245 | + Logger.getLogger(Base.class.getPackage().getName()).setParent(globalLogger); |
| 246 | + |
| 247 | + } |
| 248 | + |
215 | 249 |
|
216 | 250 | static protected void setCommandLine() { |
217 | 251 | commandLine = true; |
@@ -2083,6 +2117,14 @@ static public void setIcon(Frame frame) { |
2083 | 2117 | // don't use the low-res icon on Mac OS X; the window should |
2084 | 2118 | // already have the right icon from the .app file. |
2085 | 2119 | if (OSUtils.isMacOS()) return; |
| 2120 | + |
| 2121 | + // don't use the low-res icon on Linux |
| 2122 | + if (OSUtils.isLinux()){ |
| 2123 | + String current = System.getProperty("user.dir"); |
| 2124 | + Image image = Toolkit.getDefaultToolkit().createImage(current + "/lib/arduino.png"); |
| 2125 | + frame.setIconImage(image); |
| 2126 | + return; |
| 2127 | + } |
2086 | 2128 |
|
2087 | 2129 | Image image = Toolkit.getDefaultToolkit().createImage(PApplet.ICON_IMAGE); |
2088 | 2130 | frame.setIconImage(image); |
@@ -2137,7 +2179,12 @@ static public void showReference(String prefix, String filename) { |
2137 | 2179 | File referenceFile = new File(referenceFolder, filename); |
2138 | 2180 | if (!referenceFile.exists()) |
2139 | 2181 | referenceFile = new File(referenceFolder, filename + ".html"); |
2140 | | - openURL(referenceFile.getAbsolutePath()); |
| 2182 | + |
| 2183 | + if(referenceFile.exists()){ |
| 2184 | + openURL(referenceFile.getAbsolutePath()); |
| 2185 | + }else{ |
| 2186 | + showWarning(_("Problem Opening URL"), I18n.format(_("Could not open the URL\n{0}"), referenceFile), null); |
| 2187 | + } |
2141 | 2188 | } |
2142 | 2189 |
|
2143 | 2190 | public static void showEdisonGettingStarted() { |
|
0 commit comments