IDEA-124580 Links in mac sheets dialogs do not work

This commit is contained in:
Denis Fokin
2014-04-30 16:03:09 +04:00
parent 534c2aa510
commit 6d7d17bcba
@@ -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;