[573563] [UI] Provide CDOCommitCommentPrompter

https://bugs.eclipse.org/bugs/show_bug.cgi?id=573563
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/CDORepositoryImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/CDORepositoryImpl.java
index 00a9dab..f101705 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/CDORepositoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/CDORepositoryImpl.java
@@ -50,6 +50,7 @@
 import org.eclipse.net4j.util.lifecycle.ILifecycle;
 import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter;
 import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.registry.IRegistry;
 import org.eclipse.net4j.util.security.CredentialsProviderFactory;
 import org.eclipse.net4j.util.security.CredentialsUpdateOperation;
 import org.eclipse.net4j.util.security.ICredentialsProvider;
@@ -93,6 +94,8 @@
 
   private static final boolean SET_USER_NAME = OMPlatform.INSTANCE.isProperty("cdo.explorer.setUserName");
 
+  private static final String VIEW_CONFIGURATOR_TYPE = OMPlatform.INSTANCE.getProperty("cdo.explorer.viewConfiguratorType", "checkout");
+
   private final Set<CDOCheckout> checkouts = new HashSet<>();
 
   private final Set<CDOCheckout> openCheckouts = new HashSet<>();
@@ -313,7 +316,11 @@
           state = State.Connecting;
 
           session = openSession();
-          session.properties().put(REPOSITORY_KEY, this);
+
+          IRegistry<String, Object> properties = session.properties();
+          properties.put(REPOSITORY_KEY, this);
+          properties.put(CDOUtil.PROP_VIEW_CONFIGURATOR_TYPE, VIEW_CONFIGURATOR_TYPE);
+
           session.addListener(new LifecycleEventAdapter()
           {
             @Override
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
index b18ed7b..3c314ec 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
@@ -50,6 +50,7 @@
 import org.eclipse.emf.cdo.view.CDORevisionPrefetchingPolicy;
 import org.eclipse.emf.cdo.view.CDOStaleObject;
 import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.emf.cdo.view.CDOViewConfigurator;
 import org.eclipse.emf.cdo.view.CDOViewContainer;
 import org.eclipse.emf.cdo.view.CDOViewProviderRegistry;
 import org.eclipse.emf.cdo.view.CDOViewSet;
@@ -72,10 +73,13 @@
 
 import org.eclipse.net4j.util.AdapterUtil;
 import org.eclipse.net4j.util.concurrent.DelegableReentrantLock;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
 import org.eclipse.net4j.util.container.IPluginContainer;
 import org.eclipse.net4j.util.io.EmptyInputStream;
 import org.eclipse.net4j.util.io.ReaderInputStream;
 import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.properties.PropertiesContainerUtil;
 import org.eclipse.net4j.util.security.CredentialsProviderFactory;
 import org.eclipse.net4j.util.security.IPasswordCredentialsProvider;
 
@@ -116,6 +120,21 @@
 public final class CDOUtil
 {
   /**
+   * @since 4.14
+   */
+  public static final String PROP_VIEW_CONFIGURATOR = "org.eclipse.emf.cdo.viewConfigurator";
+
+  /**
+   * @since 4.14
+   */
+  public static final String PROP_VIEW_CONFIGURATOR_TYPE = "org.eclipse.emf.cdo.viewConfiguratorType";
+
+  /**
+   * @since 4.14
+   */
+  public static final String PROP_VIEW_CONFIGURATOR_DESCRIPTION = "org.eclipse.emf.cdo.viewConfiguratorDescription";
+
+  /**
    * @since 4.3
    */
   public static final String CDO_ANNOTATION_URI = "http://www.eclipse.org/CDO";
@@ -276,13 +295,45 @@
    */
   public static void configureView(CDOView view)
   {
-    view.options().setLockNotificationEnabled(true);
-
-    if (view instanceof CDOTransaction)
+    CDOViewConfigurator viewConfigurator = getViewConfigurator(view);
+    if (viewConfigurator == null)
     {
-      CDOTransaction transaction = (CDOTransaction)view;
-      new CDOTransactionCommentator(transaction);
+      viewConfigurator = getViewConfigurator(view.getSession());
     }
+
+    if (viewConfigurator != null)
+    {
+      viewConfigurator.configureView(view);
+    }
+    else
+    {
+      view.options().setLockNotificationEnabled(true);
+
+      if (view instanceof CDOTransaction)
+      {
+        new CDOTransactionCommentator((CDOTransaction)view);
+      }
+    }
+  }
+
+  private static CDOViewConfigurator getViewConfigurator(Object object)
+  {
+    CDOViewConfigurator viewConfigurator = PropertiesContainerUtil.getProperty(object, PROP_VIEW_CONFIGURATOR, CDOViewConfigurator.class);
+    if (viewConfigurator == null)
+    {
+      String type = PropertiesContainerUtil.getProperty(object, PROP_VIEW_CONFIGURATOR_TYPE, String.class);
+      if (type != null)
+      {
+        IManagedContainer container = ContainerUtil.getContainer(object);
+        if (container != null)
+        {
+          String description = PropertiesContainerUtil.getProperty(object, PROP_VIEW_CONFIGURATOR_DESCRIPTION, String.class);
+          viewConfigurator = container.getElementOrNull(CDOViewConfigurator.Factory.PRODUCT_GROUP, type, description);
+        }
+      }
+    }
+
+    return viewConfigurator;
   }
 
   /**
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOViewConfigurator.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOViewConfigurator.java
new file mode 100644
index 0000000..30699f7
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOViewConfigurator.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021 Eike Stepper (Loehne, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.view;
+
+import org.eclipse.net4j.util.factory.ProductCreationException;
+
+/**
+ * @author Eike Stepper
+ * @since 4.14
+ */
+@FunctionalInterface
+public interface CDOViewConfigurator
+{
+  public void configureView(CDOView view);
+
+  /**
+   * @author Eike Stepper
+   */
+  public static abstract class Factory extends org.eclipse.net4j.util.factory.Factory
+  {
+    public static final String PRODUCT_GROUP = "org.eclipse.emf.cdo.viewConfigurators";
+
+    public Factory(String type)
+    {
+      super(PRODUCT_GROUP, type);
+    }
+
+    @Override
+    public abstract CDOViewConfigurator create(String description) throws ProductCreationException;
+  }
+}