use of org.tigris.subversion.subclipse.core.resources.RemoteFile in project subclipse by subclipse.
the class CompareRevisionsAction method run.
public void run() {
RevisionGraphEditorInput input = (RevisionGraphEditorInput) editor.getEditorInput();
boolean isFolder = (input.getResource() != null && input.getResource().getType() != IResource.FILE) || (input.getRemoteResource() != null && input.getRemoteResource().isFolder());
ISVNInfo info = input.getInfo();
try {
ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(info.getRepository().toString());
ISVNRemoteResource remoteResource1;
ISVNRemoteResource remoteResource2;
if (isFolder) {
remoteResource1 = new RemoteFolder(repository, new SVNUrl(repository.getLocation() + node1.getBranch().getPath()), new SVNRevision.Number(node1.getRevision()));
remoteResource2 = new RemoteFolder(repository, new SVNUrl(repository.getLocation() + node2.getBranch().getPath()), new SVNRevision.Number(node2.getRevision()));
} else {
remoteResource1 = new RemoteFile(repository, new SVNUrl(repository.getLocation() + node1.getBranch().getPath()), new SVNRevision.Number(node1.getRevision()));
remoteResource2 = new RemoteFile(repository, new SVNUrl(repository.getLocation() + node2.getBranch().getPath()), new SVNRevision.Number(node2.getRevision()));
}
ISVNRemoteResource[] selectedResources = { remoteResource1, remoteResource2 };
DifferencesDialog dialog = new DifferencesDialog(Display.getDefault().getActiveShell(), null, selectedResources, editor.getEditorSite().getPart());
dialog.setFromRevision(Long.toString(node1.getRevision()));
dialog.setToRevision(Long.toString(node2.getRevision()));
dialog.open();
} catch (Exception e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), "Compare Revisions", e.getMessage());
}
}
use of org.tigris.subversion.subclipse.core.resources.RemoteFile in project subclipse by subclipse.
the class GetRemoteResourceCommand method run.
/* (non-Javadoc)
* @see org.tigris.subversion.subclipse.core.commands.ISVNCommand#run(org.eclipse.core.runtime.IProgressMonitor)
*/
public void run(IProgressMonitor monitor) throws SVNException {
monitor = Policy.monitorFor(monitor);
// $NON-NLS-1$
monitor.beginTask(Policy.bind("GetRemoteResourceCommand.getLogEntries"), 100);
remoteResource = null;
ISVNClientAdapter svnClient = repository.getSVNClient();
ISVNInfo info;
try {
info = svnClient.getInfo(url, revision, revision);
} catch (SVNClientException e) {
throw new SVNException("Can't get remote resource " + url + " at revision " + revision, e);
} finally {
repository.returnSVNClient(svnClient);
}
if (info == null) {
// no remote file
remoteResource = null;
} else {
if (info.getNodeKind() == SVNNodeKind.FILE)
remoteResource = new RemoteFile(// we don't know its parent
null, repository, url, revision, info.getLastChangedRevision(), info.getLastChangedDate(), info.getLastCommitAuthor());
else
remoteResource = new RemoteFolder(// we don't know its parent
null, repository, url, revision, info.getLastChangedRevision(), info.getLastChangedDate(), info.getLastCommitAuthor());
}
monitor.done();
}
use of org.tigris.subversion.subclipse.core.resources.RemoteFile in project subclipse by subclipse.
the class SVNRepositoryLocation method getRemoteFile.
/*
* (non-Javadoc)
* @see org.tigris.subversion.subclipse.core.ISVNRepositoryLocation#getRemoteFile(org.tigris.subversion.svnclientadapter.SVNUrl)
*/
public ISVNRemoteFile getRemoteFile(SVNUrl url) throws SVNException {
ISVNClientAdapter svnClient = getSVNClient();
ISVNInfo info = null;
try {
if (this.getRepositoryRoot().equals(url))
return new RemoteFile(this, url, SVNRevision.HEAD);
else
info = svnClient.getInfo(url, SVNRevision.HEAD, SVNRevision.HEAD);
} catch (SVNClientException e) {
throw new SVNException("Can't get latest remote resource for " + url);
}
if (// no remote file
info == null)
// no remote file
return null;
else {
return new RemoteFile(// we don't know its parent
null, this, url, SVNRevision.HEAD, info.getLastChangedRevision(), info.getLastChangedDate(), info.getLastCommitAuthor());
}
}
use of org.tigris.subversion.subclipse.core.resources.RemoteFile in project subclipse by subclipse.
the class SVNHistoryPage method getCompareWithPreviousChangedPathAction.
private IAction getCompareWithPreviousChangedPathAction() {
if (compareWithPreviousChangedPathAction == null) {
compareWithPreviousChangedPathAction = new Action() {
public void run() {
CompareRemoteResourcesAction delegate = new CompareRemoteResourcesAction();
delegate.init(this);
ISVNRemoteResource remoteResource1 = null;
Object firstSelection = ((IStructuredSelection) changePathsViewer.getSelection()).getFirstElement();
if (firstSelection instanceof LogEntryChangePath) {
LogEntryChangePath logEntryChangePath = (LogEntryChangePath) firstSelection;
try {
remoteResource1 = logEntryChangePath.getRemoteResource();
} catch (SVNException e1) {
SVNUIPlugin.openError(getSite().getShell(), null, null, e1, SVNUIPlugin.LOG_TEAM_EXCEPTIONS);
return;
}
} else if (firstSelection instanceof HistoryFolder) {
HistoryFolder historyFolder = (HistoryFolder) firstSelection;
Object[] children = historyFolder.getChildren();
if (children != null && children.length > 0 && children[0] instanceof LogEntryChangePath) {
LogEntryChangePath logEntryChangePath = (LogEntryChangePath) children[0];
try {
SVNUrl svnUrl = logEntryChangePath.getRemoteResource().getRepository().getRemoteFolder(historyFolder.getPath()).getUrl();
SVNRevision.Number selectedRevision = (SVNRevision.Number) getSelectedRevision();
remoteResource1 = new RemoteFolder(null, logEntryChangePath.getLogEntry().getRemoteResource().getRepository(), svnUrl, selectedRevision, selectedRevision, null, null);
} catch (Exception e) {
}
}
}
if (remoteResource1 == null) {
return;
}
int from = Integer.parseInt(remoteResource1.getRevision().toString());
from--;
String to = Integer.toString(from);
SVNRevision toRevision = null;
try {
toRevision = SVNRevision.getRevision(to);
} catch (ParseException e) {
}
ISVNRemoteResource[] remoteResources = new ISVNRemoteResource[2];
ISVNRemoteResource remoteResource2;
if (firstSelection instanceof HistoryFolder || remoteResource1.getResource() instanceof IContainer) {
remoteResource2 = new RemoteFolder(null, remoteResource1.getRepository(), remoteResource1.getUrl(), (SVNRevision.Number) toRevision, (SVNRevision.Number) toRevision, null, null);
} else {
remoteResource2 = new RemoteFile(null, remoteResource1.getRepository(), remoteResource1.getUrl(), (SVNRevision.Number) toRevision, (SVNRevision.Number) toRevision, null, null);
}
remoteResources[0] = remoteResource1;
remoteResources[1] = remoteResource2;
delegate.selectionChanged(this, new StructuredSelection(remoteResources));
delegate.setRemoteResources(remoteResources);
delegate.setLocalResource(remoteResource1.getResource());
delegate.setLocalResources(remoteResources);
SVNRevision[] pegRevisions = { remoteResource1.getRevision() };
delegate.setPegRevisions(pegRevisions);
delegate.run(this);
}
};
}
return compareWithPreviousChangedPathAction;
}
use of org.tigris.subversion.subclipse.core.resources.RemoteFile in project subclipse by subclipse.
the class RepositoriesView method createPartControl.
/*
* @see WorkbenchPart#createPartControl
*/
public void createPartControl(Composite parent) {
treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
contentProvider = new RemoteContentProvider();
treeViewer.setContentProvider(contentProvider);
final RepositoriesViewDecorator decorator = new RepositoriesViewDecorator();
DecoratingLabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(), new ILabelDecorator() {
public Image decorateImage(Image image, Object obj) {
if (obj instanceof RemoteFile) {
RemoteFile remoteFile = (RemoteFile) obj;
if (remoteFile.getLock() != null) {
return decorator.getImage(image);
}
}
return null;
}
public String decorateText(String text, Object obj) {
return null;
}
public void addListener(ILabelProviderListener listener) {
}
public void dispose() {
}
public boolean isLabelProperty(Object obj, String prop) {
return false;
}
public void removeListener(ILabelProviderListener listener) {
}
});
treeViewer.setLabelProvider(labelProvider);
getSite().setSelectionProvider(treeViewer);
root = new AllRootsElement();
treeViewer.setInput(root);
treeViewer.setSorter(new RepositorySorter());
drillPart = new DrillDownAdapter(treeViewer);
contributeActions();
// F1 Help
String helpID = getHelpContextId();
if (helpID != null)
PlatformUI.getWorkbench().getHelpSystem().setHelp(treeViewer.getControl(), helpID);
initializeListeners();
SVNUIPlugin.getPlugin().getRepositoryManager().addRepositoryListener(repositoryListener);
}
Aggregations