综合编程

Can HTML-Style links be added to SWT StyledText?

微信扫一扫,分享到朋友圈

Can HTML-Style links be added to SWT StyledText?
0 0

I know SWT has a Link class to create HTML a href style links as widgets, but I wast trying to find a way to make certain text in a StyledText control appear and function as a link.

I feel like Eclipse does this in their code editor if you hold down control and hover over a method name, but I know the Eclipse java editor is much more complicated than a StyledText control.

Since JFace 3.5, there is a special style for links:

styleRange.underlineStyle = SWT.UNDERLINE_LINK;
styleRange.data = "http://www.google.com/";

This makes it much more simple to identify a link and you can store the URL in the style. As for automatically finding links, just look for the pattern http://[^ ]
(blanks are not allowed in links) in the lines you get and add the style.

Hello, buddy!
感谢您的支持!

    SpringCloud 广告系统实战(五) - 广告检索系统(微服务调用)

    上一篇

    最大化超融合基础设施优势的十大建议

    下一篇

    您也可能喜欢

    评论已经被关闭。

    插入图片

    热门分类