diff options
author | Eike Stepper | 2009-01-12 18:13:41 +0000 |
---|---|---|
committer | Eike Stepper | 2009-01-12 18:13:41 +0000 |
commit | 264dbfbd5f7a0ee20ff95a0fb7268314e60a05ad (patch) | |
tree | 90047a254aff5b28fee537adae4e64e093f6a5e1 /plugins/org.eclipse.emf.cdo.team | |
parent | 2e75a92216de7bdc8d86c38160fea0b321ee06fe (diff) | |
download | cdo-264dbfbd5f7a0ee20ff95a0fb7268314e60a05ad.tar.gz cdo-264dbfbd5f7a0ee20ff95a0fb7268314e60a05ad.tar.xz cdo-264dbfbd5f7a0ee20ff95a0fb7268314e60a05ad.zip |
factor out SessionComposite
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.team')
2 files changed, 13 insertions, 61 deletions
diff --git a/plugins/org.eclipse.emf.cdo.team/src/org/eclipse/emf/cdo/internal/team/RepositoryProject.java b/plugins/org.eclipse.emf.cdo.team/src/org/eclipse/emf/cdo/internal/team/RepositoryProject.java index 0a0f110c37..e2e7579f6c 100644 --- a/plugins/org.eclipse.emf.cdo.team/src/org/eclipse/emf/cdo/internal/team/RepositoryProject.java +++ b/plugins/org.eclipse.emf.cdo.team/src/org/eclipse/emf/cdo/internal/team/RepositoryProject.java @@ -11,19 +11,15 @@ package org.eclipse.emf.cdo.internal.team; import org.eclipse.emf.cdo.session.CDOSession; -import org.eclipse.emf.cdo.session.CDOSessionConfiguration; import org.eclipse.emf.cdo.team.IRepositoryProject; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.cdo.view.CDOView; -import org.eclipse.net4j.connector.IConnector; import org.eclipse.net4j.util.container.IPluginContainer; import org.eclipse.net4j.util.event.IEvent; import org.eclipse.net4j.util.event.IListener; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.spi.net4j.ConnectorFactory; /** * @author Eike Stepper @@ -84,29 +80,11 @@ public class RepositoryProject extends PlatformObject implements IRepositoryProj protected CDOView openView() { - String connectorDescription = RepositoryTeamProvider.getConnectorDescription(project); - String repositoryName = RepositoryTeamProvider.getRepositoryName(project); - - IConnector connector = getConnector(connectorDescription); - if (connector == null) - { - throw new IllegalStateException("No connector for " + connectorDescription); - } - - CDOSessionConfiguration configuration = CDOUtil.createSessionConfiguration(); - configuration.setConnector(connector); - configuration.setRepositoryName(repositoryName); - configuration.setLazyPackageRegistry(); - - CDOSession session = configuration.openSession(); + String description = RepositoryTeamProvider.getSessionDescription(project); + CDOSession session = (CDOSession)getContainer().getElement("org.eclipse.emf.cdo.sessions", "cdo", description); return session.openView(); } - protected IConnector getConnector(String connectorDescription) - { - return (IConnector)getContainer().getElement(ConnectorFactory.PRODUCT_GROUP, "tcp", connectorDescription); - } - protected IPluginContainer getContainer() { return IPluginContainer.INSTANCE; diff --git a/plugins/org.eclipse.emf.cdo.team/src/org/eclipse/emf/cdo/internal/team/RepositoryTeamProvider.java b/plugins/org.eclipse.emf.cdo.team/src/org/eclipse/emf/cdo/internal/team/RepositoryTeamProvider.java index 2eda204411..ecf3bdfb4e 100644 --- a/plugins/org.eclipse.emf.cdo.team/src/org/eclipse/emf/cdo/internal/team/RepositoryTeamProvider.java +++ b/plugins/org.eclipse.emf.cdo.team/src/org/eclipse/emf/cdo/internal/team/RepositoryTeamProvider.java @@ -28,9 +28,7 @@ public class RepositoryTeamProvider extends RepositoryProvider { public static final String PROVIDER_ID = "org.eclipse.emf.cdo.team.TeamProvider"; - private static final QualifiedName CONNECTOR_DESCRIPTION_KEY = new QualifiedName(OM.BUNDLE_ID, "connectorDescription"); - - private static final QualifiedName REPOSITORY_NAME_KEY = new QualifiedName(OM.BUNDLE_ID, "repositoryName"); + private static final QualifiedName SESSION_DESCRIPTION_KEY = new QualifiedName(OM.BUNDLE_ID, "sessionDescription"); private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, RepositoryTeamProvider.class); @@ -61,35 +59,11 @@ public class RepositoryTeamProvider extends RepositoryProvider } } - public static String getConnectorDescription(IProject project) - { - try - { - return project.getPersistentProperty(CONNECTOR_DESCRIPTION_KEY); - } - catch (Exception ex) - { - throw WrappedException.wrap(ex); - } - } - - public static void setConnectorDescription(IProject project, String value) - { - try - { - project.setPersistentProperty(CONNECTOR_DESCRIPTION_KEY, value); - } - catch (Exception ex) - { - throw WrappedException.wrap(ex); - } - } - - public static String getRepositoryName(IProject project) + public static String getSessionDescription(IProject project) { try { - return project.getPersistentProperty(REPOSITORY_NAME_KEY); + return project.getPersistentProperty(SESSION_DESCRIPTION_KEY); } catch (Exception ex) { @@ -97,11 +71,11 @@ public class RepositoryTeamProvider extends RepositoryProvider } } - public static void setRepositoryName(IProject project, String value) + public static void setSessionDescription(IProject project, String value) { try { - project.setPersistentProperty(REPOSITORY_NAME_KEY, value); + project.setPersistentProperty(SESSION_DESCRIPTION_KEY, value); } catch (Exception ex) { @@ -114,15 +88,15 @@ public class RepositoryTeamProvider extends RepositoryProvider return RepositoryProvider.getProvider(project, PROVIDER_ID) != null; } - public static void map(IProject project) throws TeamException + public static void mapProject(IProject project, String sessionDescription) throws TeamException { - RepositoryProvider.map(project, PROVIDER_ID); + map(project, PROVIDER_ID); + setSessionDescription(project, sessionDescription); } - public static void unmap(IProject project) throws TeamException + public static void unmapProject(IProject project) throws TeamException { - RepositoryProvider.unmap(project); - setConnectorDescription(project, null); - setRepositoryName(project, null); + unmap(project); + setSessionDescription(project, null); } } |