Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-07-16 20:03:44 +0000
committerMichael Valenta2002-07-16 20:03:44 +0000
commit14c41ea875818c8ce5dc931e66eef89b66881717 (patch)
treeb5ae3bf1d9d3182733412e99ec24050164c450f1
parent65de9f3856631576b6cd9e1719dcb50c999ff303 (diff)
downloadeclipse.platform.team-14c41ea875818c8ce5dc931e66eef89b66881717.tar.gz
eclipse.platform.team-14c41ea875818c8ce5dc931e66eef89b66881717.tar.xz
eclipse.platform.team-14c41ea875818c8ce5dc931e66eef89b66881717.zip
Ongoing work on watch/edit support
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java9
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java95
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFile.java88
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java9
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java12
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractNotificationCommand.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java13
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java1
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/NOOPCommand.java (renamed from bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Edit.java)43
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/NOOPVisitor.java (renamed from bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/EditNotificationVisitor.java)15
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/NotifiedHandler.java45
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java89
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java27
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java33
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java43
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java26
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/NotifyInfo.java27
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PopulateNotifyFileVisitor.java83
21 files changed, 499 insertions, 170 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
index c9ffaa3b9..c705082ba 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
@@ -82,6 +82,7 @@ public class CVSProviderPlugin extends Plugin {
private String cvsRshCommand = DEFAULT_CVS_RSH;
private String cvsServer = DEFAULT_CVS_SERVER;
private IConsoleListener consoleListener;
+ private boolean watchEditEnabled = true;
private static CVSProviderPlugin instance;
@@ -392,6 +393,14 @@ public class CVSProviderPlugin extends Plugin {
promptOnFolderDelete = prompt;
}
+ public boolean isWatchEditEnabled() {
+ return watchEditEnabled;
+ }
+
+ public void setWatchEditEnabled(boolean enabled) {
+ watchEditEnabled = enabled;
+ }
+
private static List listeners = new ArrayList();
/*
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
index 7a1607b25..7532bdbe7 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
@@ -30,6 +30,7 @@ import java.util.TreeSet;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFileModificationValidator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceVisitor;
@@ -100,6 +101,8 @@ import org.eclipse.team.internal.core.streams.LFtoCRLFInputStream;
public class CVSTeamProvider extends RepositoryProvider {
private static final boolean IS_CRLF_PLATFORM = Arrays.equals(
System.getProperty("line.separator").getBytes(), new byte[] { '\r', '\n' }); //$NON-NLS-1$
+
+ public static final IStatus OK = new Status(IStatus.OK, CVSProviderPlugin.ID, 0, Policy.bind("ok"), null);
private CVSWorkspaceRoot workspaceRoot;
private IProject project;
@@ -333,12 +336,39 @@ public class CVSTeamProvider extends RepositoryProvider {
/**
* Checkout the provided resources so they can be modified locally and committed.
- *
- * Currently, we support only the optimistic model so checkout does nothing.
- *
- * @see ITeamProvider#checkout(IResource[], int, IProgressMonitor)
*/
- public void checkout(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException {
+ public void checkout(IResource[] resources, boolean recurse, IProgressMonitor progress) throws TeamException {
+
+ final ICVSResource[] cvsResources = getCVSArguments(resources);
+
+ // mark the files locally as being checked out
+ for (int i = 0; i < cvsResources.length; i++) {
+ ICVSResource resource = cvsResources[i];
+ resource.accept(new ICVSResourceVisitor() {
+ public void visitFile(ICVSFile file) throws CVSException {
+ file.checkout(ICVSFile.NO_NOTIFICATION);
+ }
+ public void visitFolder(ICVSFolder folder) throws CVSException {
+ // nothing needs to be done here as the recurse will handle the traversal
+ }
+ }, recurse);
+ }
+
+ // send the noop command to the server in order to deliver the notifications
+ final boolean[] connected = new boolean[] { false };
+ try {
+ Session.run(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true, new ICVSRunnable() {
+ public void run(IProgressMonitor monitor) throws CVSException {
+ connected[0] = true;
+ Command.NOOP.execute(Command.NO_GLOBAL_OPTIONS, Command.NO_LOCAL_OPTIONS,
+ cvsResources, null, monitor);
+ }
+ }, progress);
+ } catch (CVSException e) {
+ // Only report the exception if we were able to connect.
+ // If we couldn't connect, the notification will be sent the next time we do.
+ if (connected[0]) throw e;
+ }
}
/**
@@ -877,6 +907,14 @@ public class CVSTeamProvider extends RepositoryProvider {
return (String[])arguments.toArray(new String[arguments.size()]);
}
+ private ICVSResource[] getCVSArguments(IResource[] resources) {
+ ICVSResource[] cvsResources = new ICVSResource[resources.length];
+ for (int i = 0; i < cvsResources.length; i++) {
+ cvsResources[i] = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
+ }
+ return cvsResources;
+ }
+
/*
* This method expects to be passed an InfiniteSubProgressMonitor
*/
@@ -1143,4 +1181,51 @@ public class CVSTeamProvider extends RepositoryProvider {
public static void setMoveDeleteHook(IMoveDeleteHook hook) {
moveDeleteHook = hook;
}
+
+ /**
+ * @see org.eclipse.team.core.RepositoryProvider#getFileModificationValidator()
+ */
+ public IFileModificationValidator getFileModificationValidator() {
+ if (isWatchEditEnabled()) {
+ return new IFileModificationValidator() {
+ public IStatus validateEdit(IFile[] files, Object context) {
+ try {
+ // only do this for files that are read-only
+ List readOnlys = new ArrayList();
+ for (int i = 0; i < files.length; i++) {
+ IFile iFile = files[i];
+ if (iFile.isReadOnly())
+ readOnlys.add(iFile);
+ }
+ if (readOnlys.isEmpty()) return OK;
+
+ // XXX We should try to create a PM using the provided context
+ checkout((IFile[]) readOnlys.toArray(new IFile[readOnlys.size()]), false /* recurse */, null);
+ } catch (TeamException e) {
+ return e.getStatus();
+ }
+ return OK;
+ }
+ public IStatus validateSave(IFile file) {
+ // Ignore files that are not read-only
+ if (!file.isReadOnly()) return OK;
+ try {
+ checkout(new IResource[] {file}, false /* recurse */, null);
+ } catch (TeamException e) {
+ return e.getStatus();
+ }
+ return OK;
+ }
+ };
+ } else {
+ return super.getFileModificationValidator();
+ }
+ }
+
+ /**
+ * Answer true if watch/edit support is enabled for this provider.
+ */
+ public boolean isWatchEditEnabled() {
+ return CVSProviderPlugin.getPlugin().isWatchEditEnabled();
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFile.java
index 6b21bcf09..0ab33e457 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFile.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFile.java
@@ -1,10 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
package org.eclipse.team.internal.ccvs.core;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
import java.io.InputStream;
import java.util.Date;
@@ -27,6 +32,13 @@ public interface ICVSFile extends ICVSResource {
public static final int UPDATE_EXISTING = 3;
public static final int CREATED = 4;
+ // Constants used to indicate temporary watches
+ public static final int NO_NOTIFICATION = 0;
+ public static final int NOTIFY_ON_EDIT = 1;
+ public static final int NOTIFY_ON_UNEDIT = 2;
+ public static final int NOTIFY_ON_COMMIT = 4;
+ public static final int NOTIFY_ON_ALL = NOTIFY_ON_EDIT | NOTIFY_ON_UNEDIT | NOTIFY_ON_COMMIT;
+
/**
* Answers the size of the file.
*/
@@ -39,7 +51,11 @@ public interface ICVSFile extends ICVSResource {
InputStream getContents() throws CVSException;
/**
- * Set the contents of the file to the contents of the provided input stream
+ * Set the contents of the file to the contents of the provided input stream.
+ *
+ * This method is used by the command framework and should not be used by other clients.
+ * Other clients should set the contents of the underlying <code>IFile</code> which
+ * can be obtained using <code>getIResource()</code>.
*
* @param responseType the type of reponse that was received from the server
*
@@ -51,28 +67,40 @@ public interface ICVSFile extends ICVSResource {
public void setContents(InputStream stream, int responseType, boolean keepLocalHistory, IProgressMonitor monitor) throws CVSException;
/**
- * Sets the file's read-only permission.
+ * Sets the file to read-only (<code>true</code>) or writable (<code>false</code>).
+ *
+ * This method is used by the command framework and should not be used by other clients.
+ * Other clients should use <code>checkout</code> and <code>uncheckout</code> instead as they
+ * will report the change to the server if appropriate.
*/
void setReadOnly(boolean readOnly) throws CVSException;
/**
- * Answers if the file is read-only.
+ * Answers whether the file is read-only or not.
+ *
+ * This method is used by the command framework and should not be used by other clients.
+ * Other clients should use <code>isCheckedOut</code> instead.
*/
boolean isReadOnly() throws CVSException;
/**
- * Move the resource to another location. Does overwrite without
- * promting.
+ * Copy the resource to another file in the same directory
+ *
+ * This method is used by the command framework and should not be used by other clients.
*/
void copyTo(String filename) throws CVSException;
/**
* Answers the current timestamp for this file with second precision.
+ *
+ * This method is used by the command framework and should not be used by other clients.
*/
Date getTimeStamp();
/**
* If the date is <code>null</code> then the current time is used.
+ *
+ * This method is used by the command framework and should not be used by other clients.
*/
void setTimeStamp(Date date) throws CVSException;
@@ -90,20 +118,42 @@ public interface ICVSFile extends ICVSResource {
public ILogEntry[] getLogEntries(IProgressMonitor monitor) throws TeamException;
/**
- * Gets any notify information associated with the file that has not yet
- * been sent to the server or <code>null</code> if there is none.
- * This information is required as part of the watch/edit workflow.
+ * Indicate whether a fiel has been checked out for local editing. A file is checked out
+ * for local editing if it's read-only bit is false.
+ */
+ public boolean isCheckedOut() throws CVSException;
+
+ /**
+ * Mark the file as checked out to allow local editing (analogous to "cvs edit").
+ * If this method is invoked when <code>isCheckedOut()</code> returns <code>false</code>,
+ * a notification message that will be sent to the server on the next connection
+ * If <code>isCheckedOut()</code> returns <code>true</code> then nothing is done.
+ *
+ * @param notifications the set of operations for which the local user would like notification
+ * while the local file is being edited.
+ */
+ public void checkout(int notifications) throws CVSException;
+
+ /**
+ * Undo a checkout of the file (analogous to "cvs unedit").
+ * If this method is invoked when <code>isCheckedOut()</code> returns <code>true</code>,
+ * a notification message that will be sent to the server on the next connection
+ * If <code>isCheckedOut()</code> returns <code>false</code> then nothing is done.
+ */
+ public void uncheckout() throws CVSException;
+
+ /**
+ * Answer any pending notification information associated with the receiver.
*
- * @param info
+ * This method is used by the command framework and should not be used by other clients.
*/
- public NotifyInfo getNotifyInfo() throws CVSException;
+ public NotifyInfo getPendingNotification() throws CVSException;
/**
- * Set the notify information associated with the file. This information is required
- * as part of the watch/edit workflow.
+ * Indicate to the file that the pending notification was successfully communicated to the server.
*
- * @param info
+ * This method is used by the command framework and should not be used by other clients.
*/
- public void setNotifyInfo(NotifyInfo info) throws CVSException;
+ public void notificationCompleted() throws CVSException;
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java
index 304bf34c0..c1a5d110e 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java
@@ -7,6 +7,7 @@ package org.eclipse.team.internal.ccvs.core;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
+import org.eclipse.team.internal.ccvs.core.syncinfo.NotifyInfo;
/**
* The CVS analog of a directory. CVS folders have access to synchronization information
@@ -151,4 +152,12 @@ public interface ICVSFolder extends ICVSResource {
* @exception CVSException if the operation failed.
*/
public void run(ICVSRunnable job, IProgressMonitor monitor) throws CVSException;
+
+ /**
+ * Answer the list of pending notifications for the folder. An empty list or <code>null</code>
+ * may be returned if there are no pending notifications.
+ *
+ * This method is used by the command framework and should not be used by other clients.
+ */
+ public NotifyInfo[] getPendingNotifications() throws CVSException;
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java
index 219b3f3d7..a87b42b81 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java
@@ -66,6 +66,8 @@ public interface ICVSResource {
/**
* Add the following pattern to the file's parent ignore list
+ *
+ * XXX This should really be a method of ICVSFolder
*/
public void setIgnoredAs(String pattern) throws CVSException;
@@ -142,5 +144,13 @@ public interface ICVSResource {
/**
* Accept a vistor to this resource.
*/
- public void accept(ICVSResourceVisitor visitor) throws CVSException;
+ public void accept(ICVSResourceVisitor visitor) throws CVSException;
+
+ /**
+ * Accept a visitor to this resource. The recurse parameter corresponds to the CVS
+ * -l (do not recurse) and -R (recurse) options. If recurse is false, only the resource
+ * and it's children are visited. Otherwise, the resource and all it's decendants are
+ * visited.
+ */
+ public void accept(ICVSResourceVisitor visitor, boolean recurse) throws CVSException;
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractNotificationCommand.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractNotificationCommand.java
index 27989b6a1..459a18d3e 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractNotificationCommand.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractNotificationCommand.java
@@ -42,7 +42,7 @@ public abstract class AbstractNotificationCommand extends Command {
throws CVSException {
// Send all folders that are managed to the server
- new FileStructureVisitor(session, false, false, monitor).visit(session, resources);
+ new NOOPVisitor(session, monitor).visit(session, resources);
}
/**
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
index a46e08aef..1fa0eeebb 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
@@ -18,9 +18,9 @@ import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
import org.eclipse.team.internal.ccvs.core.Policy;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.core.resources.CVSEntryLineTag;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
+import org.eclipse.team.internal.ccvs.core.syncinfo.NotifyInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
/**
@@ -140,11 +140,12 @@ abstract class AbstractStructureVisitor implements ICVSResourceVisitor {
protected void sendFile(ICVSFile mFile) throws CVSException {
Policy.checkCanceled(monitor);
-
+
// Send the file's entry line to the server
ResourceSyncInfo info = null;
boolean isManaged = mFile.isManaged();
if (isManaged) {
+ sendPendingNotification(mFile);
info = mFile.getSyncInfo();
session.sendEntry(info.getServerEntryLine(mFile.getTimeStamp()));
} else {
@@ -172,6 +173,14 @@ abstract class AbstractStructureVisitor implements ICVSResourceVisitor {
}
}
}
+
+ protected void sendPendingNotification(ICVSFile mFile) throws CVSException {
+ NotifyInfo notify = mFile.getPendingNotification();
+ if (notify != null) {
+ sendFolder(mFile.getParent());
+ session.sendNotify(mFile.getParent(), notify);
+ }
+ }
/**
* This method is used to visit a set of ICVSResources. Using it ensures
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
index 10800731e..870619d43 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
@@ -54,6 +54,7 @@ public abstract class Command extends Request {
public final static RTag RTAG = new RTag();
public final static Update UPDATE = new Update();
public final static Version VERSION = new Version();
+ public final static NOOPCommand NOOP = new NOOPCommand();
// Empty argument array
public final static String[] NO_ARGUMENTS = new String[0];
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java
index 61b4d85f5..383a9b92a 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java
@@ -54,7 +54,7 @@ class FileStructureVisitor extends AbstractStructureVisitor {
* @see ICVSResourceVisitor#visitFolder(ICVSFolder)
*/
public void visitFolder(ICVSFolder mFolder) throws CVSException {
-
+
if (sendEmptyFolders) {
// If we want to send empty folder, that just send it when
// we come to it
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Edit.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/NOOPCommand.java
index 7e7bec03e..c2738ea9e 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Edit.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/NOOPCommand.java
@@ -1,11 +1,10 @@
package org.eclipse.team.internal.ccvs.core.client;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.client.Command.GlobalOption;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;
/**
* @author Administrator
@@ -15,35 +14,35 @@ import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListen
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
-public class Edit extends AbstractNotificationCommand {
+public class NOOPCommand extends Command {
/**
- * @see org.eclipse.team.internal.ccvs.core.client.Request#getRequestId()
+ * @see org.eclipse.team.internal.ccvs.core.client.Command#sendLocalResourceState(Session, GlobalOption[], LocalOption[], ICVSResource[], IProgressMonitor)
*/
- protected String getRequestId() {
- // There is no actual edit command but a noop will get a response
- // from the server for any notifies that were sent up.
- return "noop"; //$NON-NLS$
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.core.client.Command#doExecute(Session, GlobalOption[], LocalOption[], String[], ICommandOutputListener, IProgressMonitor)
- */
- protected IStatus doExecute(
+ protected void sendLocalResourceState(
Session session,
GlobalOption[] globalOptions,
LocalOption[] localOptions,
- String[] arguments,
- ICommandOutputListener listener,
+ ICVSResource[] resources,
IProgressMonitor monitor)
throws CVSException {
-
- // Populate the CVS/Notify files before issuing the command.
-
- // Issue the command
- return super.doExecute(session, globalOptions, localOptions,
- arguments, listener, monitor);
+ // The noop visitor will send any pending notifications
+ new NOOPVisitor(session, monitor).visit(session, resources);
+ }
+
+ /**
+ * @see org.eclipse.team.internal.ccvs.core.client.Request#getRequestId()
+ */
+ protected String getRequestId() {
+ return "noop"; //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.team.internal.ccvs.core.client.Command#sendArguments(Session, String[])
+ */
+ protected void sendArguments(Session session, String[] arguments)throws CVSException {
+ // don't send any arguments
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/EditNotificationVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/NOOPVisitor.java
index bb6c8a20b..f4ecc26a6 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/EditNotificationVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/NOOPVisitor.java
@@ -19,9 +19,9 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.NotifyInfo;
/**
* Send the contents of the CVS/Notify files to the server
*/
-public class EditNotificationVisitor extends AbstractStructureVisitor {
+public class NOOPVisitor extends AbstractStructureVisitor {
- public EditNotificationVisitor(Session session, IProgressMonitor monitor) {
+ public NOOPVisitor(Session session, IProgressMonitor monitor) {
// Only send non-empty folders
super(session, false, false, monitor);
}
@@ -30,16 +30,7 @@ public class EditNotificationVisitor extends AbstractStructureVisitor {
* @see org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor#visitFile(ICVSFile)
*/
public void visitFile(ICVSFile file) throws CVSException {
-
- // we're only interested in files that have notification information
- NotifyInfo info = file.getNotifyInfo();
- if (info == null) return;
-
- // Send the parent folder if it hasn't been sent already
- sendFolder(file.getParent());
-
- // Send the notification to the server
- session.sendNotify(info, monitor);
+ sendPendingNotification(file);
}
/**
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/NotifiedHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/NotifiedHandler.java
new file mode 100644
index 000000000..b098eb130
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/NotifiedHandler.java
@@ -0,0 +1,45 @@
+package org.eclipse.team.internal.ccvs.core.client;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.ICVSFile;
+import org.eclipse.team.internal.ccvs.core.ICVSFolder;
+
+/**
+ * @author Administrator
+ *
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates.
+ * To enable and disable the creation of type comments go to
+ * Window>Preferences>Java>Code Generation.
+ */
+public class NotifiedHandler extends ResponseHandler {
+
+ /**
+ * @see org.eclipse.team.internal.ccvs.core.client.ResponseHandler#getResponseID()
+ */
+ public String getResponseID() {
+ return "Notified"; //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.team.internal.ccvs.core.client.ResponseHandler#handle(Session, String, IProgressMonitor)
+ */
+ public void handle(
+ Session session,
+ String localDir,
+ IProgressMonitor monitor)
+ throws CVSException {
+
+ // read additional data for the response
+ // (which is the full repository path of the file)
+ String repositoryFilePath = session.readLine();
+
+ // clear the notify info for the file
+ ICVSFolder folder = session.getLocalRoot().getFolder(localDir);
+ ICVSFile file = folder.getFile(new Path(repositoryFilePath).lastSegment());
+ file.notificationCompleted();
+ }
+
+}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java
index 467937dc4..7f9ae8d38 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java
@@ -53,6 +53,7 @@ public abstract class Request {
registerResponseHandler(new ValidRequestsHandler());
registerResponseHandler(new ModuleExpansionHandler());
registerResponseHandler(new MTHandler());
+ registerResponseHandler(new NotifiedHandler());
}
protected static void registerResponseHandler(ResponseHandler handler) {
responseHandlers.put(handler.getResponseID(), handler);
@@ -134,7 +135,7 @@ public abstract class Request {
} else argument = ""; //$NON-NLS-1$
// handle completion responses
- if (response.equals("ok")) { //$NON-NLS-1$
+ if (response.trim().equals("ok")) { //$NON-NLS-1$
break;
} else if (response.equals("error") || (isCVSNT && response.equals(""))) { //$NON-NLS-1$ //$NON-NLS-2$
if (argument.trim().length() == 0) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
index ff45ec753..a6bc7be62 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
@@ -784,12 +784,12 @@ public class Session {
/**
* Sends the Notify request to the server
*/
- public void sendNotify(NotifyInfo info, IProgressMonitor monitor)
+ public void sendNotify(ICVSFolder parent, NotifyInfo info)
throws CVSException {
String filename = info.getName();
connection.writeLine("Notify " + filename); //$NON-NLS-1$
- connection.writeLine(info.getServerLine());
+ connection.writeLine(info.getServerLine(parent));
}
/**
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
index 3d2908b2e..fe538bc0b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
@@ -12,7 +12,9 @@ package org.eclipse.team.internal.ccvs.core.resources;
import java.io.File;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
@@ -126,6 +128,13 @@ public class EclipseFile extends EclipseResource implements ICVSFile {
}
/*
+ * @see ICVSResource#accept(ICVSResourceVisitor, boolean)
+ */
+ public void accept(ICVSResourceVisitor visitor, boolean recurse) throws CVSException {
+ visitor.visitFile(this);
+ }
+
+ /*
* This is to be used by the Copy handler. The filename of the form .#filename
*/
public void copyTo(String filename) throws CVSException {
@@ -226,7 +235,7 @@ public class EclipseFile extends EclipseResource implements ICVSFile {
if (isManaged()) {
EclipseSynchronizer.getInstance().setNotifyInfo(resource, info);
// On an edit, the base should be cached
- // On an unedit, the base should be restored and cleared
+ // On an unedit, the base should be restored (and cleared?)
// On a commit, the base should be cleared
}
}
@@ -241,4 +250,82 @@ public class EclipseFile extends EclipseResource implements ICVSFile {
return null;
}
+ /**
+ * @see org.eclipse.team.internal.ccvs.core.ICVSFile#checkout(int)
+ */
+ public void checkout(int notifications) throws CVSException {
+ if (isCheckedOut()) return;
+
+ // convert the notifications to internal form
+ char[] internalFormat;
+ if (notifications == NO_NOTIFICATION) {
+ internalFormat = null;
+ } else if (notifications == NOTIFY_ON_ALL) {
+ internalFormat = NotifyInfo.ALL;
+ } else {
+ List notificationCharacters = new ArrayList();
+ if ((notifications & NOTIFY_ON_EDIT) >0)
+ notificationCharacters.add(new Character(NotifyInfo.EDIT));
+ if ((notifications & NOTIFY_ON_UNEDIT) >0)
+ notificationCharacters.add(new Character(NotifyInfo.UNEDIT));
+ if ((notifications & NOTIFY_ON_COMMIT) >0)
+ notificationCharacters.add(new Character(NotifyInfo.COMMIT));
+ internalFormat = new char[notificationCharacters.size()];
+ for (int i = 0; i < internalFormat.length; i++) {
+ internalFormat[i] = ((Character)notificationCharacters.get(i)).charValue();
+ }
+ }
+
+ // record the notification
+ NotifyInfo info = new NotifyInfo(getName(), NotifyInfo.EDIT, new Date(), internalFormat);
+ setNotifyInfo(info);
+
+ // XXX Copy original file to CVS/Base directory abd update CVS/Baserev file
+
+ // allow editing
+ setReadOnly(false);
+ }
+
+ /**
+ * @see org.eclipse.team.internal.ccvs.core.ICVSFile#isCheckedOut()
+ */
+ public boolean isCheckedOut() throws CVSException {
+ return !isReadOnly();
+ }
+
+ /**
+ * @see org.eclipse.team.internal.ccvs.core.ICVSFile#uncheckout()
+ */
+ public void uncheckout() throws CVSException {
+ if (!isCheckedOut()) return;
+
+ // record the notification
+ NotifyInfo info = getNotifyInfo();
+ if (info != null && info.getNotificationType() == NotifyInfo.EDIT) {
+ info = null;
+ } else {
+ info = new NotifyInfo(getName(), NotifyInfo.UNEDIT, new Date(), null);
+ }
+ setNotifyInfo(info);
+
+ // XXX Copy original file back from CVS/Base directory
+
+ // prevent editing
+ setReadOnly(true);
+ }
+
+ /**
+ * @see org.eclipse.team.internal.ccvs.core.ICVSFile#notificationCompleted()
+ */
+ public void notificationCompleted() throws CVSException {
+ EclipseSynchronizer.getInstance().deleteNotifyInfo(resource);
+ }
+
+ /**
+ * @see org.eclipse.team.internal.ccvs.core.ICVSFile#getPendingNotification()
+ */
+ public NotifyInfo getPendingNotification() throws CVSException {
+ return getNotifyInfo();
+ }
+
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
index 822fd203c..941a12c21 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
@@ -11,7 +11,6 @@
package org.eclipse.team.internal.ccvs.core.resources;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IContainer;
@@ -36,6 +35,7 @@ import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
+import org.eclipse.team.internal.ccvs.core.syncinfo.NotifyInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
/**
@@ -146,6 +146,21 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
public void accept(ICVSResourceVisitor visitor) throws CVSException {
visitor.visitFolder(this);
}
+
+ /**
+ * @see ICVSResource#accept(ICVSResourceVisitor, boolean)
+ */
+ public void accept(ICVSResourceVisitor visitor, boolean recurse) throws CVSException {
+ visitor.visitFolder(this);
+ if (recurse) {
+ acceptChildren(visitor);
+ } else {
+ ICVSResource[] files = members(ICVSFolder.FILE_MEMBERS);
+ for (int i = 0; i < files.length; i++) {
+ files[i].accept(visitor);
+ }
+ }
+ }
/**
* @see ICVSResource#getRemoteLocation(ICVSFolder)
@@ -300,4 +315,14 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
public ICVSResource[] fetchChildren(IProgressMonitor monitor) throws CVSException {
return members(FILE_MEMBERS | FOLDER_MEMBERS);
}
+
+ /**
+ * @see org.eclipse.team.internal.ccvs.core.ICVSFolder#getPendingNotifications()
+ */
+ public NotifyInfo[] getPendingNotifications() throws CVSException {
+ if (isCVSFolder()) {
+ return EclipseSynchronizer.getInstance().getAllNotifyInfo((IContainer)resource);
+ }
+ return null;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
index 93fd8990f..97b20960e 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
@@ -860,8 +860,9 @@ public class EclipseSynchronizer {
for (Iterator iter = infoMap.values().iterator(); iter.hasNext();) {
newInfos[i++] = (NotifyInfo) iter.next();
}
- SyncFileWriter.writeAllNotifyInfo(resource.getParent(), newInfos);
+ infos = newInfos;
}
+ SyncFileWriter.writeAllNotifyInfo(resource.getParent(), infos);
}
/**
@@ -880,4 +881,34 @@ public class EclipseSynchronizer {
return null;
}
+ /**
+ * Anwser all the notification information associated with the given folder
+ * @param parent
+ * @return NotifyInfo[]
+ */
+ public NotifyInfo[] getAllNotifyInfo(IContainer parent) throws CVSException {
+ return SyncFileWriter.readAllNotifyInfo(parent);
+ }
+
+ /**
+ * Method deleteNotifyInfo.
+ * @param resource
+ */
+ public void deleteNotifyInfo(IResource resource) throws CVSException {
+ NotifyInfo[] infos = SyncFileWriter.readAllNotifyInfo(resource.getParent());
+ if (infos == null) return;
+ Map infoMap = new HashMap();
+ for (int i = 0; i < infos.length; i++) {
+ NotifyInfo notifyInfo = infos[i];
+ infoMap.put(infos[i].getName(), infos[i]);
+ }
+ infoMap.remove(resource.getName());
+ NotifyInfo[] newInfos = new NotifyInfo[infoMap.size()];
+ int i = 0;
+ for (Iterator iter = infoMap.values().iterator(); iter.hasNext();) {
+ newInfos[i++] = (NotifyInfo) iter.next();
+ }
+ SyncFileWriter.writeAllNotifyInfo(resource.getParent(), newInfos);
+ }
+
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java
index 8c26c853a..44dd9c770 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java
@@ -120,13 +120,20 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
}
/**
- * @see ICVSResource#accept(IManagedVisitor)
+ * @see ICVSResource#accept(ICVSResourceVisitor)
*/
public void accept(ICVSResourceVisitor visitor) throws CVSException {
visitor.visitFile(this);
}
/**
+ * @see ICVSResource#accept(ICVSResourceVisitor, boolean)
+ */
+ public void accept(ICVSResourceVisitor visitor, boolean recurse) throws CVSException {
+ visitor.visitFile(this);
+ }
+
+ /**
* @see ICVSRemoteFile#getContents()
*/
public InputStream getContents(IProgressMonitor monitor) throws CVSException {
@@ -409,9 +416,9 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
}
/**
- * @see IManagedFile#moveTo(IManagedFile)
+ * @see ICVSFile#moveTo(String)
*/
- public void copyTo(String mFile) throws CVSException, ClassCastException {
+ public void copyTo(String mFile) throws CVSException {
// Do nothing
}
@@ -537,17 +544,39 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
out.write(byteStream.toByteArray());
return out;
}
+
+ /**
+ * @see org.eclipse.team.internal.ccvs.core.ICVSFile#checkout(int)
+ */
+ public void checkout(int notifications) throws CVSException {
+ // do nothing
+ }
+
+ /**
+ * @see org.eclipse.team.internal.ccvs.core.ICVSFile#isCheckedOut()
+ */
+ public boolean isCheckedOut() {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.team.internal.ccvs.core.ICVSFile#uncheckout()
+ */
+ public void uncheckout() throws CVSException {
+ // do nothing
+ }
+
/**
- * @see org.eclipse.team.internal.ccvs.core.ICVSFile#setNotifyInfo(NotifyInfo)
+ * @see org.eclipse.team.internal.ccvs.core.ICVSFile#notificationCompleted()
*/
- public void setNotifyInfo(NotifyInfo info) {
+ public void notificationCompleted() {
// do nothing
}
/**
- * @see org.eclipse.team.internal.ccvs.core.ICVSFile#getNotifyInfo()
+ * @see org.eclipse.team.internal.ccvs.core.ICVSFile#getPendingNotification()
*/
- public NotifyInfo getNotifyInfo() throws CVSException {
+ public NotifyInfo getPendingNotification() throws CVSException {
return null;
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
index bdc6756d2..058d58efe 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
@@ -43,6 +43,7 @@ import org.eclipse.team.internal.ccvs.core.client.listeners.StatusListener;
import org.eclipse.team.internal.ccvs.core.client.listeners.UpdateListener;
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
+import org.eclipse.team.internal.ccvs.core.syncinfo.NotifyInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.Assert;
import org.eclipse.team.internal.ccvs.core.util.Util;
@@ -131,12 +132,27 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
}
/**
- * @see IManagedResource#accept(IManagedVisitor)
+ * @see ICVSResource#accept(ICVSResourceVisitor)
*/
public void accept(ICVSResourceVisitor visitor) throws CVSException {
visitor.visitFolder(this);
}
+ /**
+ * @see ICVSResource#accept(ICVSResourceVisitor, boolean)
+ */
+ public void accept(ICVSResourceVisitor visitor, boolean recurse) throws CVSException {
+ visitor.visitFolder(this);
+ if (recurse) {
+ acceptChildren(visitor);
+ } else {
+ ICVSResource[] files = members(ICVSFolder.FILE_MEMBERS);
+ for (int i = 0; i < files.length; i++) {
+ files[i].accept(visitor);
+ }
+ }
+ }
+
/*
* @see ICVSRemoteResource#exists(IProgressMonitor)
*/
@@ -744,4 +760,12 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
Assert.isTrue( ! path.isEmpty());
return getRelativePathFromRootRelativePath((ICVSFolder)root.getChild(path.segment(0)), path.removeFirstSegments(1));
}
+
+ /**
+ * @see org.eclipse.team.internal.ccvs.core.ICVSFolder#getPendingNotifications()
+ */
+ public NotifyInfo[] getPendingNotifications() throws CVSException {
+ return null;
+ }
+
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/NotifyInfo.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/NotifyInfo.java
index 8ab522d7a..a805ff213 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/NotifyInfo.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/NotifyInfo.java
@@ -39,7 +39,7 @@ public class NotifyInfo {
protected static final String SEPERATOR = "/"; //$NON-NLS-1$
protected static final String TAB_SEPERATOR = "\t"; //$NON-NLS-1$
- private ICVSFile file;
+ private String filename;
private char notificationType;
private Date timeStamp;
private char[] watches;
@@ -47,9 +47,9 @@ public class NotifyInfo {
/**
* Constructor for setting all variables
*/
- public NotifyInfo(ICVSFile file, char notificationType, Date timeStamp, char[] watches) {
+ public NotifyInfo(String filename, char notificationType, Date timeStamp, char[] watches) {
- this.file = file;
+ this.filename = filename;
this.notificationType = notificationType;
this.timeStamp = timeStamp;
this.watches = watches;
@@ -65,8 +65,7 @@ public class NotifyInfo {
if(tokenizer.countTokens() != 4) {
throw new CVSException(Policy.bind("NotifyInfo.MalformedLine", line)); //$NON-NLS-1$
}
- String filename = tokenizer.nextToken();
- this.file = cvsFolder.getFile(filename);
+ this.filename = tokenizer.nextToken();
String type = tokenizer.nextToken();
if (type.length() != 1) {
@@ -121,7 +120,7 @@ public class NotifyInfo {
*
* @return String
*/
- public String getServerLine() throws CVSException {
+ public String getServerLine(ICVSFolder parent) throws CVSException {
StringBuffer buffer = new StringBuffer();
buffer.append(notificationType);
buffer.append(TAB_SEPERATOR);
@@ -129,7 +128,7 @@ public class NotifyInfo {
buffer.append(TAB_SEPERATOR);
buffer.append(getHost());
buffer.append(TAB_SEPERATOR);
- buffer.append(getWorkingDirectory());
+ buffer.append(getWorkingDirectory(parent));
buffer.append(TAB_SEPERATOR);
if (watches != null) {
for (int i = 0; i < watches.length; i++) {
@@ -154,8 +153,8 @@ public class NotifyInfo {
*
* @return String
*/
- private String getWorkingDirectory() throws CVSException {
- return file.getIResource().getParent().getLocation().toString();
+ private String getWorkingDirectory(ICVSFolder parent) throws CVSException {
+ return parent.getIResource().getLocation().toString();
}
/**
@@ -175,7 +174,15 @@ public class NotifyInfo {
* @return String
*/
public String getName() {
- return file.getName();
+ return filename;
+ }
+
+ /**
+ * Answer the notification type associated with the notification
+ * @return char
+ */
+ public char getNotificationType() {
+ return notificationType;
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PopulateNotifyFileVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PopulateNotifyFileVisitor.java
deleted file mode 100644
index 34034e8fe..000000000
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PopulateNotifyFileVisitor.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.eclipse.team.internal.ccvs.core.util;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
-import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
-import org.eclipse.team.internal.ccvs.core.Policy;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.NotifyInfo;
-
-/**
- * @author Administrator
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class PopulateNotifyFileVisitor implements ICVSResourceVisitor {
-
- private IProgressMonitor monitor;
- private int depth;
-
- private char notificationType;
- private Date timestamp;
- private char[] watches;
-
- /**
- * @see org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor#visitFile(ICVSFile)
- */
- public void visitFile(ICVSFile file) throws CVSException {
- if ( ! file.isManaged()) return;
- NotifyInfo info = new NotifyInfo(file, notificationType, timestamp, watches);
- file.setNotifyInfo(info);
- monitor.worked(1);
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor#visitFolder(ICVSFolder)
- */
- public void visitFolder(ICVSFolder folder) throws CVSException {
- if (folder.isCVSFolder()) {
- // Visit the children of the folder as appropriate
- if (depth == IResource.DEPTH_INFINITE) {
- folder.acceptChildren(this);
- } else if (depth == IResource.DEPTH_ONE) {
- ICVSResource[] files = folder.members(ICVSFolder.FILE_MEMBERS);
- for (int i = 0; i < files.length; i++) {
- files[i].accept(this);
- }
- }
- }
- monitor.worked(1);
- }
-
- public void visitResources(IProject project, final IResource[] resources, int depth, char notificationType, char[] watches, IProgressMonitor pm) throws CVSException {
- this.depth = depth;
- this.notificationType = notificationType;
- this.watches = watches;
- this.timestamp = new Date();
- CVSWorkspaceRoot.getCVSFolderFor(project).run(new ICVSRunnable() {
- public void run(IProgressMonitor pm) throws CVSException {
- monitor = Policy.infiniteSubMonitorFor(pm, 100);
- monitor.beginTask(null, 512);
- monitor.subTask(Policy.bind("PopulateNotifyFileVisitor.settingUpNotifications")); //$NON-NLS-1$
- for (int i = 0; i < resources.length; i++) {
- CVSWorkspaceRoot.getCVSResourceFor(resources[i]).accept(PopulateNotifyFileVisitor.this);
- }
- monitor.done();
- }
- }, pm);
- }
-
-}

Back to the top