Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-04-17 13:40:27 +0000
committerJean Michel-Lemieux2002-04-17 13:40:27 +0000
commitdc4e7cdea235a92cbd4ac065443045de16caa93a (patch)
tree46cf340849edf58326f09b79fdd37f087e0316b8
parent1b28f5415923af6b099cebf021623d97e699aa8c (diff)
downloadeclipse.platform.team-dc4e7cdea235a92cbd4ac065443045de16caa93a.tar.gz
eclipse.platform.team-dc4e7cdea235a92cbd4ac065443045de16caa93a.tar.xz
eclipse.platform.team-dc4e7cdea235a92cbd4ac065443045de16caa93a.zip
Progress monitoring fixes.
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties23
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java80
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java299
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java27
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java13
8 files changed, 224 insertions, 224 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
index 944dca4da..3911798cf 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
@@ -197,7 +197,7 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
/*
* @see ICVSRepositoryLocation#members(CVSTag, boolean, IProgressMonitor)
*/
- public ICVSRemoteResource[] members(CVSTag tag, boolean modules, IProgressMonitor progress) throws CVSException {
+ public ICVSRemoteResource[] members(CVSTag tag, boolean modules, IProgressMonitor progress) throws CVSException {
try {
if (modules) {
return RemoteModule.getRemoteModules(this, tag, progress);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
index 78083726e..3fc9d6ab1 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
@@ -39,11 +39,9 @@ Connection.readUnestablishedConnection=Failure due to attempt to read from an un
Connection.writeUnestablishedConnection=Failure due to attempt to write to an unestablished connection
PServerConnection.invalidChars=Invalid characters in password
-PServerConnection.noUser=No user specified
PServerConnection.hostInvalid=Invalid host
PServerConnection.loginRefused=Incorrect user name or password
PServerConnection.invalidUser={0}
-PServerConnection.host=Cannot locate host: {0}
PServerConnection.socket=Cannot connect to host: {0}
PServerConnection.connectionRefused=Connection refused: {0}
PServerConnection.stream=Error opening socket connection
@@ -99,34 +97,28 @@ ResponseDispatcher.receiving=Receiving reponse
FileProperties.invalidEntryLine=Invalid entry line: {0}
-LocalResource.invalidResourceClass=Two different implementations of ICVSResource used
-LocalFile.invalidDateFormat=Invalid date format received: {0}
-LocalFile.moveFailed=Move from {0} to {1} failed
-LocalFolder.invalidChild=Invalid resource {0}
+EclipseResource.invalidResourceClass=Two different implementations of ICVSResource used
RemoteResource.invalidResourceClass=Two different implementations of ICVSResource used
RemoteResource.invalidOperation=Invalid operation performed on remote resource
RemoteFolder.errorFetchingRevisions=Error fetching file revision numbers
RemoteFolder.invalidChild=Resource {0} is not a child of folder {1}
-RemoteFolder.invalidChild=Invalid folder {0} received during remote operation
RemoteFolder.errorFetchingRevisions=Error fetching file revisions
+RemoteFolder.doesNotExist=Folder {0} does not exist remotely
+
RemoteFile.noContentsReceived=No contents received from server for {0}
RemoteFolderTreeBuilder.buildingBase=Collecting local synchronization information
RemoteFolderTreeBuilder.receivingDelta=Receiving delta for {0}
RemoteFolderTreeBuilder.receivingRevision=Receiving revision for {0}
-Session.readError=Read finished prematurely
Session.badInt="Malformed file transmission received"
Session.receiving=Receiving file: {0}
Session.sending=Sending file: {0}
Session.transfer={0} ({1}K of {2}K bytes)
Session.transferNoSize={0}
-Command.server=Contacting server
Command.receivingResponses=Receiving server response
-Command.invalidRoot=Resource {0} is not a valid CVS root directory
-Command.invalidResource=Resource {0} is not a valid CVS resource
Command.warnings=Warnings occured during CVS operation: {0}
Command.serverError=Error occured during CVS operation: {0}
Command.noMoreInfoAvailable=The server did not provide any additional information.
@@ -144,8 +136,6 @@ Command.update=update
Command.valid-requests=valid-requests
Command.unsupportedResponse=Unknown response received from cvs server: {0} {1}
Command.argumentNotManaged=Argument {0} is not managed
-Command.loadingSyncInfo=Loading CVS synchronization information
-Command.loadingSyncInfo=Saving CVS synchronization information
Command.invalidTag=HEAD is not a valid tag
Tag.notVersionOrBranchError=Error applying tag: the tag provided is not a version or branch tag.
@@ -234,7 +224,6 @@ EclipseFile_Problem_deleting_resource=Problem deleting resource: {1}
EclipseFile_Problem_accessing_resource=Problem accessing resource: {1} Perform a refresh from local.
EclipseFile_Problem_creating_resource=Problem creating resource: {1}
EclipseFile_Problem_writing_resource=Problem writing resource: {1}
-EclipseFile_Problem_appending_to_resource=Problem appending to resource: {1}
EclipseFolder_problem_creating=Problem creating folder: {1}
EclipseSynchronizer.UpdatingSyncEndOperation=Saving CVS synchronization information...
@@ -251,3 +240,9 @@ PollingInputStream.closeTimeout=Timeout while closing input stream
PollingOutputStream.writeTimeout=Timeout while writing to output stream
PollingOutputStream.closeTimeout=Timeout while closing output stream
TimeoutOutputStream.cannotWriteToStream=Cannot write to output stream
+
+RemoteFile.getContents=Retrieving remote file contents
+RemoteFile.getLogEntries=Retrieving log entries
+RemoteFolder.exists=Checking if resource exists remotely
+RemoteFolder.getMembers=Retrieving children of remote folder
+RemoteModule.getRemoteModules=Retrieving remote modules
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 559ef1c1a..164620daa 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
@@ -244,6 +244,8 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
}
}
} catch (CoreException e) {
+ } finally {
+ monitor.done();
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
index dce13a5bc..7e5a318bb 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
@@ -63,7 +63,7 @@ abstract class EclipseResource implements ICVSResource {
result = Util.getRelativePath(rootFolder.getPath(), getPath());
return result;
} catch (ClassCastException e) {
- throw new CVSException(Policy.bind("LocalResource.invalidResourceClass"), e); //$NON-NLS-1$
+ throw new CVSException(Policy.bind("EclipseResource.invalidResourceClass"), e); //$NON-NLS-1$
}
}
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 d001c975f..4a28d4f1b 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
@@ -152,11 +152,12 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
/**
* @see ICVSRemoteFile#getContents()
*/
- public InputStream getContents(final IProgressMonitor monitor) {
- try {
- if (contents == null) {
- final List entries = new ArrayList();
- monitor.beginTask(null, 100);
+ public InputStream getContents(IProgressMonitor monitor) {
+ if (contents == null) {
+ monitor = Policy.monitorFor(monitor);
+ monitor.beginTask(Policy.bind("RemoteFile.getContents"), 100); //$NON-NLS-1$
+ try {
+ List entries = new ArrayList();
IStatus status;
Session s = new Session(getRepository(), parent, false);
s.open(Policy.subMonitorFor(monitor, 10));
@@ -176,7 +177,6 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
}
} finally {
s.close();
- monitor.done();
}
if (status.getCode() == CVSStatus.SERVER_ERROR) {
throw new CVSServerException(status);
@@ -186,11 +186,13 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
if (contents == null) {
contents = new byte[0];
}
+ } catch(CVSException e) {
+ return null;
+ } finally {
+ monitor.done();
}
- return new ByteArrayInputStream(contents);
- } catch(CVSException e) {
- return null;
}
+ return new ByteArrayInputStream(contents);
}
/*
@@ -198,16 +200,20 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
*/
public ILogEntry getLogEntry(IProgressMonitor monitor) throws CVSException {
if (entry == null) {
- monitor.beginTask(null, 100);
- Session s = new Session(getRepository(), parent, false);
- s.open(Policy.subMonitorFor(monitor, 10));
+ monitor = Policy.monitorFor(monitor);
+ monitor.beginTask(Policy.bind("RemoteFile.getLogEntries"), 100); //$NON-NLS-1$
try {
- IStatus status = getLogEntry(s, Policy.subMonitorFor(monitor, 90));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
+ Session s = new Session(getRepository(), parent, false);
+ s.open(Policy.subMonitorFor(monitor, 10));
+ try {
+ IStatus status = getLogEntry(s, Policy.subMonitorFor(monitor, 90));
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ throw new CVSServerException(status);
+ }
+ } finally {
+ s.close();
}
} finally {
- s.close();
monitor.done();
}
}
@@ -241,29 +247,31 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
* @see ICVSRemoteFile#getLogEntries()
*/
public ILogEntry[] getLogEntries(IProgressMonitor monitor) throws CVSException {
-
- // Perform a "cvs log..." with a custom message handler
- final List entries = new ArrayList();
- IStatus status;
- Session s = new Session(getRepository(), parent, false);
- s.open(monitor);
- QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
+ monitor = Policy.monitorFor(monitor);
+ monitor.beginTask(Policy.bind("RemoteFile.getLogEntries"), 100); //$NON-NLS-1$
try {
- CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
- status = Command.LOG.execute(s,
- Command.NO_GLOBAL_OPTIONS,
- Command.NO_LOCAL_OPTIONS,
- new String[] { getName() },
- new LogListener(this, entries),
- monitor);
+ // Perform a "cvs log..." with a custom message handler
+ final List entries = new ArrayList();
+ IStatus status;
+ Session s = new Session(getRepository(), parent, false);
+ s.open(Policy.subMonitorFor(monitor, 10));
+ QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
+ try {
+ CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
+ status = Command.LOG.execute(s, Command.NO_GLOBAL_OPTIONS, Command.NO_LOCAL_OPTIONS,
+ new String[] { getName() }, new LogListener(this, entries),
+ Policy.subMonitorFor(monitor, 90));
+ } finally {
+ CVSProviderPlugin.getPlugin().setQuietness(quietness);
+ s.close();
+ }
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ throw new CVSServerException(status);
+ }
+ return (ILogEntry[])entries.toArray(new ILogEntry[entries.size()]);
} finally {
- CVSProviderPlugin.getPlugin().setQuietness(quietness);
- s.close();
- }
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
+ monitor.done();
}
- return (ILogEntry[])entries.toArray(new ILogEntry[entries.size()]);
}
/**
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 1c252d1ca..0db7fcdab 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
@@ -112,7 +112,7 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
Command.NO_LOCAL_OPTIONS,
fileNames,
new StatusListener(listener),
- monitor);
+ Policy.subMonitorFor(monitor, 100));
if (status.getCode() == CVSStatus.SERVER_ERROR) {
throw new CVSServerException(status);
}
@@ -160,64 +160,66 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
* error and we're looking for a folder, we need to reissue the command without a tag.
*/
protected boolean exists(ICVSRemoteResource child, CVSTag tag, IProgressMonitor monitor) throws CVSException {
-
final IProgressMonitor progress = Policy.monitorFor(monitor);
-
- // Create the listener for remote files and folders
- final boolean[] exists = new boolean[] {true};
- IUpdateMessageListener listener = new IUpdateMessageListener() {
- public void directoryInformation(IPath path, boolean newDirectory) {
- exists[0] = true;
- }
- public void directoryDoesNotExist(IPath path) {
- exists[0] = false;
- }
- public void fileInformation(int type, String filename) {
- // We can't set exists true here as we may get a conflict on a deleted file.
- // i.e. remote files are always communicated to the server as modified.
- }
- public void fileDoesNotExist(String filename) {
- exists[0] = false;
- }
- };
-
- // Build the local options
- List localOptions = new ArrayList();
- localOptions.add(Update.RETRIEVE_ABSENT_DIRECTORIES);
- if (tag != null && tag.getType() != CVSTag.HEAD)
- localOptions.add(Update.makeTagOption(tag));
-
- // Retrieve the children and any file revision numbers in a single connection
- // Perform a "cvs -n update -d -r tagName folderName" with custom message and error handlers
- IStatus status;
- Session s = new Session(getRepository(), this, false);
- s.open(monitor);
+ progress.beginTask(Policy.bind("RemoteFolder.exists"), 100); //$NON-NLS-1$
try {
- status = Command.UPDATE.execute(s,
- new GlobalOption[] { Command.DO_NOT_CHANGE },
- (LocalOption[]) localOptions.toArray(new LocalOption[localOptions.size()]),
- new String[] { child.getName() },
- new UpdateListener(listener),
- monitor);
- } finally {
- s.close();
- }
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- CVSServerException e = new CVSServerException(status);
- if ( ! e.isNoTagException() || ! child.isContainer()) {
- if (e.containsErrors()) {
- throw e;
+ // Create the listener for remote files and folders
+ final boolean[] exists = new boolean[] {true};
+ IUpdateMessageListener listener = new IUpdateMessageListener() {
+ public void directoryInformation(IPath path, boolean newDirectory) {
+ exists[0] = true;
+ }
+ public void directoryDoesNotExist(IPath path) {
+ exists[0] = false;
+ }
+ public void fileInformation(int type, String filename) {
+ // We can't set exists true here as we may get a conflict on a deleted file.
+ // i.e. remote files are always communicated to the server as modified.
+ }
+ public void fileDoesNotExist(String filename) {
+ exists[0] = false;
}
+ };
+
+ // Build the local options
+ List localOptions = new ArrayList();
+ localOptions.add(Update.RETRIEVE_ABSENT_DIRECTORIES);
+ if (tag != null && tag.getType() != CVSTag.HEAD)
+ localOptions.add(Update.makeTagOption(tag));
+
+ // Retrieve the children and any file revision numbers in a single connection
+ // Perform a "cvs -n update -d -r tagName folderName" with custom message and error handlers
+ IStatus status;
+ Session s = new Session(getRepository(), this, false);
+ s.open(Policy.subMonitorFor(progress, 10));
+ try {
+ status = Command.UPDATE.execute(s,
+ new GlobalOption[] { Command.DO_NOT_CHANGE },
+ (LocalOption[]) localOptions.toArray(new LocalOption[localOptions.size()]),
+ new String[] { child.getName() }, new UpdateListener(listener),
+ Policy.subMonitorFor(progress, 90));
+ } finally {
+ s.close();
}
- // we now know that this is an exception caused by a cvs bug.
- // if the folder has no files in it (just subfolders) cvs does not respond with the subfolders...
- // workaround: retry the request with no tag to get the directory names (if any)
- Policy.checkCanceled(progress);
- if (e.isNoTagException()) {
- return exists(child, null, progress);
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ CVSServerException e = new CVSServerException(status);
+ if ( ! e.isNoTagException() || ! child.isContainer()) {
+ if (e.containsErrors()) {
+ throw e;
+ }
+ }
+ // we now know that this is an exception caused by a cvs bug.
+ // if the folder has no files in it (just subfolders) cvs does not respond with the subfolders...
+ // workaround: retry the request with no tag to get the directory names (if any)
+ Policy.checkCanceled(progress);
+ if (e.isNoTagException()) {
+ return exists(child, null, progress);
+ }
}
+ return exists[0];
+ } finally {
+ progress.done();
}
- return exists[0];
}
/**
@@ -236,107 +238,112 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
* persist the children.
*/
protected ICVSRemoteResource[] getMembers(final CVSTag tag, IProgressMonitor monitor) throws CVSException {
-
final IProgressMonitor progress = Policy.monitorFor(monitor);
-
- // Forget about any children we used to know about children
- children = null;
-
- // Create the listener for remote files and folders
- final List newRemoteDirectories = new ArrayList();
- final List newRemoteFiles = new ArrayList();
- final boolean[] exists = new boolean[] {true};
- IUpdateMessageListener listener = new IUpdateMessageListener() {
- public void directoryInformation(IPath path, boolean newDirectory) {
- if (newDirectory && path.segmentCount() == 1) {
- newRemoteDirectories.add(path.lastSegment());
- progress.subTask(path.lastSegment().toString());
- progress.worked(1);
+ progress.beginTask(Policy.bind("RemoteFolder.getMembers"), 100); //$NON-NLS-1$
+ try {
+ // Forget about any children we used to know about children
+ children = null;
+
+ // Create the listener for remote files and folders
+ final List newRemoteDirectories = new ArrayList();
+ final List newRemoteFiles = new ArrayList();
+ final boolean[] exists = new boolean[] {true};
+ IUpdateMessageListener listener = new IUpdateMessageListener() {
+ public void directoryInformation(IPath path, boolean newDirectory) {
+ if (newDirectory && path.segmentCount() == 1) {
+ newRemoteDirectories.add(path.lastSegment());
+ progress.subTask(path.lastSegment().toString());
+ progress.worked(1);
+ }
}
- }
- public void directoryDoesNotExist(IPath path) {
- if (path.isEmpty()) {
- // the remote folder doesn't exist
- exists[0] = false;
+ public void directoryDoesNotExist(IPath path) {
+ if (path.isEmpty()) {
+ // the remote folder doesn't exist
+ exists[0] = false;
+ }
}
- }
- public void fileInformation(int type, String filename) {
- IPath filePath = new Path(filename);
- if( filePath.segmentCount() == 1 ) {
- String properFilename = filePath.lastSegment();
- newRemoteFiles.add(properFilename);
- progress.subTask(properFilename);
- progress.worked(1);
+ public void fileInformation(int type, String filename) {
+ IPath filePath = new Path(filename);
+ if( filePath.segmentCount() == 1 ) {
+ String properFilename = filePath.lastSegment();
+ newRemoteFiles.add(properFilename);
+ progress.subTask(properFilename);
+ progress.worked(1);
+ }
}
- }
- public void fileDoesNotExist(String filename) {
- }
- };
-
- // Build the local options
- List localOptions = new ArrayList();
- localOptions.add(Update.RETRIEVE_ABSENT_DIRECTORIES);
- if (tag != null) localOptions.add(Update.makeTagOption(tag));
-
- // Retrieve the children and any file revision numbers in a single connection
- Session s = new Session(getRepository(), this, false);
- s.open(monitor);
- try {
- // Perform a "cvs -n update -d -r tagName folderName"
- IStatus status = Command.UPDATE.execute(s,
- new GlobalOption[] { Command.DO_NOT_CHANGE },
- (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]),
- new String[] { Session.CURRENT_LOCAL_FOLDER },
- new UpdateListener(listener),
- monitor);
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- if (progress.isCanceled()) {
- throw new OperationCanceledException();
- }
- if (! exists[0]) {
- throw new CVSException(new CVSStatus(CVSStatus.ERROR, CVSStatus.DOES_NOT_EXIST, Policy.bind("RemoteFolder.doesNotExist", getRepositoryRelativePath()))); //$NON-NLS-1$
- }
+ public void fileDoesNotExist(String filename) {
+ }
+ };
- // Convert the file and folder names to IManagedResources
- List result = new ArrayList();
- for (int i=0;i<newRemoteFiles.size();i++) {
- result.add(new RemoteFile(this, Update.STATE_NONE, (String)newRemoteFiles.get(i), tag));
- }
- for (int i=0;i<newRemoteDirectories.size();i++)
- result.add(new RemoteFolder(this, getRepository(), new Path(getRepositoryRelativePath()).append((String)newRemoteDirectories.get(i)), tag));
- children = (ICVSRemoteResource[])result.toArray(new ICVSRemoteResource[0]);
-
- // Get the revision numbers for the files
- if (newRemoteFiles.size() > 0) {
- updateFileRevisions(s, (String[])newRemoteFiles.toArray(new String[newRemoteFiles.size()]), monitor);
- }
+ // Build the local options
+ List localOptions = new ArrayList();
+ localOptions.add(Update.RETRIEVE_ABSENT_DIRECTORIES);
+ if (tag != null) localOptions.add(Update.makeTagOption(tag));
- } catch (CVSServerException e) {
- if ( ! e.isNoTagException() && e.containsErrors())
- throw e;
- if (tag == null)
- throw e;
- // we now know that this is an exception caused by a cvs bug.
- // if the folder has no files in it (just subfolders) cvs does not respond with the subfolders...
- // workaround: retry the request with no tag to get the directory names (if any)
- Policy.checkCanceled(progress);
- children = getMembers(null, progress);
- // the returned children must be given the original tag
- for (int i = 0; i < children.length; i++) {
- ICVSRemoteResource remoteResource = children[i];
- if(remoteResource.isContainer()) {
- ((RemoteFolder)remoteResource).setTag(tag);
+ // Retrieve the children and any file revision numbers in a single connection
+ Session s = new Session(getRepository(), this, false);
+ s.open(Policy.subMonitorFor(progress, 10));
+ try {
+ // Perform a "cvs -n update -d -r tagName folderName"
+ IStatus status = Command.UPDATE.execute(s,
+ new GlobalOption[] { Command.DO_NOT_CHANGE },
+ (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]),
+ new String[] { Session.CURRENT_LOCAL_FOLDER },
+ new UpdateListener(listener),
+ Policy.subMonitorFor(progress, 60));
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ throw new CVSServerException(status);
+ }
+ if (progress.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ if (! exists[0]) {
+ throw new CVSException(new CVSStatus(CVSStatus.ERROR, CVSStatus.DOES_NOT_EXIST, Policy.bind("RemoteFolder.doesNotExist", getRepositoryRelativePath()))); //$NON-NLS-1$
+ }
+
+ // Convert the file and folder names to IManagedResources
+ List result = new ArrayList();
+ for (int i=0;i<newRemoteFiles.size();i++) {
+ result.add(new RemoteFile(this, Update.STATE_NONE, (String)newRemoteFiles.get(i), tag));
+ }
+ for (int i=0;i<newRemoteDirectories.size();i++)
+ result.add(new RemoteFolder(this, getRepository(), new Path(getRepositoryRelativePath()).append((String)newRemoteDirectories.get(i)), tag));
+ children = (ICVSRemoteResource[])result.toArray(new ICVSRemoteResource[0]);
+
+ // Get the revision numbers for the files
+ if (newRemoteFiles.size() > 0) {
+ updateFileRevisions(s, (String[])newRemoteFiles.toArray(new String[newRemoteFiles.size()]),
+ Policy.subMonitorFor(progress, 30));
+ } else {
+ progress.worked(30);
+ }
+ } catch (CVSServerException e) {
+ if ( ! e.isNoTagException() && e.containsErrors())
+ throw e;
+ if (tag == null)
+ throw e;
+ // we now know that this is an exception caused by a cvs bug.
+ // if the folder has no files in it (just subfolders) cvs does not respond with the subfolders...
+ // workaround: retry the request with no tag to get the directory names (if any)
+ Policy.checkCanceled(progress);
+ children = getMembers(null, progress);
+ // the returned children must be given the original tag
+ for (int i = 0; i < children.length; i++) {
+ ICVSRemoteResource remoteResource = children[i];
+ if(remoteResource.isContainer()) {
+ ((RemoteFolder)remoteResource).setTag(tag);
+ }
}
+ } finally {
+ s.close();
}
+
+ // We need to remember the children that were fetched in order to support file
+ // operations that depend on the parent knowing about the child (i.e. RemoteFile#getContents)
+ return children;
} finally {
- s.close();
+ progress.done();
}
-
- // We need to remember the children that were fetched in order to support file
- // operations that depend on the parent knowing about the child (i.e. RemoteFile#getContents)
- return children;
}
/**
@@ -378,7 +385,7 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
ICVSResource child = getChild(name);
if (child.isFolder())
return (ICVSFolder)child;
- throw new CVSException(Policy.bind("RemoteFolder.invalidChild", new Object[] {name})); //$NON-NLS-1$
+ throw new CVSException(Policy.bind("RemoteFolder.invalidChild", name, getName())); //$NON-NLS-1$
}
/**
@@ -388,7 +395,7 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
ICVSResource child = getChild(name);
if (!child.isFolder())
return (ICVSFile)child;
- throw new CVSException(Policy.bind("RemoteFolder.invalidChild", new Object[] {name})); //$NON-NLS-1$
+ throw new CVSException(Policy.bind("RemoteFolder.invalidChild", name, getName())); //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
index 4ad78d5f4..3da3e7811 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
@@ -22,6 +22,7 @@ import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.client.Checkout;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Session;
@@ -29,10 +30,6 @@ import org.eclipse.team.internal.ccvs.core.client.Update;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-/**
- * @version 1.0
- * @author
- */
public class RemoteModule extends RemoteFolder {
private String label;
@@ -41,17 +38,21 @@ public class RemoteModule extends RemoteFolder {
private boolean expandable;
public static RemoteModule[] getRemoteModules(ICVSRepositoryLocation repository, CVSTag tag, IProgressMonitor monitor) throws TeamException {
-
- RemoteModule[] modules;
- Session s = new Session(repository, (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(ResourcesPlugin.getWorkspace().getRoot()), false);
- s.open(monitor);
- try {
- modules = Command.CHECKOUT.getRemoteModules(s, tag, monitor);
+ monitor = Policy.monitorFor(monitor);
+ monitor.beginTask(Policy.bind("RemoteModule.getRemoteModules"), 100); //$NON-NLS-1$
+ try {
+ RemoteModule[] modules;
+ Session s = new Session(repository, (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(ResourcesPlugin.getWorkspace().getRoot()), false);
+ s.open(Policy.subMonitorFor(monitor, 10));
+ try {
+ modules = Command.CHECKOUT.getRemoteModules(s, tag, Policy.subMonitorFor(monitor, 90));
+ } finally {
+ s.close();
+ }
+ return modules;
} finally {
- s.close();
+ monitor.done();
}
-
- return modules;
}
/**
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java
index 609b5a846..90e81acd0 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java
@@ -154,17 +154,4 @@ public abstract class RemoteResource extends PlatformObject implements ICVSRemot
// ensure that clients are not trying to set sync info on remote handles.
Assert.isTrue(false);
}
- /*
- * @see ICVSResource#reloadSyncInfo(IProgressMonitor)
- */
- public void reloadSyncInfo(IProgressMonitor monitor) throws CVSException {
- // NO-OP
- }
-
- /*
- * @see ICVSResource#saveSyncInfo(IProgressMonitor)
- */
- public void saveSyncInfo(IProgressMonitor monitor) throws CVSException {
- // NO-OP
- }
} \ No newline at end of file

Back to the top