use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation 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.ISVNRepositoryLocation in project subclipse by subclipse.
the class ShowDifferencesAsUnifiedDiffOperation method execute.
protected void execute(IProgressMonitor monitor) throws SVNException, InterruptedException {
ISVNClientAdapter client = null;
ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(fromUrl.toString());
if (repository != null)
client = repository.getSVNClient();
if (client == null)
client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
try {
SVNRevision pegRevision = null;
if (fromUrl.toString().equals(toUrl.toString()) && localResource != null) {
if (localResource.getResource() == null)
pegRevision = SVNRevision.HEAD;
else {
IResource resource = localResource.getResource();
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
pegRevision = svnResource.getRevision();
}
}
if (pegRevision == null)
client.diff(fromUrl, fromRevision, toUrl, toRevision, file, true);
else
client.diff(fromUrl, pegRevision, fromRevision, toRevision, file, true);
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
} finally {
monitor.done();
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
}
use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class ShowDifferencesAsUnifiedDiffOperationWC method execute.
protected void execute(IProgressMonitor monitor) throws SVNException, InterruptedException {
ISVNClientAdapter client = null;
ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(toUrl.toString());
if (repository != null)
client = repository.getSVNClient();
if (client == null)
client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
try {
client.diff(path, toUrl, toRevision, file, true);
if (monitor.isCanceled())
canceled = true;
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
} finally {
monitor.done();
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
}
use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class RemoveRootAction method run.
public void run() {
ISVNRepositoryLocation[] roots = getSelectedRemoteRoots();
if (roots.length == 0)
return;
SVNProviderPlugin provider = SVNProviderPlugin.getPlugin();
for (int i = 0; i < roots.length; i++) {
try {
// Check if any projects are shared with the repository
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
final ArrayList shared = new ArrayList();
for (int j = 0; j < projects.length; j++) {
RepositoryProvider teamProvider = RepositoryProvider.getProvider(projects[j], SVNProviderPlugin.getTypeId());
if (teamProvider != null) {
try {
SVNTeamProvider svnProvider = (SVNTeamProvider) teamProvider;
if (svnProvider.getSVNWorkspaceRoot().getRepository().equals(roots[i])) {
shared.add(projects[j]);
}
} catch (Exception e) {
// Don't let any exception prevent from
// continuing
}
}
}
// This will notify the RepositoryManager of the removal
if (!shared.isEmpty()) {
final String location = roots[i].getLocation();
shell.getDisplay().syncExec(new Runnable() {
public void run() {
DetailsDialogWithProjects dialog = new DetailsDialogWithProjects(shell, Policy.bind(// $NON-NLS-1$
"RemoteRootAction.Unable_to_Discard_Location_1"), Policy.bind("RemoteRootAction.Projects_in_the_local_workspace_are_shared_with__2", // $NON-NLS-1$
location), Policy.bind(// $NON-NLS-1$
"RemoteRootAction.The_projects_that_are_shared_with_the_above_repository_are__4"), (IProject[]) shared.toArray(new IProject[shared.size()]), false, SVNUIPlugin.getStandardDisplay().getSystemImage(SWT.ICON_ERROR));
dialog.open();
}
});
} else {
provider.getRepositories().disposeRepository(roots[i]);
}
} catch (SVNException e) {
SVNUIPlugin.openError(shell, null, null, e);
SVNUIPlugin.log(e);
}
}
}
use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class RepositoriesView method refreshViewerNode.
protected void refreshViewerNode() {
IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
Iterator iter = selection.iterator();
while (iter.hasNext()) {
Object object = iter.next();
if (object instanceof ISVNRepositoryLocation) {
refreshAction.run();
break;
}
if (object instanceof ISVNRemoteFolder)
((ISVNRemoteFolder) object).refresh();
treeViewer.refresh(object);
}
}
Aggregations