use of org.tigris.subversion.subclipse.core.history.LogEntryChangePath in project subclipse by subclipse.
the class SVNHistoryPage method getRevisionRanges.
private SVNRevisionRange[] getRevisionRanges() {
List revisionRanges = new ArrayList();
ISelection selection = getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
List selectionList = ss.toList();
TableItem[] items = tableHistoryViewer.getTable().getItems();
SVNRevision revision1 = null;
SVNRevision revision2 = null;
for (int i = 0; i < items.length; i++) {
if (items[i].getData() instanceof ILogEntry) {
ILogEntry logEntry = (ILogEntry) items[i].getData();
if (selectionList.contains(logEntry)) {
if (revision1 == null) {
revision1 = logEntry.getRevision();
}
revision2 = logEntry.getRevision();
revertEnabled = true;
LogEntryChangePath[] changePaths = logEntry.getLogEntryChangePaths();
if (changePaths != null) {
for (LogEntryChangePath changePath : changePaths) {
if (changePath.getPath().equals(remoteResource.getRepositoryRelativePath())) {
if (changePath.getAction() == 'A') {
revertEnabled = false;
}
break;
}
}
}
} else {
if (revision1 != null) {
SVNRevisionRange revisionRange = new SVNRevisionRange(revision1, revision2);
revisionRanges.add(revisionRange);
revision1 = null;
revision2 = null;
}
}
}
}
if (revision1 != null) {
SVNRevisionRange revisionRange = new SVNRevisionRange(revision1, revision2);
revisionRanges.add(revisionRange);
}
}
SVNRevisionRange[] revisionRangeArray = new SVNRevisionRange[revisionRanges.size()];
revisionRanges.toArray(revisionRangeArray);
return revisionRangeArray;
}
use of org.tigris.subversion.subclipse.core.history.LogEntryChangePath in project subclipse by subclipse.
the class SVNHistoryPage method getCopyChangedPathAction.
private IAction getCopyChangedPathAction() {
if (copyChangedPathAction == null) {
copyChangedPathAction = new // $NON-NLS-1$
Action(// $NON-NLS-1$
Policy.bind("HistoryView.copyChangedPath")) {
public void run() {
ContainerSelectionDialog dialog = new ContainerSelectionDialog(Display.getDefault().getActiveShell(), null, false, // $NON-NLS-1$
Policy.bind("CopyAction.selectionLabel"));
if (dialog.open() == ContainerSelectionDialog.OK) {
Object[] result = dialog.getResult();
if (result == null || result.length == 0)
return;
final Path path = (Path) result[0];
IProject selectedProject;
File target = null;
if (path.segmentCount() == 1) {
selectedProject = ResourcesPlugin.getWorkspace().getRoot().getProject(path.toString());
target = selectedProject.getLocation().toFile();
} else {
IFile targetFile = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
selectedProject = targetFile.getProject();
target = targetFile.getLocation().toFile();
}
final IProject targetProject = selectedProject;
final File destPath = target;
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
ISVNClientAdapter client = null;
try {
IStructuredSelection sel = (IStructuredSelection) changePathsViewer.getSelection();
if (sel.getFirstElement() instanceof LogEntryChangePath) {
LogEntryChangePath changePath = (LogEntryChangePath) sel.getFirstElement();
SVNRevision revision = changePath.getRevision();
if (changePath.getAction() == 'D') {
long rev = Long.parseLong(revision.toString());
rev--;
revision = new SVNRevision.Number(rev);
}
client = SVNProviderPlugin.getPlugin().getSVNClient();
client.copy(changePath.getUrl(), destPath, revision, revision, true, false);
targetProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
SVNUIPlugin.getPlugin().getRepositoryManager().resourceCreated(null, null);
}
} catch (Exception e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), Policy.bind("HistoryView.copyError"), // $NON-NLS-1$
e.getMessage());
} finally {
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
}
});
}
}
};
}
return copyChangedPathAction;
}
use of org.tigris.subversion.subclipse.core.history.LogEntryChangePath in project subclipse by subclipse.
the class SVNHistoryPage method fillChangePathsMenu.
private void fillChangePathsMenu(IMenuManager manager) {
//
// Commented out Get Contents, Revert and Switch options until when/if
// they can be fixed. Problem is that we need a way to get the local
// resource from the LogEntryChangePath.
//
IStructuredSelection sel = (IStructuredSelection) changePathsViewer.getSelection();
if (sel.size() == 1) {
if (sel.getFirstElement() instanceof LogEntryChangePath) {
// manager.add(getGetContentsAction());
}
manager.add(getCreateTagFromRevisionChangedPathAction());
}
// manager.add(getRevertChangesChangedPathAction());
// manager.add(getSwitchChangedPathAction());
// $NON-NLS-1$
manager.add(new Separator("exportImportGroup"));
if (sel.size() == 1) {
if (sel.getFirstElement() instanceof LogEntryChangePath) {
manager.add(getExportAction());
if (((LogEntryChangePath) sel.getFirstElement()).getAction() == 'D') {
manager.add(getCopyChangedPathAction());
}
}
}
// $NON-NLS-1$
manager.add(new Separator("openGroup"));
if (sel.size() == 1) {
if (sel.getFirstElement() instanceof LogEntryChangePath) {
manager.add(getShowAnnotationAction());
}
manager.add(getCompareAction());
}
if (sel.getFirstElement() instanceof LogEntryChangePath) {
manager.add(getOpenChangedPathAction());
}
if (sel.size() == 1)
manager.add(getShowHistoryAction());
}
Aggregations