Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.team/src/org/eclipse/emf/cdo/internal/team/RepositoryProject.java188
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.admin/src/org/eclipse/emf/cdo/ui/internal/admin/CDOAdminView.java23
-rw-r--r--plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF4
3 files changed, 114 insertions, 101 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 fd8d66f494..056df491d8 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
@@ -1,93 +1,95 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, 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.internal.team;
-
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.team.IRepositoryProject;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.net4j.util.container.IManagedContainer;
-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;
-
-/**
- * @author Eike Stepper
- */
-public class RepositoryProject extends PlatformObject implements IRepositoryProject, IListener
-{
- private IProject project;
-
- private CDOView view;
-
- public RepositoryProject(IProject project)
- {
- this.project = project;
- }
-
- public IProject getProject()
- {
- return project;
- }
-
- public synchronized CDOView getView()
- {
- if (view == null)
- {
- view = openView();
- view.addListener(this);
- view.getSession().addListener(this);
- }
-
- return view;
- }
-
- public void dispose()
- {
- project = null;
- if (view != null)
- {
- view.removeListener(this);
- view.getSession().removeListener(this);
- view.getSession().close();
- view = null;
- }
- }
-
- public void notifyEvent(IEvent event)
- {
- // if (event instanceof ILifecycleEvent)
- // {
- // ILifecycleEvent e = (ILifecycleEvent)event;
- // if (e.getKind() == ILifecycleEvent.Kind.DEACTIVATED)
- // {
- // view.removeListener(this);
- // view.getSession().removeListener(this);
- // view = null;
- // }
- // }
- }
-
- protected CDOView openView()
- {
- String description = RepositoryTeamProvider.getSessionDescription(project);
- CDOSession session = (CDOSession)getContainer().getElement("org.eclipse.emf.cdo.sessions", "cdo", description); //$NON-NLS-1$ //$NON-NLS-2$
- return session.openView();
- }
-
- protected IManagedContainer getContainer()
- {
- return IPluginContainer.INSTANCE;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, 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.internal.team;
+
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.team.IRepositoryProject;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.internal.cdo.session.CDOSessionFactory;
+
+import org.eclipse.net4j.util.container.IManagedContainer;
+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;
+
+/**
+ * @author Eike Stepper
+ */
+public class RepositoryProject extends PlatformObject implements IRepositoryProject, IListener
+{
+ private IProject project;
+
+ private CDOView view;
+
+ public RepositoryProject(IProject project)
+ {
+ this.project = project;
+ }
+
+ public IProject getProject()
+ {
+ return project;
+ }
+
+ public synchronized CDOView getView()
+ {
+ if (view == null)
+ {
+ view = openView();
+ view.addListener(this);
+ view.getSession().addListener(this);
+ }
+
+ return view;
+ }
+
+ public void dispose()
+ {
+ project = null;
+ if (view != null)
+ {
+ view.removeListener(this);
+ view.getSession().removeListener(this);
+ view.getSession().close();
+ view = null;
+ }
+ }
+
+ public void notifyEvent(IEvent event)
+ {
+ // if (event instanceof ILifecycleEvent)
+ // {
+ // ILifecycleEvent e = (ILifecycleEvent)event;
+ // if (e.getKind() == ILifecycleEvent.Kind.DEACTIVATED)
+ // {
+ // view.removeListener(this);
+ // view.getSession().removeListener(this);
+ // view = null;
+ // }
+ // }
+ }
+
+ protected CDOView openView()
+ {
+ String description = RepositoryTeamProvider.getSessionDescription(project);
+ CDOSession session = (CDOSession)getContainer().getElement(CDOSessionFactory.PRODUCT_GROUP, "cdo", description); //$NON-NLS-1$
+ return session.openView();
+ }
+
+ protected IManagedContainer getContainer()
+ {
+ return IPluginContainer.INSTANCE;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui.admin/src/org/eclipse/emf/cdo/ui/internal/admin/CDOAdminView.java b/plugins/org.eclipse.emf.cdo.ui.admin/src/org/eclipse/emf/cdo/ui/internal/admin/CDOAdminView.java
index 7172356690..411e8f054e 100644
--- a/plugins/org.eclipse.emf.cdo.ui.admin/src/org/eclipse/emf/cdo/ui/internal/admin/CDOAdminView.java
+++ b/plugins/org.eclipse.emf.cdo.ui.admin/src/org/eclipse/emf/cdo/ui/internal/admin/CDOAdminView.java
@@ -18,7 +18,10 @@ import org.eclipse.emf.cdo.net4j.CDONet4jSession;
import org.eclipse.emf.cdo.ui.internal.admin.bundle.OM;
import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+import org.eclipse.emf.internal.cdo.session.CDOSessionFactory;
+
import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.net4j.util.ui.actions.LongRunningAction;
import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
import org.eclipse.net4j.util.ui.views.ContainerView;
@@ -51,6 +54,8 @@ public class CDOAdminView extends ContainerView
private IAction addConnectionAction;
+ private int lastSessionNumber;
+
public CDOAdminView()
{
}
@@ -61,6 +66,11 @@ public class CDOAdminView extends ContainerView
return adminManager;
}
+ protected int getNextSessionNumber()
+ {
+ return ++lastSessionNumber;
+ }
+
@Override
protected ContainerItemProvider<IContainer<Object>> createContainerItemProvider()
{
@@ -151,7 +161,7 @@ public class CDOAdminView extends ContainerView
else if (obj instanceof CDOAdminClientRepository)
{
CDOAdminClientRepository repository = (CDOAdminClientRepository)obj;
- manager.add(new OpenSessionAction(adminManager, repository));
+ manager.add(new OpenSessionAction(repository));
}
}
}
@@ -221,17 +231,14 @@ public class CDOAdminView extends ContainerView
/**
* @author Eike Stepper
*/
- public static class OpenSessionAction extends LongRunningAction
+ public class OpenSessionAction extends LongRunningAction
{
- private CDOAdminClientManager adminManager;
-
private CDOAdminClientRepository repository;
- public OpenSessionAction(CDOAdminClientManager adminManager, CDOAdminClientRepository repository)
+ public OpenSessionAction(CDOAdminClientRepository repository)
{
super("Open Session", "Open a new session to this repository", SharedIcons
.getDescriptor(SharedIcons.ETOOL_OPEN_SESSION));
- this.adminManager = adminManager;
this.repository = repository;
}
@@ -246,7 +253,9 @@ public class CDOAdminView extends ContainerView
CDONet4jSession session = repository.openSession();
if (session != null)
{
- adminManager.getContainer().putElement(NSFieldE)
+ IManagedContainer container = adminManager.getContainer();
+ String description = "session" + getNextSessionNumber();
+ container.putElement(CDOSessionFactory.PRODUCT_GROUP, "admin", description, session);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF
index cc31364d42..77cf7ea5ee 100644
--- a/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF
@@ -54,7 +54,9 @@ Export-Package: org.eclipse.emf.cdo;version="4.1.0",
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.defs,
- org.eclipse.emf.cdo.ui",
+ org.eclipse.emf.cdo.ui,
+ org.eclipse.emf.cdo.team,
+ org.eclipse.emf.cdo.ui.admin",
org.eclipse.emf.internal.cdo.session.remote;version="4.1.0";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,

Back to the top