import org.eclipse.swt.widgets.Control;
/** Stateless factory building an SWT user interface given a JCR context. */
-@FunctionalInterface
public interface CmsUiProvider extends SwtUiProvider {
/**
* Initialises a user interface.
* @param parent the parent composite
* @param context a context node (holding the JCR underlying session), or null
*/
- Control createUi(Composite parent, Node context) throws RepositoryException;
+ default Control createUi(Composite parent, Node context) throws RepositoryException {
+ // does nothing by default
+ return null;
+ }
default Control createUiPart(Composite parent, Node context) {
try {
@Override
default Control createUiPart(Composite parent, Content context) {
+ if (context == null)
+ return createUiPart(parent, (Node) null);
if (context instanceof JcrContent) {
Node node = ((JcrContent) context).getJcrNode();
return createUiPart(parent, node);
} else {
- throw new IllegalArgumentException("Content " + context + " is not compatible with JCR");
+// CmsLog.getLog(CmsUiProvider.class)
+// .warn("In " + getClass() + ", content " + context + " is not compatible with JCR.");
+// return createUiPart(parent, (Node) null);
+
+ throw new IllegalArgumentException(
+ "In " + getClass() + ", content " + context + " is not compatible with JCR");
}
}