|
57 | 57 | import processing.app.tools.ZipDeflater; |
58 | 58 |
|
59 | 59 | import javax.swing.*; |
| 60 | + |
60 | 61 | import java.awt.*; |
61 | 62 | import java.awt.event.*; |
62 | 63 | import java.io.*; |
63 | 64 | import java.util.*; |
64 | 65 | import java.util.List; |
| 66 | +import java.util.logging.Handler; |
| 67 | +import java.util.logging.Level; |
| 68 | +import java.util.logging.Logger; |
65 | 69 |
|
66 | 70 | import static processing.app.I18n._; |
67 | 71 |
|
@@ -137,6 +141,8 @@ static public void guardedMain(String args[]) throws Exception { |
137 | 141 |
|
138 | 142 | BaseNoGui.initLogger(); |
139 | 143 |
|
| 144 | + initLogger(); |
| 145 | + |
140 | 146 | BaseNoGui.notifier = new GUIUserNotifier(); |
141 | 147 |
|
142 | 148 | initPlatform(); |
@@ -215,6 +221,34 @@ static public void guardedMain(String args[]) throws Exception { |
215 | 221 | INSTANCE = new Base(args); |
216 | 222 | } |
217 | 223 |
|
| 224 | + |
| 225 | + static public void initLogger() { |
| 226 | + Handler consoleHandler = new ConsoleLogger(); |
| 227 | + consoleHandler.setLevel(Level.ALL); |
| 228 | + consoleHandler.setFormatter(new LogFormatter("%1$tl:%1$tM:%1$tS [%4$7s] %2$s: %5$s%n")); |
| 229 | + |
| 230 | + Logger globalLogger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); |
| 231 | + globalLogger.setLevel(consoleHandler.getLevel()); |
| 232 | + |
| 233 | + // Remove default |
| 234 | + Handler[] handlers = globalLogger.getHandlers(); |
| 235 | + for(Handler handler : handlers) { |
| 236 | + globalLogger.removeHandler(handler); |
| 237 | + } |
| 238 | + Logger root = Logger.getLogger(""); |
| 239 | + handlers = root.getHandlers(); |
| 240 | + for(Handler handler : handlers) { |
| 241 | + root.removeHandler(handler); |
| 242 | + } |
| 243 | + |
| 244 | + globalLogger.addHandler(consoleHandler); |
| 245 | + |
| 246 | + Logger.getLogger("cc.arduino.packages.autocomplete").setParent(globalLogger); |
| 247 | + Logger.getLogger("br.com.criativasoft.cpluslibparser").setParent(globalLogger); |
| 248 | + Logger.getLogger(Base.class.getPackage().getName()).setParent(globalLogger); |
| 249 | + |
| 250 | + } |
| 251 | + |
218 | 252 |
|
219 | 253 | static protected void setCommandLine() { |
220 | 254 | commandLine = true; |
@@ -2098,6 +2132,14 @@ static public void setIcon(Frame frame) { |
2098 | 2132 | // don't use the low-res icon on Mac OS X; the window should |
2099 | 2133 | // already have the right icon from the .app file. |
2100 | 2134 | if (OSUtils.isMacOS()) return; |
| 2135 | + |
| 2136 | + // don't use the low-res icon on Linux |
| 2137 | + if (OSUtils.isLinux()){ |
| 2138 | + String current = System.getProperty("user.dir"); |
| 2139 | + Image image = Toolkit.getDefaultToolkit().createImage(current + "/lib/arduino.png"); |
| 2140 | + frame.setIconImage(image); |
| 2141 | + return; |
| 2142 | + } |
2101 | 2143 |
|
2102 | 2144 | Image image = Toolkit.getDefaultToolkit().createImage(PApplet.ICON_IMAGE); |
2103 | 2145 | frame.setIconImage(image); |
@@ -2152,7 +2194,12 @@ static public void showReference(String prefix, String filename) { |
2152 | 2194 | File referenceFile = new File(referenceFolder, filename); |
2153 | 2195 | if (!referenceFile.exists()) |
2154 | 2196 | referenceFile = new File(referenceFolder, filename + ".html"); |
2155 | | - openURL(referenceFile.getAbsolutePath()); |
| 2197 | + |
| 2198 | + if(referenceFile.exists()){ |
| 2199 | + openURL(referenceFile.getAbsolutePath()); |
| 2200 | + }else{ |
| 2201 | + showWarning(_("Problem Opening URL"), I18n.format(_("Could not open the URL\n{0}"), referenceFile), null); |
| 2202 | + } |
2156 | 2203 | } |
2157 | 2204 |
|
2158 | 2205 | public static void showEdisonGettingStarted() { |
|
0 commit comments