diff --git a/de.fu_berlin.inf.dpp/plugin.xml b/de.fu_berlin.inf.dpp/plugin.xml index f878eff2df34070325f4eeba222a48572e165556..d27e0d6578f9a664738dde19719f479adab459d3 100644 --- a/de.fu_berlin.inf.dpp/plugin.xml +++ b/de.fu_berlin.inf.dpp/plugin.xml @@ -188,6 +188,13 @@ label="Share project partially (experimental)..." menubarPath="sarosSubMenu/group1"> </action> + <action + class="de.fu_berlin.inf.dpp.ui.actions.NewSessionActionWithVCS" + icon="icons/transmit.png" + id="Saros.action2" + label="Share project with VCS support..." + menubarPath="sarosSubMenu/group1"> + </action> <action class="de.fu_berlin.inf.dpp.ui.actions.NewSessionAction" icon="icons/transmit.png" diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ISarosSession.java b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ISarosSession.java index 377a961a5bc0e86ee475f31159cd3851a3fabb48..02ad46c58307f203a6a0f688cc6094104d7c8dc9 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ISarosSession.java +++ b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ISarosSession.java @@ -347,9 +347,9 @@ public interface ISarosSession extends IActivityListener { public boolean isShared(IProject project); /** - * Returns true if VCS support is enabled for this session. Clients are - * required to have all the necessary plugins (e.g. Subclipse if it's an SVN - * project), otherwise they won't be able to participate in the session. + * Returns true if this session uses VCS support. Clients are required to + * have all the necessary plugins (e.g. Subclipse if it's an SVN project), + * otherwise they won't be able to participate in the session. * * @return true iff this session uses Version Control. */ diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ISarosSessionManager.java b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ISarosSessionManager.java index 6c600ff22f59671926d276046e01554a1d02fe72..a5d5e5b757e2524d3cabb980c8d877d4d1b3f695 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ISarosSessionManager.java +++ b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/ISarosSessionManager.java @@ -39,10 +39,14 @@ public interface ISarosSessionManager { * * @param project * the local Eclipse project which should become shared. + * @param useVersionControl + * true iff this session uses Version Control, see + * {@link ISarosSession#useVersionControl()}. * @throws XMPPException * if this method is called with no established XMPP-connection. */ - public void startSession(IProject project, List<IResource> resources) throws XMPPException; + public void startSession(IProject project, List<IResource> resources, + boolean useVersionControl) throws XMPPException; /** * Creates a Saros session for a shared project hosted remotely. The diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/SarosSessionManager.java b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/SarosSessionManager.java index 16d8bf7e32f8b0907cfb9aedfc2f91ea30f75d48..9ce7f78d9fa210dbb9df76fac5fd26c3c9c2df9d 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/SarosSessionManager.java +++ b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/SarosSessionManager.java @@ -152,7 +152,7 @@ public class SarosSessionManager implements IConnectionListener, protected static final Random sessionRandom = new Random(); public void startSession(IProject project, - List<IResource> partialProjectResources) + List<IResource> partialProjectResources, boolean useVersionControl) throws XMPPException { if (!saros.isConnected()) { throw new XMPPException("No connection"); @@ -169,7 +169,7 @@ public class SarosSessionManager implements IConnectionListener, SarosSession sarosSession = new SarosSession(saros, this.transmitter, this.transferManager, dispatchThreadContext, myJID, stopManager, - new DateTime()); + new DateTime(), useVersionControl); // TODO Add project after starting the session. sarosSession.addSharedProject(project, project.getName()); diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/internal/SarosSession.java b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/internal/SarosSession.java index 3bfe180f4d634e01e5305a549dfa4a0a8d156f56..159fe587e50173c4afcb7c892050eb2031e7bd9b 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/internal/SarosSession.java +++ b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/project/internal/SarosSession.java @@ -104,7 +104,7 @@ public class SarosSession implements ISarosSession, Disposable { protected SarosProjectMapper projectMapper = new SarosProjectMapper(); - protected final boolean useVersionControl = true; + protected final boolean useVersionControl; private BlockingQueue<IActivity> pendingActivities = new LinkedBlockingQueue<IActivity>(); @@ -184,7 +184,8 @@ public class SarosSession implements ISarosSession, Disposable { protected SarosSession(Saros saros, ITransmitter transmitter, DataTransferManager transferManager, DispatchThreadContext threadContext, StopManager stopManager, - JID myJID, int myColorID, DateTime sessionStart) { + JID myJID, int myColorID, DateTime sessionStart, + boolean useVersionControl) { assert transmitter != null; assert myJID != null; @@ -198,6 +199,7 @@ public class SarosSession implements ISarosSession, Disposable { this.localUser = new User(this, myJID, myColorID); this.activitySequencer = new ActivitySequencer(this, transmitter, transferManager, threadContext); + this.useVersionControl = useVersionControl; stopManager.addBlockable(stopManagerListener); activityDispatcher.setDaemon(true); @@ -210,10 +212,10 @@ public class SarosSession implements ISarosSession, Disposable { public SarosSession(Saros saros, ITransmitter transmitter, DataTransferManager transferManager, DispatchThreadContext threadContext, JID myID, StopManager stopManager, - DateTime sessionStart) { + DateTime sessionStart, boolean useVersionControl) { this(saros, transmitter, transferManager, threadContext, stopManager, - myID, 0, sessionStart); + myID, 0, sessionStart, useVersionControl); freeColors = new FreeColors(MAX_USERCOLORS - 1); localUser.setUserRole(UserRole.DRIVER); @@ -236,7 +238,7 @@ public class SarosSession implements ISarosSession, Disposable { int myColorID, StopManager stopManager, DateTime sessionStart) { this(saros, transmitter, transferManager, threadContext, stopManager, - myID, myColorID, sessionStart); + myID, myColorID, sessionStart, true); host = new User(this, hostID, 0); host.invitationCompleted(); diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/GeneralNewSessionAction.java b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/GeneralNewSessionAction.java index 49bdd34e013ec2a0fccf2ce8eb2ac4cbeaad922b..00a9f8b5836254dcfed4b3944e87c38dc94203b3 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/GeneralNewSessionAction.java +++ b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/GeneralNewSessionAction.java @@ -39,6 +39,7 @@ import de.fu_berlin.inf.dpp.Saros; import de.fu_berlin.inf.dpp.annotations.Component; import de.fu_berlin.inf.dpp.editor.internal.EditorAPI; import de.fu_berlin.inf.dpp.preferences.PreferenceUtils; +import de.fu_berlin.inf.dpp.project.ISarosSession; import de.fu_berlin.inf.dpp.project.SarosSessionManager; import de.fu_berlin.inf.dpp.util.Util; @@ -68,8 +69,12 @@ public abstract class GeneralNewSessionAction implements IObjectActionDelegate { } /** + * @param useVersionControl + * true iff this session uses Version Control, see + * {@link ISarosSession#useVersionControl()}. */ - public void runNewSession(List<IResource> resource) { + public void runNewSession(List<IResource> resource, + boolean useVersionControl) { try { boolean running = sessionManager.getSarosSession() != null; boolean connected = saros.isConnected(); @@ -80,7 +85,8 @@ public abstract class GeneralNewSessionAction implements IObjectActionDelegate { if (running) { sessionManager.openInviteDialog(null); } else { - sessionManager.startSession(this.selectedProject, resource); + sessionManager.startSession(this.selectedProject, resource, + useVersionControl); sessionManager.openInviteDialog(preferenceUtils .getAutoInviteUsers()); } @@ -99,7 +105,6 @@ public abstract class GeneralNewSessionAction implements IObjectActionDelegate { public void selectionChanged(IAction action, ISelection selection) { this.selectedProject = getProject(selection); - action.setEnabled(true); } public void setActivePart(IAction action, IWorkbenchPart targetPart) { diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/InviteAction.java b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/InviteAction.java index 20e24c1b717e5e38a753d6b461f0c75877d2b40c..ee89a110e08c40e8a0ddab3482284967b8999492 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/InviteAction.java +++ b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/InviteAction.java @@ -119,7 +119,7 @@ public class InviteAction extends SelectionProviderAction { // Start new Saros session, invite selected user try { - sessionManager.startSession(chosenProject, null); + sessionManager.startSession(chosenProject, null, false); sessionManager.invite(getSelected(), makeDescription()); } catch (final XMPPException e) { Util.runSafeSWTSync(log, new Runnable() { diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/NewSessionAction.java b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/NewSessionAction.java index b98bdaed8eaea7f4019a596e43b96aa44946c81e..6ea5e1f8de0ad19f228e45cf64a5e51661a02823 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/NewSessionAction.java +++ b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/NewSessionAction.java @@ -45,7 +45,7 @@ public class NewSessionAction extends GeneralNewSessionAction { public void run(IAction action) { Util.runSafeSync(log, new Runnable() { public void run() { - runNewSession(null); + runNewSession(null, false); } }); } diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/NewSessionActionWithVCS.java b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/NewSessionActionWithVCS.java new file mode 100644 index 0000000000000000000000000000000000000000..c3f6f0eb92da5b9a92666adf9214b794c103dc9b --- /dev/null +++ b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/NewSessionActionWithVCS.java @@ -0,0 +1,51 @@ +/* + * DPP - Serious Distributed Pair Programming + * (c) Freie Universitaet Berlin - Fachbereich Mathematik und Informatik - 2006 + * (c) Riad Djemili - 2006 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 1, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +package de.fu_berlin.inf.dpp.ui.actions; + +import org.apache.log4j.Logger; +import org.eclipse.jface.action.IAction; + +import de.fu_berlin.inf.dpp.annotations.Component; +import de.fu_berlin.inf.dpp.util.Util; + +/** + * Start to share a project (a "session"). + * + * This action is created by Eclipse! + * + * @author rdjemili + */ +@Component(module = "action") +public class NewSessionActionWithVCS extends GeneralNewSessionAction { + + private static final Logger log = Logger.getLogger(NewSessionActionWithVCS.class + .getName()); + + /** + * @review runSafe OK + */ + public void run(IAction action) { + Util.runSafeSync(log, new Runnable() { + public void run() { + runNewSession(null, true); + } + }); + } +} diff --git a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/PartialNewSessionAction.java b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/PartialNewSessionAction.java index a27b9313fdbabe18858ce166f04dc8591c4186b5..29992ceaf46d61a7920c32bf7b992242ccd073ca 100644 --- a/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/PartialNewSessionAction.java +++ b/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/ui/actions/PartialNewSessionAction.java @@ -50,7 +50,7 @@ public class PartialNewSessionAction extends GeneralNewSessionAction { if (dialog.open() == Window.OK) { Util.runSafeSync(log, new Runnable() { public void run() { - runNewSession(dialog.getSelectedResources()); + runNewSession(dialog.getSelectedResources(), false); } }); }