diff --git a/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java b/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java index 24acdb01ecc4..f15e54f60162 100755 --- a/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java +++ b/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java @@ -25,16 +25,22 @@ import org.jdesktop.swingx.graphics.GraphicsUtilities; import org.jdesktop.swingx.graphics.ShadowRenderer; import javax.swing.*; +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; import java.awt.*; import java.awt.event.*; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; +import java.io.IOException; +import java.net.URISyntaxException; +import com.intellij.openapi.diagnostic.Logger; /** * Created by Denis Fokin */ public class SheetController { + private static final Logger LOG = Logger.getInstance(SheetController.class); private static final int SHEET_MINIMUM_HEIGHT = 143; private static String fontName = "Lucida Grande"; private static Font regularFont = new Font(fontName, Font.PLAIN, 10); @@ -262,6 +268,24 @@ public class SheetController { messageTextPane.setContentType("text/html"); + messageTextPane.addHyperlinkListener(new HyperlinkListener() { + public void hyperlinkUpdate(HyperlinkEvent he) { + if(he.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + if(Desktop.isDesktopSupported()) { + try { + Desktop.getDesktop().browse(he.getURL().toURI()); + } + catch (IOException e) { + LOG.error(e); + } + catch (URISyntaxException e) { + LOG.error(e); + } + } + } + } + }); + FontMetrics fontMetrics = mySheetMessage.getFontMetrics(regularFont); int widestWordWidth = 250;