Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-03-11 20:20:13 +0000
committerEike Stepper2015-03-11 20:20:13 +0000
commite5a26c533bb3bcef2a8dced57a10ea61a3ada2f3 (patch)
tree8cb80cdb8274fb8b6f4a1543ed315c5249e8a8b8 /plugins/org.eclipse.emf.cdo.explorer
parenta9907ed2d727f3555b39df98df0c475b5f21403a (diff)
downloadcdo-e5a26c533bb3bcef2a8dced57a10ea61a3ada2f3.tar.gz
cdo-e5a26c533bb3bcef2a8dced57a10ea61a3ada2f3.tar.xz
cdo-e5a26c533bb3bcef2a8dced57a10ea61a3ada2f3.zip
[458349] Consolidate UI
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=458349
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.explorer')
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/repositories/CDORepository.java53
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/CDORepositoryImpl.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/LocalCDORepository.java81
5 files changed, 100 insertions, 80 deletions
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/repositories/CDORepository.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/repositories/CDORepository.java
index d237b1d525..7d8b9bcf93 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/repositories/CDORepository.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/repositories/CDORepository.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.explorer.repositories;
+import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.explorer.CDOExplorerElement;
import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
@@ -49,6 +50,10 @@ public interface CDORepository extends CDOExplorerElement, IContainer<CDOBranch>
public String getURI();
+ public VersioningMode getVersioningMode();
+
+ public IDGeneration getIDGeneration();
+
public State getState();
public boolean isConnected();
@@ -68,6 +73,54 @@ public interface CDORepository extends CDOExplorerElement, IContainer<CDOBranch>
/**
* @author Eike Stepper
*/
+ public enum VersioningMode
+ {
+ Normal(false, false), Auditing(true, false), Branching(true, true);
+
+ private boolean supportingAudits;
+
+ private boolean supportingBranches;
+
+ private VersioningMode(boolean supportingAudits, boolean supportingBranches)
+ {
+ this.supportingAudits = supportingAudits;
+ this.supportingBranches = supportingBranches;
+ }
+
+ public boolean isSupportingAudits()
+ {
+ return supportingAudits;
+ }
+
+ public boolean isSupportingBranches()
+ {
+ return supportingBranches;
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public enum IDGeneration
+ {
+ Counter(IDGenerationLocation.STORE), UUID(IDGenerationLocation.CLIENT);
+
+ private IDGenerationLocation location;
+
+ private IDGeneration(IDGenerationLocation location)
+ {
+ this.location = location;
+ }
+
+ public final IDGenerationLocation getLocation()
+ {
+ return location;
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
public enum State
{
Connecting, Connected, Disconnecting, Disconnected
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java
index 318545ccc7..feaaecc14c 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java
@@ -317,9 +317,18 @@ public abstract class CDOCheckoutImpl extends AbstractElement implements CDOChec
return readOnly;
}
- public final void setReadOnly(boolean readOnly)
+ public void setReadOnly(boolean readOnly)
{
- this.readOnly = readOnly;
+ if (state != State.Open)
+ {
+ throw new IllegalStateException("Checkout is not closed: " + this);
+ }
+
+ if (this.readOnly != readOnly)
+ {
+ this.readOnly = readOnly;
+ save();
+ }
}
public final CDOID getRootID()
@@ -717,7 +726,7 @@ public abstract class CDOCheckoutImpl extends AbstractElement implements CDOChec
branchPath = properties.getProperty(PROP_BRANCH_PATH);
branchPoints = properties.getProperty(PROP_BRANCH_POINTS);
timeStamp = Long.parseLong(properties.getProperty(PROP_TIME_STAMP));
- readOnly = Boolean.parseBoolean(properties.getProperty(PROP_READ_ONLY));
+ readOnly = isOnline() ? Boolean.parseBoolean(properties.getProperty(PROP_READ_ONLY)) : false;
rootID = CDOIDUtil.read(properties.getProperty(PROP_ROOT_ID));
((CDORepositoryImpl)repository).addCheckout(this);
@@ -730,7 +739,7 @@ public abstract class CDOCheckoutImpl extends AbstractElement implements CDOChec
properties.setProperty(PROP_REPOSITORY, repository.getID());
properties.setProperty(PROP_BRANCH_ID, Integer.toString(branchID));
properties.setProperty(PROP_TIME_STAMP, Long.toString(timeStamp));
- properties.setProperty(PROP_READ_ONLY, Boolean.toString(readOnly));
+ properties.setProperty(PROP_READ_ONLY, Boolean.toString(isOnline() ? readOnly : false));
if (branchPath != null)
{
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java
index 71c16d7a79..c978daee29 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java
@@ -109,6 +109,12 @@ public class OfflineCDOCheckout extends CDOCheckoutImpl
return false;
}
+ @Override
+ public void setReadOnly(boolean readOnly)
+ {
+ throw new IllegalStateException("Checkout is offline: " + this);
+ }
+
public final InternalCDOWorkspace getWorkspace()
{
return workspace;
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 00513f3001..00c5e1d733 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
@@ -107,6 +107,10 @@ public abstract class CDORepositoryImpl extends AbstractElement implements CDORe
private String name;
+ private CDORepository.VersioningMode versioningMode;
+
+ private CDORepository.IDGeneration idGeneration;
+
private State state = State.Disconnected;
private boolean explicitelyConnected;
@@ -115,6 +119,10 @@ public abstract class CDORepositoryImpl extends AbstractElement implements CDORe
private CDOSession session;
+ public static final String PROP_VERSIONING_MODE = "versioningMode";
+
+ public static final String PROP_ID_GENERATION = "idGeneration";
+
public CDORepositoryImpl()
{
}
@@ -135,6 +143,16 @@ public abstract class CDORepositoryImpl extends AbstractElement implements CDORe
return name;
}
+ public final CDORepository.VersioningMode getVersioningMode()
+ {
+ return versioningMode;
+ }
+
+ public final CDORepository.IDGeneration getIDGeneration()
+ {
+ return idGeneration;
+ }
+
public final State getState()
{
return state;
@@ -463,6 +481,9 @@ public abstract class CDORepositoryImpl extends AbstractElement implements CDORe
{
super.init(folder, type, properties);
name = properties.getProperty(PROP_NAME);
+ versioningMode = CDORepository.VersioningMode.valueOf(properties
+ .getProperty(CDORepositoryImpl.PROP_VERSIONING_MODE));
+ idGeneration = CDORepository.IDGeneration.valueOf(properties.getProperty(CDORepositoryImpl.PROP_ID_GENERATION));
}
@Override
@@ -470,6 +491,8 @@ public abstract class CDORepositoryImpl extends AbstractElement implements CDORe
{
super.collectProperties(properties);
properties.setProperty(PROP_NAME, name);
+ properties.setProperty(CDORepositoryImpl.PROP_VERSIONING_MODE, versioningMode.toString());
+ properties.setProperty(CDORepositoryImpl.PROP_ID_GENERATION, idGeneration.toString());
}
protected IConnector getConnector()
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/LocalCDORepository.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/LocalCDORepository.java
index 5a48ac4c7d..22b346c717 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/LocalCDORepository.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/LocalCDORepository.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.internal.explorer.repositories;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.server.CDOServerUtil;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.db.CDODBUtil;
@@ -38,18 +37,10 @@ import java.util.Properties;
*/
public class LocalCDORepository extends CDORepositoryImpl
{
- public static final String PROP_VERSIONING_MODE = "versioningMode";
-
- public static final String PROP_ID_GENERATION = "idGeneration";
-
public static final String PROP_TCP_DISABLED = "tcpDisabled";
public static final String PROP_TCP_PORT = "tcpPort";
- private VersioningMode versioningMode;
-
- private IDGeneration idGeneration;
-
private boolean tcpDisabled;
private int tcpPort;
@@ -97,16 +88,6 @@ public class LocalCDORepository extends CDORepositoryImpl
return "tcp://localhost:" + tcpPort + "/" + getName();
}
- public final VersioningMode getVersioningMode()
- {
- return versioningMode;
- }
-
- public final IDGeneration getIDGeneration()
- {
- return idGeneration;
- }
-
public final boolean isTCPDisabled()
{
return tcpDisabled;
@@ -121,8 +102,6 @@ public class LocalCDORepository extends CDORepositoryImpl
protected void init(File folder, String type, Properties properties)
{
super.init(folder, type, properties);
- versioningMode = VersioningMode.valueOf(properties.getProperty(PROP_VERSIONING_MODE));
- idGeneration = IDGeneration.valueOf(properties.getProperty(PROP_ID_GENERATION));
tcpDisabled = Boolean.parseBoolean(properties.getProperty(PROP_TCP_DISABLED));
if (!tcpDisabled)
{
@@ -134,8 +113,6 @@ public class LocalCDORepository extends CDORepositoryImpl
protected void collectProperties(Properties properties)
{
super.collectProperties(properties);
- properties.setProperty(PROP_VERSIONING_MODE, versioningMode.toString());
- properties.setProperty(PROP_ID_GENERATION, idGeneration.toString());
properties.setProperty(PROP_TCP_DISABLED, Boolean.toString(tcpDisabled));
properties.setProperty(PROP_TCP_PORT, Integer.toString(tcpPort));
}
@@ -149,8 +126,8 @@ public class LocalCDORepository extends CDORepositoryImpl
JdbcDataSource dataSource = new JdbcDataSource();
dataSource.setURL("jdbc:h2:" + folder);
- IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(versioningMode.isSupportingAudits(),
- versioningMode.isSupportingBranches(), false);
+ IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(getVersioningMode()
+ .isSupportingAudits(), getVersioningMode().isSupportingBranches(), false);
mappingStrategy.setProperties(getMappingStrategyProperties());
IDBAdapter dbAdapter = DBUtil.getDBAdapter("h2");
@@ -175,9 +152,9 @@ public class LocalCDORepository extends CDORepositoryImpl
{
Map<String, String> props = new HashMap<String, String>();
props.put(IRepository.Props.OVERRIDE_UUID, "");
- props.put(IRepository.Props.SUPPORTING_AUDITS, Boolean.toString(versioningMode.isSupportingAudits()));
- props.put(IRepository.Props.SUPPORTING_BRANCHES, Boolean.toString(versioningMode.isSupportingBranches()));
- props.put(IRepository.Props.ID_GENERATION_LOCATION, idGeneration.getLocation().toString());
+ props.put(IRepository.Props.SUPPORTING_AUDITS, Boolean.toString(getVersioningMode().isSupportingAudits()));
+ props.put(IRepository.Props.SUPPORTING_BRANCHES, Boolean.toString(getVersioningMode().isSupportingBranches()));
+ props.put(IRepository.Props.ID_GENERATION_LOCATION, getIDGeneration().getLocation().toString());
return props;
}
@@ -200,52 +177,4 @@ public class LocalCDORepository extends CDORepositoryImpl
LifecycleUtil.deactivate(repository);
repository = null;
}
-
- /**
- * @author Eike Stepper
- */
- public enum VersioningMode
- {
- Normal(false, false), Auditing(true, false), Branching(true, true);
-
- private boolean supportingAudits;
-
- private boolean supportingBranches;
-
- private VersioningMode(boolean supportingAudits, boolean supportingBranches)
- {
- this.supportingAudits = supportingAudits;
- this.supportingBranches = supportingBranches;
- }
-
- public boolean isSupportingAudits()
- {
- return supportingAudits;
- }
-
- public boolean isSupportingBranches()
- {
- return supportingBranches;
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public enum IDGeneration
- {
- Counter(IDGenerationLocation.STORE), UUID(IDGenerationLocation.CLIENT);
-
- private IDGenerationLocation location;
-
- private IDGeneration(IDGenerationLocation location)
- {
- this.location = location;
- }
-
- public final IDGenerationLocation getLocation()
- {
- return location;
- }
- }
}

Back to the top