use of org.tigris.subversion.subclipse.core.SVNException in project subclipse by subclipse.
the class SVNMoveDeleteHook method deleteFolder.
public boolean deleteFolder(IResourceTree tree, IFolder folder, int updateFlags, IProgressMonitor monitor) {
if (SVNWorkspaceRoot.isLinkedResource(folder))
return false;
ISVNLocalFolder resource = new LocalFolder(folder);
try {
if (!resource.isManaged()) {
return false;
}
monitor.beginTask(null, 1000);
deleteResource(resource);
tree.deletedFolder(folder);
} catch (SVNException e) {
tree.failed(e.getStatus());
} finally {
monitor.done();
}
return true;
}
use of org.tigris.subversion.subclipse.core.SVNException in project subclipse by subclipse.
the class SVNMoveDeleteHook method getDeferFileDelete.
// Get the DeferFileDelete Property for selected resource.
private boolean getDeferFileDelete(IResource resource) {
ISVNProperty property = null;
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
ISVNLocalResource parent = svnResource;
try {
while (parent != null) {
if (parent.isManaged()) {
break;
}
parent = parent.getParent();
}
if (parent == null || !parent.isManaged()) {
return false;
}
ISVNProperty[] deferFileDeleteProperties = parent.getPropertiesIncludingInherited(false, true, deferFileDeleteFilterList);
if (deferFileDeleteProperties != null && deferFileDeleteProperties.length > 0) {
return deferFileDeleteProperties[0].getValue().equalsIgnoreCase("true");
}
} catch (SVNException e) {
return false;
}
return false;
}
use of org.tigris.subversion.subclipse.core.SVNException in project subclipse by subclipse.
the class SVNWorkspaceRoot method getRepositoryFor.
/**
* Gets the repository which the local filesystem <code>location</code> belongs to.
*/
public static ISVNRepositoryLocation getRepositoryFor(IPath location) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject[] projects = root.getProjects();
for (IProject project : projects) {
if (SVNWorkspaceRoot.isManagedBySubclipse(project) && project.getLocation().isPrefixOf(location)) {
try {
SVNTeamProvider teamProvider = (SVNTeamProvider) RepositoryProvider.getProvider(project, SVNProviderPlugin.getTypeId());
return teamProvider.getSVNWorkspaceRoot().getRepository();
} catch (SVNException e) {
// an exception is thrown when resource is not managed
SVNProviderPlugin.log(e);
return null;
}
}
}
return null;
}
use of org.tigris.subversion.subclipse.core.SVNException in project subclipse by subclipse.
the class FileModificationManager method refreshStatus.
/**
* Refresh (reset/reload) the status of all the given resources.
*
* @param resources Array of IResources to refresh
*/
private void refreshStatus(IResource[] resources) {
// We are not able to get the status for a single file anyway,
// so from the performance reasons we collect the parent folders of the files
// and we refresh only those folders then.
// All immediate child resources (files) are refreshed automatically
Set<IContainer> foldersToRefresh = new HashSet<IContainer>(resources.length);
for (IResource resource : resources) {
if (resources.length == 1 && resources[0].getType() == IResource.FILE) {
try {
SVNProviderPlugin.getPlugin().getStatusCacheManager().refreshStatus(resource, false);
} catch (SVNException e) {
SVNProviderPlugin.log(IStatus.ERROR, e.getMessage(), e);
}
} else {
if (resource.getType() == IResource.FILE) {
foldersToRefresh.add(resource.getParent());
} else {
foldersToRefresh.add((IContainer) resource);
}
}
}
refreshStatusInfinite(foldersToRefresh);
}
use of org.tigris.subversion.subclipse.core.SVNException in project subclipse by subclipse.
the class FileModificationManager method refreshStatusInfinite.
/**
* Refresh (reset/reload) the status of all the given resources.
*
* @param resources List of IResource to refresh
*/
private void refreshStatusInfinite(Collection<? extends IResource> resources) {
Set<IResource> alreadyRefreshedResources = new HashSet<IResource>();
for (IResource resource : resources) {
if (!alreadyRefreshedResources.contains(resource)) {
try {
IResource[] refreshedResources = SVNProviderPlugin.getPlugin().getStatusCacheManager().refreshStatus(resource, true);
alreadyRefreshedResources.addAll(Arrays.asList(refreshedResources));
} catch (SVNException e) {
SVNProviderPlugin.log(IStatus.ERROR, e.getMessage(), e);
}
}
}
}
Aggregations