use of org.tigris.subversion.subclipse.ui.operations.BranchTagOperation 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.ui.operations.BranchTagOperation in project subclipse by subclipse.
the class BranchTagAction method execute.
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
if (action != null && !action.isEnabled()) {
action.setEnabled(true);
} else {
IResource[] resources = getSelectedResources();
BranchTagWizard wizard = new BranchTagWizard(resources);
SizePersistedWizardDialog dialog = // $NON-NLS-1$
new SizePersistedWizardDialog(getShell(), wizard, "BranchTag");
wizard.setParentDialog(dialog);
if (dialog.open() == WizardDialog.OK) {
SVNUrl[] sourceUrls = wizard.getUrls();
SVNUrl destinationUrl = wizard.getToUrl();
String message = wizard.getComment();
boolean createOnServer = wizard.isCreateOnServer();
BranchTagOperation branchTagOperation = new BranchTagOperation(getTargetPart(), getSelectedResources(), sourceUrls, destinationUrl, createOnServer, wizard.getRevision(), message);
branchTagOperation.setMakeParents(wizard.isMakeParents());
branchTagOperation.setMultipleTransactions(wizard.isSameStructure());
branchTagOperation.setNewAlias(wizard.getNewAlias());
branchTagOperation.switchAfterTagBranchOperation(wizard.isSwitchAfterBranchTag());
branchTagOperation.setSvnExternals(wizard.getSvnExternals());
branchTagOperation.run();
}
}
}
use of org.tigris.subversion.subclipse.ui.operations.BranchTagOperation in project subclipse by subclipse.
the class SVNHistoryPage method getCreateTagFromRevisionAction.
// get create tag from revision action (context menu)
private IAction getCreateTagFromRevisionAction() {
if (createTagFromRevisionAction == null) {
createTagFromRevisionAction = new Action() {
public void run() {
ISelection selection = getSelection();
if (!(selection instanceof IStructuredSelection))
return;
ILogEntry currentSelection = getLogEntry((IStructuredSelection) selection);
BranchTagWizard wizard;
if (resource == null) {
ISVNRemoteResource[] remoteResources = { historyTableProvider.getRemoteResource() };
wizard = new BranchTagWizard(remoteResources);
} else {
IResource[] resources = { resource };
wizard = new BranchTagWizard(resources);
}
wizard.setRevisionNumber(currentSelection.getRevision().getNumber());
WizardDialog dialog = new ClosableWizardDialog(getSite().getShell(), 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();
boolean createOnServer = wizard.isCreateOnServer();
IResource[] resources = { resource };
try {
if (resource == null) {
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
ISVNClientAdapter client = null;
try {
client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
client.copy(sourceUrl, destinationUrl, message, revision, makeParents);
SVNUIPlugin.getPlugin().getRepositoryManager().resourceCreated(null, null);
} catch (Exception e) {
MessageDialog.openError(getSite().getShell(), Policy.bind("HistoryView.createTagFromRevision"), // $NON-NLS-1$
e.getMessage());
} finally {
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
}
});
} else {
BranchTagOperation branchTagOperation = new BranchTagOperation(getSite().getPage().getActivePart(), resources, new SVNUrl[] { sourceUrl }, destinationUrl, createOnServer, wizard.getRevision(), message);
branchTagOperation.setMakeParents(makeParents);
branchTagOperation.setNewAlias(wizard.getNewAlias());
branchTagOperation.run();
}
} catch (Exception e) {
MessageDialog.openError(getSite().getShell(), Policy.bind("HistoryView.createTagFromRevision"), // $NON-NLS-1$
e.getMessage());
}
}
}
};
}
ISelection selection = getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
if (ss.size() == 1) {
ILogEntry currentSelection = getLogEntry(ss);
createTagFromRevisionAction.setText(Policy.bind("HistoryView.createTagFromRevision", // $NON-NLS-1$ //$NON-NLS-2$
"" + currentSelection.getRevision().getNumber()));
}
}
createTagFromRevisionAction.setImageDescriptor(SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_MENU_BRANCHTAG));
return createTagFromRevisionAction;
}
Aggregations