You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/08/09 18:12:56 UTC

[GitHub] [netbeans] mbien commented on a diff in pull request #4490: Exception reporter improvments

mbien commented on code in PR #4490:
URL: https://github.com/apache/netbeans/pull/4490#discussion_r941657199


##########
platform/o.n.core/src/org/netbeans/core/NotifyExcPanel.java:
##########
@@ -484,32 +490,41 @@ public void run() {
                 }
             } else {
                 ResourceBundle curBundle = NbBundle.getBundle (NotifyExcPanel.class);
+                String message;
                 if (current.getSeverity() == Level.WARNING) {
                     // less scary message for warning level
-                    descriptor.setMessage (
-                        java.text.MessageFormat.format(
-                            curBundle.getString("NTF_ExceptionWarning"),
-                            new Object[] {
-                                current.getClassName ()
-                            }
-                        )
+                    message = MessageFormat.format(
+                        curBundle.getString("NTF_ExceptionWarning"),
+                        new Object[] { current.getClassName() }
                     );
                     title = curBundle.getString("NTF_ExceptionWarningTitle"); // NOI18N
                 } else {
-                    // emphasize user-non-friendly exceptions
-                    //      if (this.getMessage() == null || "".equals(this.getMessage())) { // NOI18N
-                    descriptor.setMessage (
-                        java.text.MessageFormat.format(
-                            curBundle.getString("NTF_ExceptionalException"),
-                            new Object[] {
-                                current.getClassName (),
-                                CLIOptions.getLogDir ()
-                            }
-                        )
+                    message = MessageFormat.format(
+                        curBundle.getString("NTF_ExceptionalException"),
+                        new Object[] { current.getClassName(), CLIOptions.getLogDir() }
                     );
-
                     title = curBundle.getString("NTF_ExceptionalExceptionTitle"); // NOI18N
                 }
+                JTextPane pane = new JTextPane();
+                pane.setContentType("text/html"); // NOI18N
+                pane.setText(message);
+                pane.setBackground(UIManager.getColor("Label.background")); // NOI18N
+                pane.setBorder(BorderFactory.createEmptyBorder());
+                pane.setEditable(false);
+                pane.setFocusable(true);
+                pane.addHyperlinkListener((e) -> {
+                    if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
+                        try {
+                            Desktop.getDesktop().browse(e.getURL().toURI());

Review Comment:
   one is a `file://` the other is a `https://`. It does open the folder for me (not in the browser, in nemo, my filesystem explorer).
   
   does this work for you?
   ```java
       public static void main(String[] args) throws IOException {
           Desktop.getDesktop().browse(URI.create("file:///tmp/"));
       }
   ```
   



-- 
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-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists