use of org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput in project subclipse by subclipse.
the class BranchTagAction method run.
public void run() {
BranchTagWizard wizard;
final IResource resource = ((RevisionGraphEditorInput) editor.getEditorInput()).getResource();
ISVNRemoteResource remoteResource = ((RevisionGraphEditorInput) editor.getEditorInput()).getRemoteResource();
if (resource == null) {
ISVNRemoteResource[] resources = { remoteResource };
wizard = new BranchTagWizard(resources);
} else {
IResource[] resources = { resource };
wizard = new BranchTagWizard(resources);
}
wizard.setRevisionNumber(node.getRevision());
WizardDialog dialog = new ClosableWizardDialog(Display.getDefault().getActiveShell(), wizard);
if (dialog.open() == WizardDialog.OK) {
final SVNUrl sourceUrl = wizard.getUrl();
final SVNUrl destinationUrl = wizard.getToUrl();
final String message = wizard.getComment();
final SVNRevision revision = wizard.getRevision();
final boolean makeParents = wizard.isMakeParents();
final SVNUrl[] sourceUrls = wizard.getUrls();
final boolean createOnServer = wizard.isCreateOnServer();
final Alias newAlias = wizard.getNewAlias();
final boolean switchAfter = wizard.isSwitchAfterBranchTag();
try {
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
ISVNClientAdapter client = null;
try {
if (resource == null) {
client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
client.copy(sourceUrl, destinationUrl, message, revision, makeParents);
} else {
IResource[] resources = { resource };
BranchTagOperation branchTagOperation = new BranchTagOperation(editor.getEditorSite().getPart(), resources, sourceUrls, destinationUrl, createOnServer, revision, message);
branchTagOperation.setMakeParents(makeParents);
branchTagOperation.setNewAlias(newAlias);
branchTagOperation.switchAfterTagBranchOperation(switchAfter);
branchTagOperation.run();
}
} catch (Exception e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), Policy.bind("HistoryView.createTagFromRevision"), e.getMessage());
} finally {
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
}
});
} catch (Exception e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), Policy.bind("HistoryView.createTagFromRevision"), e.getMessage());
}
}
}
use of org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput 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.graph.editors.RevisionGraphEditorInput in project subclipse by subclipse.
the class RemoteResourceViewGraphAction method execute.
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
run(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
ISVNRemoteResource[] resources = getSelectedRemoteResources();
if (resources.length == 0)
resources = getSelectedRemoteFolders();
try {
if (resources.length > 0) {
getTargetPage().openEditor(new RevisionGraphEditorInput(resources[0]), "org.tigris.subversion.subclipse.graph.editors.revisionGraphEditor");
}
} catch (Exception e) {
Activator.handleError(e);
Activator.showErrorDialog(getErrorTitle(), e);
}
}
}, false, /* cancelable */
PROGRESS_BUSYCURSOR);
}
use of org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput in project subclipse by subclipse.
the class ViewGraphAction method execute.
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
if (action != null && !action.isEnabled()) {
action.setEnabled(true);
} else {
run(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
IResource[] resources = getSelectedResources();
try {
if (resources.length > 0) {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resources[0]);
ISVNRemoteResource remoteResource = svnResource.getBaseResource();
if (remoteResource != null) {
String repoPath = remoteResource.getRepositoryRelativePath();
if (repoPath == null || repoPath.length() == 0) {
MessageDialog.openError(Display.getDefault().getActiveShell(), Policy.bind("ViewGraphAction.0"), // $NON-NLS-1$ //$NON-NLS-2$
Policy.bind("ViewGraphAction.1"));
return;
}
}
// IEditorPart part =
getTargetPage().openEditor(new RevisionGraphEditorInput(resources[0]), // $NON-NLS-1$
"org.tigris.subversion.subclipse.graph.editors.revisionGraphEditor");
}
} catch (Exception e) {
Activator.handleError(e);
Activator.showErrorDialog(getErrorTitle(), e);
}
}
}, false, /* cancelable */
PROGRESS_BUSYCURSOR);
}
}
use of org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput in project subclipse by subclipse.
the class RefreshNodeAction method run.
public void run() {
IResource resource = ((RevisionGraphEditorInput) editor.getEditorInput()).getResource();
ISVNRemoteResource remoteResource = ((RevisionGraphEditorInput) editor.getEditorInput()).getRemoteResource();
GraphBackgroundTask task;
if (resource == null)
task = new GraphBackgroundTask(SVNUIPlugin.getActivePage().getActivePart(), editor.getViewer(), editor, remoteResource);
else
task = new GraphBackgroundTask(SVNUIPlugin.getActivePage().getActivePart(), editor.getViewer(), editor, resource);
task.setGetNewRevisions(false);
SVNRevision[] revisions = new SVNRevision[selectedRevisions.size()];
Node[] nodes = new Node[selectedRevisions.size()];
for (int i = 0; i < selectedRevisions.size(); i++) {
nodes[i] = (Node) ((RevisionEditPart) selectedRevisions.get(i)).getModel();
revisions[i] = new SVNRevision.Number(nodes[i].getRevision());
}
task.setRefreshRevisions(revisions, nodes);
try {
task.run();
} catch (Exception e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), Policy.bind("RefreshNodeAction.title"), // $NON-NLS-1$
e.getMessage());
}
}
Aggregations