use of org.tigris.subversion.subclipse.core.SVNTeamProvider 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.SVNTeamProvider in project subclipse by subclipse.
the class SVNWorkspaceSubscriber method refresh.
/* (non-Javadoc)
* @see org.eclipse.team.core.subscribers.Subscriber#refresh(org.eclipse.core.resources.IResource[], int, org.eclipse.core.runtime.IProgressMonitor)
*/
public void refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
monitor = Policy.monitorFor(monitor);
List<IStatus> errors = new ArrayList<IStatus>();
try {
monitor.beginTask("", 1000 * resources.length);
for (IResource resource : resources) {
// Make certain that resource is still connected with SVN. When
// Synch is on a schedule it is possible for the project to become disconnected
SVNTeamProvider teamProvider = (SVNTeamProvider) RepositoryProvider.getProvider(resource.getProject(), SVNProviderPlugin.getTypeId());
if (teamProvider != null) {
monitor.subTask(resource.getName());
IStatus status = refresh(resource, depth, monitor);
if (!status.isOK()) {
errors.add(status);
}
}
}
} finally {
monitor.done();
}
if (!errors.isEmpty()) {
int numSuccess = resources.length - errors.size();
throw new TeamException(new MultiStatus(SVNProviderPlugin.ID, 0, (IStatus[]) errors.toArray(new IStatus[errors.size()]), Policy.bind("SVNWorkspaceSubscriber.errorWhileSynchronizing.1", new Object[] { getName(), Integer.toString(numSuccess), Integer.toString(resources.length) }), // $NON-NLS-1$
null));
}
}
use of org.tigris.subversion.subclipse.core.SVNTeamProvider in project subclipse by subclipse.
the class SVNPropertyPage method getStatus.
private void getStatus() {
ISVNRepositoryLocation repository = null;
ISVNClientAdapter svnClient = null;
try {
IResource resource = (IResource) getElement();
SVNTeamProvider svnProvider = (SVNTeamProvider) RepositoryProvider.getProvider(resource.getProject(), SVNProviderPlugin.getTypeId());
if (svnProvider == null)
return;
svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
if (svnResource == null)
return;
status = svnResource.getStatus();
if (status != null && !status.isIgnored()) {
repository = svnResource.getRepository();
svnClient = repository.getSVNClient();
ISVNInfo info = svnClient.getInfoFromWorkingCopy(svnResource.getFile());
urlCopiedFrom = info.getCopyUrl();
revision = svnResource.getRevision();
lockOwnerText = status.getLockOwner();
lockCommentText = status.getLockComment();
if (status.getLockCreationDate() != null)
lockDateText = status.getLockCreationDate().toString();
if (!status.isAdded()) {
try {
info = svnClient.getInfo(status.getUrl());
} catch (Exception e) {
}
}
// Get lock information from server if svn:needs-lock property is set
if (info != null && status.getLockOwner() == null && status.getUrlString() != null) {
ISVNProperty prop = svnResource.getSvnProperty("svn:needs-lock");
if (prop != null) {
lockOwnerText = info.getLockOwner();
if (info.getLockCreationDate() != null)
lockDateText = info.getLockCreationDate().toString();
lockCommentText = info.getLockComment();
}
}
}
} catch (Exception e) {
SVNUIPlugin.log(new Status(IStatus.ERROR, SVNUIPlugin.ID, TeamException.UNABLE, "Property Exception", // $NON-NLS-1$
e));
} finally {
if (repository != null) {
repository.returnSVNClient(svnClient);
}
}
}
use of org.tigris.subversion.subclipse.core.SVNTeamProvider in project subclipse by subclipse.
the class GenerateDiffFileSynchronizeOperation method run.
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
SyncInfoSet syncSet = getSyncInfoSet();
final Map projectSyncInfos = getProjectSyncInfoSetMap(syncSet);
Iterator iter = projectSyncInfos.keySet().iterator();
final IProject project = (IProject) iter.next();
SVNTeamProvider provider = (SVNTeamProvider) RepositoryProvider.getProvider(project, SVNUIPlugin.PROVIDER_ID);
monitor.beginTask(null, projectSyncInfos.size() * 100);
run(provider, syncSet, Policy.subMonitorFor(monitor, 100));
monitor.done();
}
use of org.tigris.subversion.subclipse.core.SVNTeamProvider in project subclipse by subclipse.
the class RepositoryProviderOperation method execute.
/* (non-Javadoc)
* @see org.eclipse.team.internal.cSVN.ui.operations.SVNOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
*/
public void execute(IProgressMonitor monitor) throws SVNException, InterruptedException {
Map table = getProviderMapping(getResources());
Set keySet = table.keySet();
monitor.beginTask(null, keySet.size() * 1000);
Iterator iterator = keySet.iterator();
while (iterator.hasNext()) {
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
SVNTeamProvider provider = (SVNTeamProvider) iterator.next();
List list = (List) table.get(provider);
IResource[] providerResources = (IResource[]) list.toArray(new IResource[list.size()]);
ISchedulingRule rule = getSchedulingRule(provider);
try {
Job.getJobManager().beginRule(rule, monitor);
monitor.setTaskName(getTaskName(provider));
execute(provider, providerResources, subMonitor);
} finally {
Job.getJobManager().endRule(rule);
}
}
}
Aggregations