Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2016-11-01 07:51:13 +0000
committerEike Stepper2016-11-01 07:51:13 +0000
commit050002b788e2ca3bd4f6fecb1b7659b48046c07a (patch)
treed6f6d6483406c064675628ce084937122cd18292 /plugins/org.eclipse.emf.cdo.explorer
parent723f7ff9da9ab663208b66dfe99c9bf6a25f63ce (diff)
downloadcdo-050002b788e2ca3bd4f6fecb1b7659b48046c07a.tar.gz
cdo-050002b788e2ca3bd4f6fecb1b7659b48046c07a.tar.xz
cdo-050002b788e2ca3bd4f6fecb1b7659b48046c07a.zip
[Releng] Add "cdo.explorer.setUserName" property
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.explorer')
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/CDORepositoryImpl.java18
1 files changed, 17 insertions, 1 deletions
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 267ce499ee..b01723d583 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
@@ -48,12 +48,14 @@ import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
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.security.IPasswordCredentials;
import org.eclipse.net4j.util.security.PasswordCredentials;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.spi.cdo.InternalCDOSession;
import org.eclipse.equinox.security.storage.ISecurePreferences;
import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
@@ -80,6 +82,10 @@ public abstract class CDORepositoryImpl extends AbstractElement implements CDORe
public static final String REPOSITORY_KEY = CDORepository.class.getName();
+ private static final boolean READABLE_IDS = OMPlatform.INSTANCE.isProperty("cdo.explorer.readableIDs");
+
+ private static final boolean SET_USER_NAME = OMPlatform.INSTANCE.isProperty("cdo.explorer.setUserName");
+
private final Set<CDOCheckout> checkouts = new HashSet<CDOCheckout>();
private final Set<CDOCheckout> openCheckouts = new HashSet<CDOCheckout>();
@@ -611,7 +617,7 @@ public abstract class CDORepositoryImpl extends AbstractElement implements CDORe
config.setConnector(connector);
config.setRepositoryName(name);
- if (Boolean.getBoolean("cdo.explorer.readableIDs"))
+ if (READABLE_IDS)
{
config.setIDGenerator(new CDOIDGenerator()
{
@@ -711,6 +717,16 @@ public abstract class CDORepositoryImpl extends AbstractElement implements CDORe
CDOSession session = sessionConfiguration.openSession();
session.options().setGeneratedPackageEmulationEnabled(true);
+
+ if (SET_USER_NAME && StringUtil.isEmpty(session.getUserID()))
+ {
+ String userName = System.getProperty("user.name");
+ if (!StringUtil.isEmpty(userName))
+ {
+ ((InternalCDOSession)session).setUserID(userName);
+ }
+ }
+
return session;
}

Back to the top