+ public static String toLink(Node node) {
+ try {
+ return node != null ? "#" + CmsUiUtils.cleanPathForUrl(SuiteApp.nodeToState(node)) : null;
+ } catch (RepositoryException e) {
+ throw new JcrException("Cannot get link from " + node, e);
+ }
+ }
+
+ public static Control addLink(Composite parent, String label, Node node, CmsStyle style)
+ throws RepositoryException {
+ String target = toLink(node);
+ CmsLink link = new CmsLink(label, target, style);
+ 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;
+ }
+
+ public static boolean isTopic(Event event, CmsEvent cmsEvent) {
+ return event.getTopic().equals(cmsEvent.topic());
+ }
+
+ public static Button createLayerButton(Composite parent, String layer, Localized msg, CmsIcon icon,
+ ClassLoader l10nClassLoader) {