use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class ShowDifferencesAsUnifiedDiffDialogWC method okPressed.
protected void okPressed() {
success = true;
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
ISVNRepositoryLocation repository = null;
ISVNClientAdapter svnClient = null;
try {
if (toHeadButton.getSelection())
toRevision = SVNRevision.HEAD;
else {
int toRevisionInt = Integer.parseInt(toRevisionText.getText().trim());
long toRevisionLong = toRevisionInt;
toRevision = new SVNRevision.Number(toRevisionLong);
}
toUrl = new SVNUrl(toUrlText.getText().trim());
File path = new File(resource.getLocation().toString());
svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
pegRevision = null;
if (toUrlText.getText().equals(selectedResourceUrl)) {
ISVNRemoteResource baseResource = svnResource.getBaseResource();
if (baseResource != null) {
pegRevision = baseResource.getLastChangedRevision();
}
}
if (pegRevision == null) {
pegRevision = toRevision;
}
repository = svnResource.getRepository();
svnClient = repository.getSVNClient();
ISVNInfo svnInfo = svnClient.getInfo(toUrl, toRevision, pegRevision);
SVNNodeKind nodeKind = svnInfo.getNodeKind();
if (resource instanceof IContainer) {
if (nodeKind.toInt() == SVNNodeKind.FILE.toInt()) {
MessageDialog.openError(getShell(), Policy.bind("ShowDifferencesAsUnifiedDiffDialog.branchTag"), Policy.bind("ShowDifferencesAsUnifiedDiffDialog.fileToFolder"));
success = false;
return;
}
} else {
if (nodeKind.toInt() == SVNNodeKind.DIR.toInt()) {
MessageDialog.openError(getShell(), Policy.bind("ShowDifferencesAsUnifiedDiffDialog.branchTag"), Policy.bind("ShowDifferencesAsUnifiedDiffDialog.fileToFolder"));
success = false;
return;
}
}
if (diffButton.getSelection()) {
diffToOutputFile = true;
file = new File(fileText.getText().trim());
if (file.exists()) {
if (!MessageDialog.openQuestion(getShell(), Policy.bind("HistoryView.showDifferences"), Policy.bind("HistoryView.overwriteOutfile", file.getName())))
return;
}
operation = new ShowDifferencesAsUnifiedDiffOperationWC(targetPart, path, toUrl, toRevision, file);
operation.setGraphicalCompare(true);
} else {
diffToOutputFile = false;
success = true;
}
} catch (Exception e) {
MessageDialog.openError(getShell(), Policy.bind("HistoryView.showDifferences"), e.getMessage());
success = false;
} finally {
if (repository != null) {
repository.returnSVNClient(svnClient);
}
}
}
});
if (!success)
return;
toUrlText.saveUrl();
super.okPressed();
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class RepositoriesView method getStatusLineMessage.
/**
* When selection is changed we update the status line
*/
private String getStatusLineMessage(ISelection selection) {
// $NON-NLS-1$
if (selection == null || selection.isEmpty())
return "";
// $NON-NLS-1$
if (!(selection instanceof IStructuredSelection))
return "";
IStructuredSelection s = (IStructuredSelection) selection;
if (s.size() > 1)
return Policy.bind("RepositoriesView.NItemsSelected", // $NON-NLS-1$
String.valueOf(s.size()));
Object element = SVNAction.getAdapter(s.getFirstElement(), ISVNResource.class);
if (element instanceof ISVNRemoteResource) {
ISVNRemoteResource res = (ISVNRemoteResource) element;
String name;
if (res.isContainer()) {
name = res.getRepositoryRelativePath();
} else {
name = res.getRepositoryRelativePath() + " " + // $NON-NLS-1$
((ISVNRemoteFile) res).getLastChangedRevision();
}
return Policy.bind("RepositoriesView.ResourceInRepository", name, // $NON-NLS-1$
res.getRepository().getLocation());
}
// $NON-NLS-1$
return Policy.bind("RepositoriesView.OneItemSelected");
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class RepositoryManager method startup.
/**
* called when plugin is started
*/
public void startup() {
commentsManager.loadCommentHistory();
commentsManager.loadCommentTemplates();
keyFilesManager.loadKeyFileHistory();
// we listen to changes to repository so that we can advise concerned views
SVNProviderPlugin.getPlugin().getRepositoryResourcesManager().addRepositoryListener(new ISVNListener() {
public void repositoryAdded(ISVNRepositoryLocation root) {
rootAdded(root);
}
public void repositoryRemoved(ISVNRepositoryLocation root) {
rootRemoved(root);
}
public void remoteResourceDeleted(ISVNRemoteResource resource) {
resourceDeleted(resource);
}
public void remoteResourceCreated(ISVNRemoteFolder parent, String resourceName) {
resourceCreated(parent, resourceName);
}
public void remoteResourceCopied(ISVNRemoteResource source, ISVNRemoteFolder destination) {
resourceCopied(source, destination);
}
public void remoteResourceMoved(ISVNRemoteResource resource, ISVNRemoteFolder destinationFolder, String destinationResourceName) {
resourceMoved(resource, destinationFolder, destinationResourceName);
}
public void repositoryModified(ISVNRepositoryLocation root) {
rootModified(root);
}
});
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class SvnWizardCompareMultipleResourcesWithBranchTagPage method showLog.
protected void showLog() {
ISVNRemoteResource remoteResource = null;
try {
remoteResource = SVNWorkspaceRoot.getSVNResourceFor(resources[0]).getRepository().getRemoteFile(new SVNUrl(urlCombo.getText()));
} catch (Exception e) {
MessageDialog.openError(getShell(), Policy.bind("MergeDialog.showLog"), // $NON-NLS-1$
e.toString());
return;
}
if (remoteResource == null) {
MessageDialog.openError(getShell(), Policy.bind("MergeDialog.showLog"), Policy.bind("MergeDialog.urlError") + " " + // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
urlCombo.getText());
return;
}
HistoryDialog dialog = new HistoryDialog(getShell(), remoteResource);
if (dialog.open() == HistoryDialog.CANCEL)
return;
ILogEntry[] selectedEntries = dialog.getSelectedLogEntries();
if (selectedEntries.length == 0)
return;
revisionText.setText(Long.toString(selectedEntries[selectedEntries.length - 1].getRevision().getNumber()));
setPageComplete(canFinish());
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class CheckoutWizardCheckoutAsMultiplePage method getCommonParent.
private ISVNRemoteResource getCommonParent() {
ISVNRemoteFolder[] remoteFolders = ((CheckoutWizard) getWizard()).getRemoteFolders();
if (remoteFolders.length == 1)
return remoteFolders[0];
ISVNRemoteResource commonParent = null;
ISVNRemoteResource parent = remoteFolders[0];
while (commonParent == null) {
parent = parent.getParent();
if (parent == null)
break;
for (int i = 1; i < remoteFolders.length; i++) {
if (!remoteFolders[i].getUrl().toString().startsWith(parent.getUrl().toString()))
break;
}
commonParent = parent;
}
return commonParent;
}
Aggregations