eirikbakke commented on code in PR #8318: URL: https://github.com/apache/netbeans/pull/8318#discussion_r1991443298
########## platform/o.n.core/src/org/netbeans/core/actions/LogViewerSupport.java: ########## @@ -103,7 +105,20 @@ public void run() { }catch (IOException e) { Logger.getLogger(LogViewerSupport.class.getName()).log(Level.INFO, null, e); } - task.schedule(10000); + /* If the user closes the entire Output pane, rather than the specific IDE Log tab + within the Output pane, the InputOutput will not actually end up being closed. Detect + this situation and close the InputOutput explicitly in this case. */ + SwingUtilities.invokeLater(() -> { Review Comment: > I really don't like this code. The fix is in the wrong place, if it needs fixing at all?! It's ugly, but I do think it needs fixing, as it's a case where a worker thread would be started and never stopped. Could deplete the laptop battery over time, long after the user closed the output pane. Maybe closing Output is less common in the IDE. In my platform app it's usually closed, though, and looked at only for logging. > If you close Output with only a single tab, should it explicitly close the tab??? Probably not, because if the user then clicks Window->Output to reopen the Output pane, the tabs should remain the way they were. Or not? Even if we did, the problem would remain if there is more than one tab when the user closes the Output pane. > The updates could possibly be based on activation? A shame that the IO callbacks are lacking visibility calls, but could be added? Probably not "activation" in the sense of "focus", because one should be able to keep seeing the log update even if focus is elsewhere. Visibility is another option, though. I could try doing JComponent.addHierarchyListener and listening for HierarchyEvent.DISPLAYABILITY_CHANGED/SHOWING_CHANGED if you think that is better? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists