use of org.tigris.subversion.subclipse.core.ISVNLocalFolder in project subclipse by subclipse.
the class UnmanageAction method getOperation.
/**
* get the WorkspaceModifyOperation. The operation will : - delete svn directories if this option
* has been chosen - unmap the project
*
* @return
*/
private IRunnableWithProgress getOperation() {
return new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InvocationTargetException {
try {
// maps the selected resources (projects) to their providers
Hashtable table = getProviderMapping(getSelectedResources());
Set keySet = table.keySet();
// $NON-NLS-1$
monitor.beginTask("", keySet.size() * 1000);
// $NON-NLS-1$
monitor.setTaskName(Policy.bind("Unmanage.unmanaging"));
Iterator iterator = keySet.iterator();
while (iterator.hasNext()) {
IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1000);
subMonitor.beginTask(null, 100);
SVNTeamProvider provider = (SVNTeamProvider) iterator.next();
// get the resources (projects) to unmanage for the given provider
List list = (List) table.get(provider);
IResource[] providerResources = (IResource[]) list.toArray(new IResource[list.size()]);
for (int i = 0; i < providerResources.length; i++) {
// get the folder for the project
IResource resource = providerResources[i];
ISVNLocalFolder folder = SVNWorkspaceRoot.getSVNFolderFor((IContainer) resource);
try {
if (deleteContent) {
folder.unmanage(Policy.subMonitorFor(subMonitor, 10));
}
} finally {
// We want to remove the nature even if the unmanage operation fails
RepositoryProvider.unmap((IProject) resource);
}
}
}
} catch (TeamException e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
}
}
};
}
use of org.tigris.subversion.subclipse.core.ISVNLocalFolder in project subclipse by subclipse.
the class SVNMoveDeleteHook method moveFolder.
public boolean moveFolder(IResourceTree tree, IFolder source, IFolder destination, int updateFlags, IProgressMonitor monitor) {
if (SVNWorkspaceRoot.isLinkedResource(source))
return false;
try {
ISVNLocalFolder resource = new LocalFolder(source);
if (!resource.isManaged())
return false;
RepositoryProvider repositoryProvider = RepositoryProvider.getProvider(destination.getProject());
if (repositoryProvider == null || // target is not SVN project
!(repositoryProvider instanceof SVNTeamProvider))
return false;
ISVNRepositoryLocation sourceRepository = resource.getRepository();
ISVNLocalResource parent = SVNWorkspaceRoot.getSVNResourceFor(destination.getParent());
ISVNRepositoryLocation targetRepository = parent.getRepository();
if (!sourceRepository.equals(targetRepository)) {
return false;
}
monitor.beginTask(null, 1000);
ISVNClientAdapter svnClient = sourceRepository.getSVNClient();
try {
OperationManager.getInstance().beginOperation(svnClient);
// see bug #15
if (!SVNWorkspaceRoot.getSVNFolderFor(destination.getParent()).isManaged()) {
SVNTeamProvider provider = (SVNTeamProvider) repositoryProvider;
provider.add(new IResource[] { destination.getParent() }, IResource.DEPTH_ZERO, new NullProgressMonitor());
if (parent != null)
parent.refreshStatus();
}
svnClient.move(source.getLocation().toFile(), destination.getLocation().toFile(), true);
tree.movedFolderSubtree(source, destination);
destination.refreshLocal(IResource.DEPTH_INFINITE, monitor);
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
} catch (CoreException e) {
throw SVNException.wrapException(e);
} finally {
resource.getRepository().returnSVNClient(svnClient);
OperationManager.getInstance().endOperation(false);
}
} catch (SVNException e) {
tree.failed(e.getStatus());
} finally {
monitor.done();
}
return true;
}
use of org.tigris.subversion.subclipse.core.ISVNLocalFolder in project subclipse by subclipse.
the class LocalResource method isIgnored.
/* (non-Javadoc)
* @see org.tigris.subversion.subclipse.core.ISVNLocalResource#isIgnored()
*/
@SuppressWarnings("deprecation")
public boolean isIgnored() throws SVNException {
// If the resource is a team private or linked resource, it is ignored
if (resource.isTeamPrivateMember() || resource.isLinked()) {
return true;
}
// always ignore .svn folder
if ((resource.getType() == IResource.FOLDER) && SVNProviderPlugin.getPlugin().isAdminDirectory(getName())) {
// $NON-NLS-1$
return true;
}
if (resource.getType() == IResource.ROOT || resource.getType() == IResource.PROJECT) {
return false;
}
if (isParentInSvnIgnore()) {
return true;
}
if (hasSymlinkParent()) {
return true;
}
LocalResourceStatus status = getStatusFromCache();
// managed derived resources.
if (resource.isDerived()) {
if (SVNProviderPlugin.getPlugin().getPluginPreferences().getBoolean(ISVNCoreConstants.PREF_IGNORE_MANAGED_DERIVED_RESOURCES) || !status.isManaged()) {
return true;
}
}
// a managed resource is never ignored
if (status.isManaged()) {
return false;
}
// check ignore patterns from the .cvsignore file.
if (status.isIgnored()) {
return true;
}
// check the global ignores from Team
if (Team.isIgnoredHint(resource)) {
return true;
}
// check the parent, if the parent is ignored
// then this resource is ignored also
ISVNLocalFolder parent = getParent();
if (parent == null) {
return false;
}
if (parent.isIgnored()) {
return true;
}
return false;
}
use of org.tigris.subversion.subclipse.core.ISVNLocalFolder in project subclipse by subclipse.
the class Util method getParentUrl.
/**
* Get the url string of the parent resource
*
* @param svnResource
* @return parent's url, null if none of parents has an url
* @throws SVNException
*/
public static String getParentUrl(ISVNLocalResource svnResource) throws SVNException {
ISVNLocalFolder parent = svnResource.getParent();
while (parent != null) {
String url = parent.getStatus().getUrlString();
if (url != null)
return url;
parent = parent.getParent();
}
return null;
}
Aggregations