Search in sources :

Example 1 with Alias

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());
        }
    }
}
Also used : SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) RevisionGraphEditorInput(org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput) BranchTagWizard(org.tigris.subversion.subclipse.ui.wizards.BranchTagWizard) Alias(org.tigris.subversion.subclipse.core.history.Alias) BranchTagOperation(org.tigris.subversion.subclipse.ui.operations.BranchTagOperation) ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IResource(org.eclipse.core.resources.IResource) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 2 with Alias

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) {
    }
}
Also used : AliasManager(org.tigris.subversion.subclipse.core.history.AliasManager) Alias(org.tigris.subversion.subclipse.core.history.Alias) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource)

Example 3 with Alias

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);
    }
}
Also used : AliasManager(org.tigris.subversion.subclipse.core.history.AliasManager) Alias(org.tigris.subversion.subclipse.core.history.Alias) Branches(org.tigris.subversion.subclipse.core.history.Branches) Tags(org.tigris.subversion.subclipse.core.history.Tags)

Example 4 with Alias

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();
}
Also used : Alias(org.tigris.subversion.subclipse.core.history.Alias)

Example 5 with Alias

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();
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) Alias(org.tigris.subversion.subclipse.core.history.Alias) ISelection(org.eclipse.jface.viewers.ISelection) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource)

Aggregations

Alias (org.tigris.subversion.subclipse.core.history.Alias)10 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 SVNException (org.tigris.subversion.subclipse.core.SVNException)3 AliasManager (org.tigris.subversion.subclipse.core.history.AliasManager)3 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)3 ISVNInfo (org.tigris.subversion.svnclientadapter.ISVNInfo)3 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)3 Iterator (java.util.Iterator)2 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)2 Branches (org.tigris.subversion.subclipse.core.history.Branches)2 Tags (org.tigris.subversion.subclipse.core.history.Tags)2 BranchTagPropertyUpdateDialog (org.tigris.subversion.subclipse.ui.dialogs.BranchTagPropertyUpdateDialog)2 ISVNProperty (org.tigris.subversion.svnclientadapter.ISVNProperty)2 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)2 ArrayList (java.util.ArrayList)1 IResource (org.eclipse.core.resources.IResource)1 IMenuListener (org.eclipse.jface.action.IMenuListener)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 ISelection (org.eclipse.jface.viewers.ISelection)1