Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2003-08-14 15:44:49 +0000
committerMichael Valenta2003-08-14 15:44:49 +0000
commit40584877a329aca5d3b1034a52bdcc53495b6bd7 (patch)
tree8ca863a3d0fea4e6569ba93fa4137c7ff82bd0d2
parentc0dd1cd6992c9558e047c5e972f2d7cf7a92e935 (diff)
downloadeclipse.platform.team-40584877a329aca5d3b1034a52bdcc53495b6bd7.tar.gz
eclipse.platform.team-40584877a329aca5d3b1034a52bdcc53495b6bd7.tar.xz
eclipse.platform.team-40584877a329aca5d3b1034a52bdcc53495b6bd7.zip
Removed use of Session.run()
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java183
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java117
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java128
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java45
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java53
5 files changed, 243 insertions, 283 deletions
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 a50093edc..ed4715ff3 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
@@ -297,7 +297,7 @@ public class CVSTeamProvider extends RepositoryProvider {
progress.beginTask(null, files.size() * 10 + (folders.isEmpty() ? 0 : 10));
try {
if (!folders.isEmpty()) {
- Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true);
+ Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
session.open(Policy.subMonitorFor(progress, 2));
try {
IStatus status = Command.ADD.execute(
@@ -318,7 +318,7 @@ public class CVSTeamProvider extends RepositoryProvider {
Map.Entry entry = (Map.Entry) it.next();
final KSubstOption ksubst = (KSubstOption) entry.getKey();
final Set set = (Set) entry.getValue();
- Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true);
+ Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
session.open(Policy.subMonitorFor(progress, 2));
try {
IStatus status = Command.ADD.execute(
@@ -643,32 +643,25 @@ public class CVSTeamProvider extends RepositoryProvider {
return;
}
- // Make a connection before preparing for the replace to avoid deletion of resources before a failed connection
- Session.run(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */,
- new ICVSRunnable() {
- public void run(IProgressMonitor progress) throws CVSException {
- // Prepare for the replace (special handling for "cvs added" and "cvs removed" resources
- progress.beginTask(null, 100);
- try {
- new PrepareForReplaceVisitor().visitResources(getProject(), resources, "CVSTeamProvider.scrubbingResource", depth, Policy.subMonitorFor(progress, 30)); //$NON-NLS-1$
-
- // Perform an update, ignoring any local file modifications
- List options = new ArrayList();
- options.add(Update.IGNORE_LOCAL_CHANGES);
- if(depth != IResource.DEPTH_INFINITE) {
- options.add(Command.DO_NOT_RECURSE);
- }
- LocalOption[] commandOptions = (LocalOption[]) options.toArray(new LocalOption[options.size()]);
- try {
- update(resources, commandOptions, tag, true /*createBackups*/, Policy.subMonitorFor(progress, 70));
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- } finally {
- progress.done();
- }
- }
- }, progress);
+ // Make a connection before preparing for the replace to avoid deletion of resources before a failed connection
+ progress.beginTask(null, 100);
+ Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
+ session.open(Policy.subMonitorFor(progress,10));
+ try {
+ new PrepareForReplaceVisitor().visitResources(getProject(), resources, "CVSTeamProvider.scrubbingResource", depth, Policy.subMonitorFor(progress, 20)); //$NON-NLS-1$
+
+ List options = new ArrayList();
+ options.add(Update.IGNORE_LOCAL_CHANGES);
+ if(depth != IResource.DEPTH_INFINITE) {
+ options.add(Command.DO_NOT_RECURSE);
+ }
+ LocalOption[] commandOptions = (LocalOption[]) options.toArray(new LocalOption[options.size()]);
+
+ update(session, resources, commandOptions, tag, true /*createBackups*/, Policy.subMonitorFor(progress, 70));
+ } finally {
+ session.close();
+ progress.done();
+ }
}
/**
@@ -703,59 +696,60 @@ public class CVSTeamProvider extends RepositoryProvider {
final ICVSResource[] arguments = getCVSArguments(resources);
// Tag the remote resources
- Session s = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot());
- try {
- final IStatus status[] = new IStatus[] { null };
- if (versionTag != null) {
- // Version using a custom tag command that skips added but not commited reesources
- Session.run(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */,
- new ICVSRunnable( ) {
- public void run(IProgressMonitor monitor) throws CVSException {
- status[0] = Command.CUSTOM_TAG.execute(
- Command.NO_GLOBAL_OPTIONS,
- Command.NO_LOCAL_OPTIONS,
- versionTag,
- arguments,
- null,
- monitor);
- }
- }, Policy.subMonitorFor(monitor, 40));
- if (status[0].isOK()) {
- // Branch using the tag
- Session.run(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */,
- new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- status[0] = Command.CUSTOM_TAG.execute(
- Command.NO_GLOBAL_OPTIONS,
- Command.NO_LOCAL_OPTIONS,
- branchTag,
- arguments,
- null,
- monitor);
- }
- }, Policy.subMonitorFor(monitor, 20));
+ IStatus status = null;
+ if (versionTag != null) {
+ // Version using a custom tag command that skips added but not commited reesources
+ Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
+ session.open(Policy.subMonitorFor(monitor, 5));
+ try {
+ status = Command.CUSTOM_TAG.execute(
+ session,
+ Command.NO_GLOBAL_OPTIONS,
+ Command.NO_LOCAL_OPTIONS,
+ versionTag,
+ arguments,
+ null,
+ Policy.subMonitorFor(monitor, 35));
+ } finally {
+ session.close();
+ }
+ if (status.isOK()) {
+ // Branch using the tag
+ session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
+ session.open(Policy.subMonitorFor(monitor, 5));
+ try {
+ status = Command.CUSTOM_TAG.execute(
+ session,
+ Command.NO_GLOBAL_OPTIONS,
+ Command.NO_LOCAL_OPTIONS,
+ branchTag,
+ arguments,
+ null,
+ Policy.subMonitorFor(monitor, 15));
+ } finally {
+ session.close();
}
- } else {
- // Just branch using tag
- Session.run(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */,
- new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- status[0] = Command.CUSTOM_TAG.execute(
- Command.NO_GLOBAL_OPTIONS,
- Command.NO_LOCAL_OPTIONS,
- branchTag,
- arguments,
- null,
- monitor);
- }
- }, Policy.subMonitorFor(monitor, 40));
-
}
- if ( ! status[0].isOK()) {
- throw new CVSServerException(status[0]);
+ } else {
+ // Just branch using tag
+ Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
+ session.open(Policy.subMonitorFor(monitor, 5));
+ try {
+ status = Command.CUSTOM_TAG.execute(
+ session,
+ Command.NO_GLOBAL_OPTIONS,
+ Command.NO_LOCAL_OPTIONS,
+ branchTag,
+ arguments,
+ null,
+ Policy.subMonitorFor(monitor, 35));
+ } finally {
+ session.close();
}
- } finally {
- s.close();
+
+ }
+ if ( ! status.isOK()) {
+ throw new CVSServerException(status);
}
// Set the tag of the local resources to the branch tag (The update command will not
@@ -890,7 +884,18 @@ public class CVSTeamProvider extends RepositoryProvider {
*
* @param createBackups if true, creates .# files for updated files
*/
- public void update(IResource[] resources, LocalOption[] options, CVSTag tag, final boolean createBackups, IProgressMonitor progress) throws TeamException {
+ public void update(IResource[] resources, LocalOption[] options, CVSTag tag, boolean createBackups, IProgressMonitor progress) throws TeamException {
+ progress.beginTask(null, 100);
+ Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
+ session.open(Policy.subMonitorFor(progress,10));
+ try {
+ update(session, resources, options, tag, createBackups, Policy.subMonitorFor(progress, 90));
+ } finally {
+ session.close();
+ }
+ }
+
+ private void update(Session session, IResource[] resources, LocalOption[] options, CVSTag tag, boolean createBackups, IProgressMonitor progress) throws TeamException {
// Build the local options
List localOptions = new ArrayList();
@@ -904,16 +909,16 @@ public class CVSTeamProvider extends RepositoryProvider {
final LocalOption[] commandOptions = (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]);
final ICVSResource[] arguments = getCVSArguments(resources);
- Session.run(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */,
- new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- IStatus status = Command.UPDATE.execute(Command.NO_GLOBAL_OPTIONS, commandOptions, arguments,
- null, monitor);
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- }
- }, progress);
+ IStatus status = Command.UPDATE.execute(
+ session,
+ Command.NO_GLOBAL_OPTIONS,
+ commandOptions,
+ arguments,
+ null,
+ progress);
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ throw new CVSServerException(status);
+ }
}
/*
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 ba1ab2071..08ddfa5da 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
@@ -207,30 +207,33 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
*/
public ILogEntry getLogEntry(IProgressMonitor monitor) throws CVSException {
if (entry == null) {
- Session.run(getRepository(), parent, false, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(Policy.bind("RemoteFile.getLogEntries"), 100); //$NON-NLS-1$
- try {
- final List entries = new ArrayList();
- IStatus status = Command.LOG.execute(
- Command.NO_GLOBAL_OPTIONS,
- new LocalOption[] {
- Log.makeRevisionOption(getRevision())},
- new ICVSResource[] { RemoteFile.this },
- new LogListener(RemoteFile.this, entries),
- Policy.subMonitorFor(monitor, 100));
- if (entries.size() == 1) {
- entry = (ILogEntry)entries.get(0);
- }
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- monitor.done();
+ monitor = Policy.monitorFor(monitor);
+ monitor.beginTask(Policy.bind("RemoteFile.getLogEntries"), 100); //$NON-NLS-1$
+ Session session = new Session(getRepository(), parent, false /* output to console */);
+ session.open(Policy.subMonitorFor(monitor, 10));
+ try {
+ try {
+ final List entries = new ArrayList();
+ IStatus status = Command.LOG.execute(
+ session,
+ Command.NO_GLOBAL_OPTIONS,
+ new LocalOption[] {
+ Log.makeRevisionOption(getRevision())},
+ new ICVSResource[] { RemoteFile.this },
+ new LogListener(RemoteFile.this, entries),
+ Policy.subMonitorFor(monitor, 90));
+ if (entries.size() == 1) {
+ entry = (ILogEntry)entries.get(0);
+ }
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ throw new CVSServerException(status);
}
+ } finally {
+ monitor.done();
}
- }, monitor);
+ } finally {
+ session.close();
+ }
}
return entry;
}
@@ -239,26 +242,30 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
* @see ICVSRemoteFile#getLogEntries()
*/
public ILogEntry[] getLogEntries(IProgressMonitor monitor) throws CVSException {
+ monitor = Policy.monitorFor(monitor);
+ monitor.beginTask(Policy.bind("RemoteFile.getLogEntries"), 100); //$NON-NLS-1$
final List entries = new ArrayList();
- Session.run(getRepository(), parent, false, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(Policy.bind("RemoteFile.getLogEntries"), 100); //$NON-NLS-1$
- QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
- try {
- CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
- IStatus status = Command.LOG.execute(Command.NO_GLOBAL_OPTIONS, Command.NO_LOCAL_OPTIONS,
- new ICVSResource[] { RemoteFile.this }, new LogListener(RemoteFile.this, entries),
- Policy.subMonitorFor(monitor, 100));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- CVSProviderPlugin.getPlugin().setQuietness(quietness);
- monitor.done();
+ Session session = new Session(getRepository(), parent, false /* output to console */);
+ session.open(Policy.subMonitorFor(monitor, 10));
+ try {
+ QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
+ try {
+ CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
+ IStatus status = Command.LOG.execute(
+ session,
+ Command.NO_GLOBAL_OPTIONS, Command.NO_LOCAL_OPTIONS,
+ new ICVSResource[] { RemoteFile.this }, new LogListener(RemoteFile.this, entries),
+ Policy.subMonitorFor(monitor, 90));
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ throw new CVSServerException(status);
}
+ } finally {
+ CVSProviderPlugin.getPlugin().setQuietness(quietness);
+ monitor.done();
}
- }, monitor);
+ } finally {
+ session.close();
+ }
return (ILogEntry[])entries.toArray(new ILogEntry[entries.size()]);
}
@@ -476,24 +483,22 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
* The revision of the remote file is used as the base for the tagging operation
*/
public IStatus tag(final CVSTag tag, final LocalOption[] localOptions, IProgressMonitor monitor) throws CVSException {
- final IStatus[] result = new IStatus[] { null };
- Session.run(getRepository(), this.getParent(), true, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- result[0] = Command.RTAG.execute(
- Command.NO_GLOBAL_OPTIONS,
- localOptions,
- new CVSTag(getRevision(), CVSTag.VERSION),
- tag,
- new ICVSRemoteResource[] { RemoteFile.this },
- monitor);
- }
- }, monitor);
- return result[0];
+ monitor = Policy.monitorFor(monitor);
+ monitor.beginTask(null, 100);
+ Session session = new Session(getRepository(), getParent(), true /* output to console */);
+ session.open(Policy.subMonitorFor(monitor, 10));
+ try {
+ return Command.RTAG.execute(
+ Command.NO_GLOBAL_OPTIONS,
+ localOptions,
+ new CVSTag(getRevision(), CVSTag.VERSION),
+ tag,
+ new ICVSRemoteResource[] { RemoteFile.this },
+ Policy.subMonitorFor(monitor, 90));
+ } finally {
+ session.close();
+ }
}
-
- public boolean updateRevision(CVSTag tag, IProgressMonitor monitor) throws CVSException {
- return parent.updateRevision(this, tag, monitor);
- }
public boolean equals(Object target) {
if (this == target)
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 850f809aa..5f83be0e4 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
@@ -29,7 +29,6 @@ import org.eclipse.team.internal.ccvs.core.CVSStatus;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
@@ -223,31 +222,34 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
// 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
- final boolean[] retry = new boolean[] {false};
- Session.run(getRepository(), this, false, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- IStatus status = Command.UPDATE.execute(
- new GlobalOption[] { Command.DO_NOT_CHANGE },
- (LocalOption[]) localOptions.toArray(new LocalOption[localOptions.size()]),
- new ICVSResource[] { child }, new UpdateListener(listener),
- monitor);
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- CVSServerException e = new CVSServerException(status);
- if (e.isNoTagException() && child.isContainer()) {
- retry[0] = true;
- } else {
- if (e.containsErrors()) {
- throw e;
- }
+ boolean retry = false;
+ Session session = new Session(getRepository(), this, false /* output to console */);
+ session.open(Policy.subMonitorFor(progress, 10));
+ try {
+ IStatus status = Command.UPDATE.execute(
+ session,
+ new GlobalOption[] { Command.DO_NOT_CHANGE },
+ (LocalOption[]) localOptions.toArray(new LocalOption[localOptions.size()]),
+ new ICVSResource[] { child }, new UpdateListener(listener),
+ Policy.subMonitorFor(progress, 70));
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ CVSServerException e = new CVSServerException(status);
+ if (e.isNoTagException() && child.isContainer()) {
+ retry = true;
+ } else {
+ if (e.containsErrors()) {
+ throw e;
}
}
}
- }, Policy.subMonitorFor(progress, 80));
+ } finally {
+ session.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)
- if (retry[0]) {
+ if (retry) {
Policy.checkCanceled(progress);
return exists(child, null, Policy.subMonitorFor(progress, 20));
}
@@ -651,66 +653,6 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
throw new CVSException(Policy.bind("RemoteResource.invalidOperation"));//$NON-NLS-1$
}
- /**
- * Update the file revision for the given child such that the revision is the one in the given branch.
- * Return true if the file exists and false otherwise
- */
- protected boolean updateRevision(final ICVSRemoteFile child, CVSTag tag, IProgressMonitor monitor) throws CVSException {
- final IProgressMonitor progress = Policy.monitorFor(monitor);
- progress.beginTask(null, 100); //$NON-NLS-1$
- ICVSRemoteResource[] oldChildren = children;
- try {
- children = new ICVSRemoteResource[] {child};
-
- // Create the listener for remote files and folders
- final boolean[] exists = new boolean[] {true};
- final IUpdateMessageListener listener = new IUpdateMessageListener() {
- public void directoryInformation(ICVSFolder parent, String path, boolean newDirectory) {
- }
- public void directoryDoesNotExist(ICVSFolder parent, String path) {
- // If we get this, we can assume that the parent directory no longer exists
- exists[0] = false;
- }
- public void fileInformation(int type, ICVSFolder parent, String filename) {
- // The file was found and has a different revision
- try {
- ((RemoteFile)parent.getChild(filename)).setWorkspaceSyncState(type);
- } catch(CVSException e) {
- exists[0] = false;
- }
- exists[0] = true;
- }
- public void fileDoesNotExist(ICVSFolder parent, String filename) {
- exists[0] = false;
- }
- };
-
- // Build the local options
- final List localOptions = new ArrayList();
- if (tag != null && tag.getType() != CVSTag.HEAD)
- localOptions.add(Update.makeTagOption(tag));
-
- // Retrieve the children and any file revision numbers in a single connection
- Session.run(getRepository(), this, false, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- // Perform a "cvs -n update -d -r tagName fileName" with custom message and error handlers
- Command.UPDATE.execute(
- new GlobalOption[] { Command.DO_NOT_CHANGE },
- (LocalOption[]) localOptions.toArray(new LocalOption[localOptions.size()]),
- new ICVSResource[] { child },
- new UpdateListener(listener),
- monitor);
- }
- }, Policy.subMonitorFor(progress, 70));
-
- if (!exists[0]) return false;
- updateFileRevisions(new ICVSFile[] {child}, Policy.subMonitorFor(progress, 30));
- return true;
- } finally {
- children = oldChildren;
- }
- }
-
/*
* @see ICVSFolder#run(ICVSRunnable, IProgressMonitor)
*/
@@ -729,19 +671,21 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
* @see ICVSFolder#tag(CVSTag, LocalOption[], IProgressMonitor)
*/
public IStatus tag(final CVSTag tag, final LocalOption[] localOptions, IProgressMonitor monitor) throws CVSException {
- final IStatus[] result = new IStatus[] { null };
- Session.run(getRepository(), this, true, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- result[0] = Command.RTAG.execute(
- Command.NO_GLOBAL_OPTIONS,
- localOptions,
- folderInfo.getTag(),
- tag,
- new ICVSRemoteResource[] { RemoteFolder.this },
- monitor);
- }
- }, monitor);
- return result[0];
+ monitor = Policy.monitorFor(monitor);
+ monitor.beginTask(null, 100);
+ Session session = new Session(getRepository(), this, true /* output to console */);
+ session.open(Policy.subMonitorFor(monitor, 10));
+ try {
+ return Command.RTAG.execute(
+ Command.NO_GLOBAL_OPTIONS,
+ localOptions,
+ folderInfo.getTag(),
+ tag,
+ new ICVSRemoteResource[] { RemoteFolder.this },
+ Policy.subMonitorFor(monitor, 90));
+ } finally {
+ session.close();
+ }
}
/**
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java
index 0b746d236..c82b3a125 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java
@@ -30,7 +30,6 @@ import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.CommandOutputListener;
import org.eclipse.team.internal.ccvs.core.client.Log;
@@ -176,28 +175,32 @@ public class RestoreFromRepositoryAction extends CVSAction {
* Fetch the RCS paths (minus the Attic segment) of all files in the Attic.
* This path includes the repository root path.
*/
- private ICVSFile[] fetchFilesInAttic(ICVSRepositoryLocation location, final ICVSFolder parent, IProgressMonitor monitor) throws CVSException {
- final AtticLogListener listener = new AtticLogListener();
- Session.run(location, parent, false, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100);
- QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
- try {
- CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
- IStatus status = Command.LOG.execute(Command.NO_GLOBAL_OPTIONS,
- new LocalOption[] { Log.RCS_FILE_NAMES_ONLY },
- new ICVSResource[] { parent }, listener,
- Policy.subMonitorFor(monitor, 100));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- CVSProviderPlugin.getPlugin().setQuietness(quietness);
- monitor.done();
+ private ICVSFile[] fetchFilesInAttic(ICVSRepositoryLocation location, ICVSFolder parent, IProgressMonitor monitor) throws CVSException {
+ monitor = Policy.monitorFor(monitor);
+ monitor.beginTask(null, 100);
+ AtticLogListener listener = new AtticLogListener();
+ Session session = new Session(location, parent, true /* output to console */);
+ session.open(Policy.subMonitorFor(monitor, 10));
+ try {
+ QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
+ try {
+ CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
+ IStatus status = Command.LOG.execute(
+ session,
+ Command.NO_GLOBAL_OPTIONS,
+ new LocalOption[] { Log.RCS_FILE_NAMES_ONLY },
+ new ICVSResource[] { parent }, listener,
+ Policy.subMonitorFor(monitor, 90));
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ throw new CVSServerException(status);
}
+ } finally {
+ CVSProviderPlugin.getPlugin().setQuietness(quietness);
+ monitor.done();
}
- }, monitor);
+ } finally {
+ session.close();
+ }
return listener.getAtticFilePaths();
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
index a6a0eb624..eb6830676 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
@@ -26,7 +26,6 @@ import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.client.Annotate;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Session;
@@ -109,35 +108,39 @@ public class ShowAnnotationAction extends CVSAction {
private void fetchAnnotation(final AnnotateListener listener, final ICVSResource cvsResource, final String revision, IProgressMonitor monitor) throws InvocationTargetException {
try {
+ monitor = Policy.monitorFor(monitor);
+ monitor.beginTask(null, 100);
ICVSFolder folder = cvsResource.getParent();
final FolderSyncInfo info = folder.getFolderSyncInfo();
ICVSRepositoryLocation location = CVSProviderPlugin.getPlugin().getRepository(info.getRoot());
- Session.run(location, folder, false, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100);
- Command.QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
- try {
- CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
- final Command.LocalOption[] localOption;
- if (revision == null) {
- localOption = Command.NO_LOCAL_OPTIONS;
- } else {
- localOption = new Command.LocalOption[1];
- localOption[0] = Annotate.makeRevisionOption(revision);
- }
- IStatus status = Command.ANNOTATE.execute(Command.NO_GLOBAL_OPTIONS,
- localOption, new ICVSResource[] { cvsResource }, listener,
- Policy.subMonitorFor(monitor, 100));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- CVSProviderPlugin.getPlugin().setQuietness(quietness);
- monitor.done();
+ Session session = new Session(location, folder, true /* output to console */);
+ session.open(Policy.subMonitorFor(monitor, 10));
+ try {
+ Command.QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
+ try {
+ CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
+ final Command.LocalOption[] localOption;
+ if (revision == null) {
+ localOption = Command.NO_LOCAL_OPTIONS;
+ } else {
+ localOption = new Command.LocalOption[1];
+ localOption[0] = Annotate.makeRevisionOption(revision);
+ }
+ IStatus status = Command.ANNOTATE.execute(
+ session,
+ Command.NO_GLOBAL_OPTIONS,
+ localOption, new ICVSResource[] { cvsResource }, listener,
+ Policy.subMonitorFor(monitor, 90));
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ throw new CVSServerException(status);
}
+ } finally {
+ CVSProviderPlugin.getPlugin().setQuietness(quietness);
+ monitor.done();
}
- }, monitor);
+ } finally {
+ session.close();
+ }
} catch (CVSException e) {
throw new InvocationTargetException(e);
}

Back to the top