External link in new window.
[gpl/argeo-suite.git] / core / org.argeo.suite.ui / src / org / argeo / suite / ui / SuiteUiUtils.java
index 884981081f07fe0f6f6e3bf2c42ec0f3015642e0..048b94657459e58f378d5f99d597c95b8d5b6a97 100644 (file)
@@ -350,6 +350,23 @@ public class SuiteUiUtils {
                return link.createUi(parent, node);
        }
 
+       public static Control addExternalLink(Composite parent, String label, String url, String plainCssAnchorClass,
+                       boolean newWindow) throws RepositoryException {
+               Label lbl = new Label(parent, SWT.NONE);
+               CmsUiUtils.markup(lbl);
+               StringBuilder txt = new StringBuilder();
+               txt.append("<a class='" + plainCssAnchorClass + "'");
+               txt.append(" href='").append(url).append("'");
+               if (newWindow) {
+                       txt.append(" target='blank_'");
+               }
+               txt.append(">");
+               txt.append(label);
+               txt.append("</a>");
+               lbl.setText(txt.toString());
+               return lbl;
+       }
+
        public static boolean isCoworker(CmsView cmsView) {
                boolean coworker = cmsView.doAs(() -> CurrentUser.isInRole(SuiteRole.coworker.dn()));
                return coworker;