Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2007-02-13 18:57:33 +0000
committerMichael Valenta2007-02-13 18:57:33 +0000
commitbdbd1d603ee27c8a31d8ff69bb456fd318d01e34 (patch)
tree353d53454aafa901cc8e32ce0d1c7d8aa2b2c459 /bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources
parent3a429c5aa49104a479ab2a533a773ec2dc5791c4 (diff)
downloadeclipse.platform.team-bdbd1d603ee27c8a31d8ff69bb456fd318d01e34.tar.gz
eclipse.platform.team-bdbd1d603ee27c8a31d8ff69bb456fd318d01e34.tar.xz
eclipse.platform.team-bdbd1d603ee27c8a31d8ff69bb456fd318d01e34.zip
Bug 171666 [Commands] Could we have CVSStatus as an API ?
Diffstat (limited to 'bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources')
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSEntryLineTag.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java7
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java26
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java27
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java3
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java9
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java6
8 files changed, 54 insertions, 31 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSEntryLineTag.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSEntryLineTag.java
index 30e7cf184..59a6aba4a 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSEntryLineTag.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSEntryLineTag.java
@@ -15,6 +15,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.internal.ccvs.core.*;
public class CVSEntryLineTag extends CVSTag {
@@ -61,7 +62,7 @@ public class CVSEntryLineTag extends CVSTag {
entryLineDateTagFormatter.setTimeZone(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$
return entryLineDateTagFormatter.parse(text);
} catch (ParseException e) {
- CVSProviderPlugin.log(new CVSException("Tag name " + text + " is not of the expected format " + ENTRY_LINE_DATE_TAG_FORMAT, e)); //$NON-NLS-1$ //$NON-NLS-2$
+ CVSProviderPlugin.log(new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, "Tag name " + text + " is not of the expected format " + ENTRY_LINE_DATE_TAG_FORMAT, e)); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
index e9f1605d3..55c34f47d 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
@@ -100,7 +100,7 @@ public class CVSWorkspaceRoot {
// parent handle. If this is the case, isManaged should return false
// now. If it doesn't, then we should log an error.
if (resource.isManaged()) {
- CVSProviderPlugin.log(new CVSException(NLS.bind(CVSMessages.CVSWorkspaceRoot_11, new String[] { Util.getFullestPath(resource) })));
+ CVSProviderPlugin.log(new CVSStatus(IStatus.ERROR,CVSStatus.ERROR, NLS.bind(CVSMessages.CVSWorkspaceRoot_11, new String[] { Util.getFullestPath(resource) }),resource.getIResource()));
}
} else {
return RemoteFile.getBase(parent, (ICVSFile)resource);
@@ -133,7 +133,7 @@ public class CVSWorkspaceRoot {
}
// The types need to match or we're in trouble
if (remote != null && !(remote.isContainer() == managed.isFolder()))
- throw new CVSException(new CVSStatus(IStatus.ERROR, NLS.bind(CVSMessages.CVSTeamProvider_typesDiffer, new String[] { resource.getFullPath().toString() }), null));
+ throw new CVSException(new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(CVSMessages.CVSTeamProvider_typesDiffer, new String[] { resource.getFullPath().toString() }), resource));
}
return remote;
}
@@ -207,7 +207,8 @@ public class CVSWorkspaceRoot {
public ICVSRepositoryLocation getRemoteLocation() throws CVSException {
FolderSyncInfo info = localRoot.getFolderSyncInfo();
if (info == null) {
- throw new CVSException(NLS.bind(CVSMessages.CVSWorkspaceRoot_notCVSFolder, new String[] { localRoot.getName() }));
+ IStatus status = new CVSStatus(IStatus.ERROR,CVSStatus.RESOURCE_SYNC_INFO_ERROR,NLS.bind(CVSMessages.CVSWorkspaceRoot_notCVSFolder, new String[] { localRoot.getName() }),localRoot);
+ throw new CVSException(status);
}
return KnownRepositories.getInstance().getRepository(info.getRoot());
}
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 7baff35b1..f26923d40 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
@@ -20,6 +20,7 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.Util;
+
/**
* Represents handles to CVS resource on the local file system. Synchronization
* information is taken from the CVS subdirectories.
@@ -61,7 +62,8 @@ abstract class EclipseResource implements ICVSResource, Comparable {
if (result.length() == 0) return CURRENT_LOCAL_FOLDER;
return result;
} catch (ClassCastException e) {
- throw new CVSException(CVSMessages.EclipseResource_invalidResourceClass, e);
+ IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, CVSMessages.EclipseResource_invalidResourceClass, e, root);
+ throw new CVSException(status);
}
}
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 ad87f79e8..3963f1eb7 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
@@ -64,14 +64,14 @@ public class EclipseSynchronizer implements IFlushOperation {
private static EclipseSynchronizer instance;
// track resources that have changed in a given operation
- private ILock lock = Platform.getJobManager().newLock();
+ private ILock lock = Job.getJobManager().newLock();
private ReentrantLock resourceLock = new ReentrantLock();
private SynchronizerSyncInfoCache synchronizerCache = new SynchronizerSyncInfoCache();
private SessionPropertySyncInfoCache sessionPropertyCache = new SessionPropertySyncInfoCache(synchronizerCache);
/*
- * Package private contructor to allow specialized subclass for handling folder deletions
+ * Package private constructor to allow specialized subclass for handling folder deletions
*/
EclipseSynchronizer() {
}
@@ -87,7 +87,7 @@ public class EclipseSynchronizer implements IFlushOperation {
}
public SyncInfoCache getSyncInfoCacheFor(IResource resource) {
- if (resource.exists() && resource.isLocal(IResource.DEPTH_ZERO)) {
+ if (resource.exists()) {
return sessionPropertyCache;
} else {
return synchronizerCache;
@@ -115,8 +115,9 @@ public class EclipseSynchronizer implements IFlushOperation {
// Allow the set if the parent is a CVS folder since
// this can occur when creating phantom folders
if (getFolderSync(folder.getParent()) == null) {
- throw new CVSException(IStatus.ERROR, TeamException.UNABLE,
- NLS.bind(CVSMessages.EclipseSynchronizer_ErrorSettingFolderSync, new String[] { folder.getFullPath().toString() }));
+ IStatus status = new CVSStatus(IStatus.ERROR, TeamException.UNABLE,
+ NLS.bind(CVSMessages.EclipseSynchronizer_ErrorSettingFolderSync, new String[] { folder.getFullPath().toString() }),folder);
+ throw new CVSException(status);
}
}
ISchedulingRule rule = null;
@@ -220,8 +221,9 @@ public class EclipseSynchronizer implements IFlushOperation {
Assert.isNotNull(info); // enforce the use of deleteResourceSync
IContainer parent = resource.getParent();
if (parent == null || parent.getType() == IResource.ROOT || !isValid(parent)) {
- throw new CVSException(IStatus.ERROR, TeamException.UNABLE,
- NLS.bind(CVSMessages.EclipseSynchronizer_ErrorSettingResourceSync, new String[] { resource.getFullPath().toString() }));
+ IStatus status = new CVSStatus(IStatus.ERROR, TeamException.UNABLE,
+ NLS.bind(CVSMessages.EclipseSynchronizer_ErrorSettingResourceSync, new String[] { resource.getFullPath().toString() }), resource);
+ throw new CVSException(status);
}
ISchedulingRule rule = null;
try {
@@ -302,8 +304,9 @@ public class EclipseSynchronizer implements IFlushOperation {
Assert.isNotNull(syncBytes); // enforce the use of deleteResourceSync
IContainer parent = resource.getParent();
if (parent == null || parent.getType() == IResource.ROOT || !isValid(parent)) {
- throw new CVSException(IStatus.ERROR, TeamException.UNABLE,
- NLS.bind(CVSMessages.EclipseSynchronizer_ErrorSettingResourceSync, new String[] { resource.getFullPath().toString() }));
+ IStatus status = new CVSStatus(IStatus.ERROR, TeamException.UNABLE,
+ NLS.bind(CVSMessages.EclipseSynchronizer_ErrorSettingResourceSync, new String[] { resource.getFullPath().toString() }),resource);
+ throw new CVSException(status);
}
ISchedulingRule rule = null;
try {
@@ -393,8 +396,9 @@ public class EclipseSynchronizer implements IFlushOperation {
*/
public void addIgnored(IContainer folder, String pattern) throws CVSException {
if (folder.getType() == IResource.ROOT || ! folder.exists()) {
- throw new CVSException(IStatus.ERROR, TeamException.UNABLE,
- NLS.bind(CVSMessages.EclipseSynchronizer_ErrorSettingIgnorePattern, new String[] { folder.getFullPath().toString() }));
+ IStatus status = new CVSStatus(IStatus.ERROR, TeamException.UNABLE,
+ NLS.bind(CVSMessages.EclipseSynchronizer_ErrorSettingIgnorePattern, new String[] { folder.getFullPath().toString() }),folder);
+ throw new CVSException(status);
}
ISchedulingRule rule = null;
try {
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 b3ed9eb4d..b71e37135 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
@@ -261,7 +261,8 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
ICVSResource child = getChild(name);
if (child.isFolder())
return (ICVSFolder)child;
- throw new CVSException(IStatus.ERROR, CHILD_DOES_NOT_EXIST, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { name, getName() }));
+ IStatus status = new CVSStatus(IStatus.ERROR, CHILD_DOES_NOT_EXIST, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { name, getName() }),child.getIResource());
+ throw new CVSException(status);
}
/**
@@ -271,7 +272,8 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
ICVSResource child = getChild(name);
if (!child.isFolder())
return (ICVSFile)child;
- throw new CVSException(IStatus.ERROR, CHILD_DOES_NOT_EXIST, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { name, getName() }));
+ IStatus status = new CVSStatus(IStatus.ERROR, CHILD_DOES_NOT_EXIST, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { name, getName() }),child.getIResource());
+ throw new CVSException(status);
}
public LocalOption[] getLocalOptions() {
@@ -291,7 +293,8 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
if (ancestor == this) return Session.CURRENT_LOCAL_FOLDER;
// Otherwise, we need a parent to continue
if (parent == null) {
- throw new CVSException(NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { getName(), ancestor.getName() }));
+ IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { getName(), ancestor.getName() }),this);
+ throw new CVSException(status);
}
return super.getRelativePath(ancestor);
}
@@ -341,25 +344,30 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
return ((RemoteFolder)getChild(p.segment(0))).getChild(p.removeFirstSegments(1).toString());
} catch (CVSException e) {
// regenerate the exception to give as much info as possible
- throw new CVSException(IStatus.ERROR, CHILD_DOES_NOT_EXIST, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { path, getName() }));
+ IStatus status = new CVSStatus(IStatus.ERROR, CHILD_DOES_NOT_EXIST, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { path, getName() }),e,repository);
+ throw new CVSException(status);
}
} else {
ICVSRemoteResource[] children = getChildren();
- if (children == null)
- throw new CVSException(IStatus.ERROR, CHILD_DOES_NOT_EXIST, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { path, getName() }));
+ if (children == null){
+ IStatus status = new CVSStatus(IStatus.ERROR, CHILD_DOES_NOT_EXIST, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { path, getName() }),repository);
+ throw new CVSException(status);
+ }
for (int i=0;i<children.length;i++) {
if (children[i].getName().equals(path))
return children[i];
}
}
- throw new CVSException(IStatus.ERROR, CHILD_DOES_NOT_EXIST, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { path, getName() }));
+ IStatus status = new CVSStatus(IStatus.ERROR, CHILD_DOES_NOT_EXIST, NLS.bind(CVSMessages.RemoteFolder_invalidChild, new String[] { path, getName() }),repository);
+ throw new CVSException(status);
}
/**
* @see ICVSFolder#mkdir()
*/
public void mkdir() throws CVSException {
- throw new CVSException(CVSMessages.RemoteResource_invalidOperation);
+ IStatus status = new CVSStatus(IStatus.ERROR, CVSMessages.RemoteResource_invalidOperation);
+ throw new CVSException(status);
}
/**
@@ -396,7 +404,8 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
* @see ICVSFolder#acceptChildren(ICVSResourceVisitor)
*/
public void acceptChildren(ICVSResourceVisitor visitor) throws CVSException {
- throw new CVSException(CVSMessages.RemoteResource_invalidOperation);
+ IStatus status = new CVSStatus(IStatus.ERROR, CVSMessages.RemoteResource_invalidOperation);
+ throw new CVSException(status);
}
/*
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java
index 03eefd611..17eb23724 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java
@@ -151,7 +151,8 @@ public class RemoteFolderMemberFetcher implements IUpdateMessageListener, IStatu
}
}
if (!exists) {
- throw new CVSException(new CVSStatus(IStatus.ERROR, CVSStatus.DOES_NOT_EXIST, NLS.bind(CVSMessages.RemoteFolder_doesNotExist, new String[] { this.parentFolder.getRepositoryRelativePath() })));
+ IStatus notExistStatus = new CVSStatus(IStatus.ERROR, CVSStatus.DOES_NOT_EXIST, NLS.bind(CVSMessages.RemoteFolder_doesNotExist, new String[] { this.parentFolder.getRepositoryRelativePath() }), parentFolder);
+ throw new CVSException(notExistStatus);
}
// Report any internal exceptions that occured fetching the members
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
index d3e41fe62..235ea8877 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
@@ -197,7 +197,8 @@ public class RemoteFolderTreeBuilder {
// We cannot handle the case where a project (i.e. the top-most CVS folder)
// has been deleted directly on the sever (i.e. deleted using rm -rf)
if (root.isCVSFolder() && ! root.isManaged()) {
- throw new CVSException(NLS.bind(CVSMessages.RemoteFolderTreeBuild_folderDeletedFromServer, new String[] { root.getFolderSyncInfo().getRepository() }));
+ IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(CVSMessages.RemoteFolderTreeBuild_folderDeletedFromServer, new String[] { root.getFolderSyncInfo().getRepository() }),root);
+ throw new CVSException(status);
} else {
return false;
}
@@ -226,7 +227,8 @@ public class RemoteFolderTreeBuilder {
} else {
path = resource.getFullPath().toString();
}
- throw new CVSException(NLS.bind(CVSMessages.RemoteFolderTreeBuilder_0, new String[] { path }));
+ IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(CVSMessages.RemoteFolderTreeBuilder_0, new String[] { path }), root);
+ throw new CVSException(status);
} else {
// Just return. The remote tree will be null
return;
@@ -775,7 +777,8 @@ public class RemoteFolderTreeBuilder {
private void updateRevision(String path, String revision) throws CVSException {
RemoteFolderTree folder = getRecoredRemoteFolder(Util.removeLastSegment(path));
if (folder == null) {
- throw new CVSException(NLS.bind(CVSMessages.RemoteFolderTreeBuilder_missingParent, new String[] { path.toString(), revision }));
+ IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(CVSMessages.RemoteFolderTreeBuilder_missingParent, new String[] { path.toString(), revision }), root);
+ throw new CVSException(status);
}
((RemoteFile)folder.getFile(Util.getLastSegment(path))).setRevision(revision);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java
index 6941a5f52..8f48147b3 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java
@@ -125,8 +125,10 @@ import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;
if (info == null) {
// There should be sync info but it was missing. Report the error.
// Only report the error is the folder is not derived (see bug 97023)
- if (container.exists() && !container.isDerived())
- throw new CVSException(NLS.bind(CVSMessages.EclipseSynchronizer_folderSyncInfoMissing, new String[] { container.getFullPath().toString() }));
+ if (container.exists() && !container.isDerived()){
+ IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(CVSMessages.EclipseSynchronizer_folderSyncInfoMissing, new String[] { container.getFullPath().toString() }), container);
+ throw new CVSException(status);
+ }
}
if (info == NULL_FOLDER_SYNC_INFO) return null;
return info;

Back to the top