use of org.tigris.subversion.subclipse.core.history.Alias 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.core.history.Alias in project subclipse by subclipse.
the class BranchTagOperation method updateBranchTagProperty.
private void updateBranchTagProperty(IResource resource) {
AliasManager aliasManager = new AliasManager(resource, false);
Alias[] branchAliases = aliasManager.getBranches();
Alias[] tagAliases = aliasManager.getTags();
StringBuffer propertyValue = new StringBuffer();
for (int i = 0; i < branchAliases.length; i++) {
if (branchAliases[i].getRevision() > 0) {
// $NON-NLS-1$
if (propertyValue.length() > 0)
propertyValue.append("\n");
Alias branch = branchAliases[i];
// $NON-NLS-1$
propertyValue.append(branch.getRevision() + "," + branch.getName());
if (branch.getRelativePath() != null)
// $NON-NLS-1$
propertyValue.append("," + branch.getRelativePath());
if (// $NON-NLS-1$
branch.isBranch())
// $NON-NLS-1$
propertyValue.append(",branch");
else
// $NON-NLS-1$
propertyValue.append(",tag");
}
}
for (int i = 0; i < tagAliases.length; i++) {
if (tagAliases[i].getRevision() > 0) {
// $NON-NLS-1$
if (propertyValue.length() > 0)
propertyValue.append("\n");
Alias tag = tagAliases[i];
// $NON-NLS-1$
propertyValue.append(tag.getRevision() + "," + tag.getName());
if (tag.getRelativePath() != null)
// $NON-NLS-1$
propertyValue.append("," + tag.getRelativePath());
if (// $NON-NLS-1$
tag.isBranch())
// $NON-NLS-1$
propertyValue.append(",branch");
else
// $NON-NLS-1$
propertyValue.append(",tag");
}
}
// $NON-NLS-1$
if (propertyValue.length() > 0)
propertyValue.append("\n");
propertyValue.append(newAlias.getRevision() + "," + newAlias.getName() + "," + // $NON-NLS-1$ //$NON-NLS-2$
newAlias.getRelativePath());
if (// $NON-NLS-1$
newAlias.isBranch())
// $NON-NLS-1$
propertyValue.append(",branch");
else
// $NON-NLS-1$
propertyValue.append(",tag");
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
try {
// $NON-NLS-1$
svnResource.setSvnProperty("subclipse:tags", propertyValue.toString(), false);
} catch (SVNException e) {
}
}
use of org.tigris.subversion.subclipse.core.history.Alias in project subclipse by subclipse.
the class RemoteContentProvider method setResource.
public void setResource(IResource resource) {
if (includeBranchesAndTags) {
AliasManager tagManager = new AliasManager(resource);
Alias[] branchAliases = tagManager.getBranches();
Alias[] tagAliases = tagManager.getTags();
if (branchAliases.length > 0)
branches = new Branches(branchAliases);
if (tagAliases.length > 0)
tags = new Tags(tagAliases);
}
}
use of org.tigris.subversion.subclipse.core.history.Alias in project subclipse by subclipse.
the class SvnWizardConfigureTagsPage method getPropertyValue.
private String getPropertyValue() {
StringBuffer propertyValue = new StringBuffer();
Alias[] branchAliases = branches.getBranches();
for (int i = 0; i < branchAliases.length; i++) {
if (branchAliases[i].getRevision() > 0) {
// $NON-NLS-1$
if (propertyValue.length() > 0)
propertyValue.append("\n");
Alias branch = branchAliases[i];
// $NON-NLS-1$
propertyValue.append(branch.getRevision() + "," + branch.getName());
if (branch.getRelativePath() != null)
// $NON-NLS-1$
propertyValue.append("," + branch.getRelativePath());
if (// $NON-NLS-1$
branch.isBranch())
// $NON-NLS-1$
propertyValue.append(",branch");
else
// $NON-NLS-1$
propertyValue.append(",tag");
}
}
Alias[] tagAliases = tags.getTags();
for (int i = 0; i < tagAliases.length; i++) {
if (tagAliases[i].getRevision() > 0) {
// $NON-NLS-1$
if (propertyValue.length() > 0)
propertyValue.append("\n");
Alias tag = tagAliases[i];
// $NON-NLS-1$
propertyValue.append(tag.getRevision() + "," + tag.getName());
if (tag.getRelativePath() != null)
// $NON-NLS-1$
propertyValue.append("," + tag.getRelativePath());
if (// $NON-NLS-1$
tag.isBranch())
// $NON-NLS-1$
propertyValue.append(",branch");
else
// $NON-NLS-1$
propertyValue.append(",tag");
}
}
return propertyValue.toString();
}
use of org.tigris.subversion.subclipse.core.history.Alias in project subclipse by subclipse.
the class ChooseUrlDialog method okPressed.
protected void okPressed() {
saveLocation();
ISelection selection = treeViewer.getSelection();
if (!selection.isEmpty() && (selection instanceof IStructuredSelection)) {
IStructuredSelection structured = (IStructuredSelection) selection;
Object first = structured.getFirstElement();
if (first instanceof ISVNRemoteResource) {
url = ((ISVNRemoteResource) first).getUrl().toString();
name = ((ISVNRemoteResource) first).getName();
}
if (first instanceof ISVNRepositoryLocation)
url = ((ISVNRepositoryLocation) first).getUrl().toString();
if (first instanceof Alias)
url = AliasManager.transformUrl(resource, (Alias) first);
ArrayList urlArray = new ArrayList();
ArrayList nameArray = new ArrayList();
Iterator iter = structured.iterator();
while (iter.hasNext()) {
Object selectedItem = iter.next();
if (selectedItem instanceof ISVNRemoteResource) {
urlArray.add(((ISVNRemoteResource) selectedItem).getUrl().toString());
nameArray.add(((ISVNRemoteResource) selectedItem).getName());
}
}
urls = new String[urlArray.size()];
urlArray.toArray(urls);
names = new String[nameArray.size()];
nameArray.toArray(names);
}
super.okPressed();
}
Aggregations