Search in sources :

Example 21 with SVNRevision

use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.

the class MergeAction method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    if (action != null && !action.isEnabled()) {
        action.setEnabled(true);
    } else {
        IResource[] resources = getSelectedResources();
        for (int i = 0; i < resources.length; i++) {
            MergeDialog dialog = new MergeDialog(getShell(), resources[i]);
            if (dialog.open() == MergeDialog.CANCEL)
                break;
            SVNUrl svnUrl1 = dialog.getFromUrl();
            SVNRevision svnRevision1 = dialog.getFromRevision();
            SVNUrl svnUrl2 = dialog.getToUrl();
            SVNRevision svnRevision2 = dialog.getToRevision();
            MergeOperation mergeOperation = new MergeOperation(getTargetPart(), getSelectedResources(), svnUrl1, svnRevision1, svnUrl2, svnRevision2);
            mergeOperation.setForce(dialog.isForce());
            mergeOperation.setIgnoreAncestry(dialog.isIgnoreAncestry());
            mergeOperation.run();
        }
    }
}
Also used : MergeOperation(org.tigris.subversion.subclipse.ui.operations.MergeOperation) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) MergeDialog(org.tigris.subversion.subclipse.ui.dialogs.MergeDialog) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) IResource(org.eclipse.core.resources.IResource)

Example 22 with SVNRevision

use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.

the class RemoteResourceTransfer method fromByteArray.

public Object fromByteArray(byte[] buffer) {
    try {
        ByteArrayInputStream in = new ByteArrayInputStream(buffer);
        DataInputStream readIn = new DataInputStream(in);
        boolean isFolder = readIn.readBoolean();
        // first, we read the url of the remote resource
        SVNUrl urlResource = new SVNUrl(readIn.readUTF());
        // then we read the url of the repository
        String location = readIn.readUTF();
        // we read the revision
        SVNRevision revision = SVNRevision.getRevision(readIn.readUTF());
        // we read the last changed revision
        SVNRevision.Number lastChangedRevision = (Number) SVNRevision.getRevision(readIn.readUTF());
        Date date = new Date(readIn.readLong());
        String author = null;
        try {
            author = readIn.readUTF();
        } catch (Exception e) {
        // Ignore null author
        }
        ISVNRepositoryLocation repositoryLocation = SVNProviderPlugin.getPlugin().getRepository(location);
        if (isFolder) {
            return new RemoteFolder(null, repositoryLocation, urlResource, revision, lastChangedRevision, date, author);
        }
        return new RemoteFile(null, repositoryLocation, urlResource, revision, lastChangedRevision, date, author);
    } catch (Exception ex) {
        return null;
    }
}
Also used : SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) RemoteFolder(org.tigris.subversion.subclipse.core.resources.RemoteFolder) DataInputStream(java.io.DataInputStream) Date(java.util.Date) IOException(java.io.IOException) Number(org.tigris.subversion.svnclientadapter.SVNRevision.Number) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) Number(org.tigris.subversion.svnclientadapter.SVNRevision.Number) ByteArrayInputStream(java.io.ByteArrayInputStream) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile)

Example 23 with SVNRevision

use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.

the class RepositoryBranchTagAction method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    ISVNRemoteResource[] resources = getSelectedRemoteResources();
    BranchTagWizard wizard = new BranchTagWizard(resources);
    WizardDialog dialog = // $NON-NLS-1$
    new SizePersistedWizardDialog(getShell(), wizard, "BranchTag");
    if (dialog.open() == WizardDialog.OK) {
        SVNUrl[] sourceUrls = wizard.getUrls();
        SVNUrl destinationUrl = wizard.getToUrl();
        String message = wizard.getComment();
        SVNRevision revision = wizard.getRevision();
        boolean makeParents = wizard.isMakeParents();
        ISVNClientAdapter client = null;
        try {
            ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(sourceUrls[0].toString());
            if (repository != null)
                client = repository.getSVNClient();
            if (client == null)
                client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
            RepositoryBranchTagOperation branchTagOperation = new RepositoryBranchTagOperation(getTargetPart(), client, sourceUrls, destinationUrl, revision, message, makeParents);
            branchTagOperation.setMultipleTransactions(wizard.isSameStructure());
            branchTagOperation.run();
        } catch (Exception e) {
            MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), e.getMessage());
        } finally {
        // BranchTagCommand will dispose.
        // SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
        }
    }
}
Also used : SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) RepositoryBranchTagOperation(org.tigris.subversion.subclipse.ui.operations.RepositoryBranchTagOperation) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) BranchTagWizard(org.tigris.subversion.subclipse.ui.wizards.BranchTagWizard) SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) WizardDialog(org.eclipse.jface.wizard.WizardDialog) SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 24 with SVNRevision

use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.

the class SwitchAction method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    if (action != null && !action.isEnabled()) {
        action.setEnabled(true);
    } else {
        IResource[] resources = getSelectedResources();
        // Use different wizard page name if multiple resources selected so that
        // page size and location will be saved and restored separately for
        // single selection switch and multiple selection switch.
        String pageName;
        if (resources.length > 1)
            pageName = "SwitchDialogWithConflictHandling.multiple";
        else
            // $NON-NLS-1$
            pageName = "SwitchDialogWithConflictHandling";
        SvnWizardSwitchPage switchPage = new SvnWizardSwitchPage(pageName, resources);
        SvnWizard wizard = new SvnWizard(switchPage);
        SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
        wizard.setParentDialog(dialog);
        if (dialog.open() == SvnWizardDialog.OK) {
            SVNUrl[] svnUrls = switchPage.getUrls();
            SVNRevision svnRevision = switchPage.getRevision();
            SwitchOperation switchOperation = new SwitchOperation(getTargetPart(), resources, svnUrls, svnRevision);
            switchOperation.setDepth(switchPage.getDepth());
            switchOperation.setSetDepth(switchPage.isSetDepth());
            switchOperation.setIgnoreExternals(switchPage.isIgnoreExternals());
            switchOperation.setForce(switchPage.isForce());
            switchOperation.setIgnoreAncestry(switchPage.isIgnoreAncestry());
            switchOperation.setCanRunAsJob(canRunAsJob);
            switchOperation.setConflictResolver(switchPage.getConflictResolver());
            switchOperation.run();
        }
    }
}
Also used : SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) SvnWizardSwitchPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardSwitchPage) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) IResource(org.eclipse.core.resources.IResource) SwitchOperation(org.tigris.subversion.subclipse.ui.operations.SwitchOperation)

Example 25 with SVNRevision

use of org.tigris.subversion.svnclientadapter.SVNRevision 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());
    }
}
Also used : RevisionGraphEditorInput(org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput) GraphBackgroundTask(org.tigris.subversion.subclipse.graph.editors.GraphBackgroundTask) Node(org.tigris.subversion.subclipse.graph.cache.Node) RevisionEditPart(org.tigris.subversion.subclipse.graph.editors.RevisionEditPart) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) IResource(org.eclipse.core.resources.IResource)

Aggregations

SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)48 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)22 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)17 IResource (org.eclipse.core.resources.IResource)15 TeamException (org.eclipse.team.core.TeamException)15 SVNException (org.tigris.subversion.subclipse.core.SVNException)14 InvocationTargetException (java.lang.reflect.InvocationTargetException)12 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)12 File (java.io.File)9 CoreException (org.eclipse.core.runtime.CoreException)9 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)9 ArrayList (java.util.ArrayList)8 ISelection (org.eclipse.jface.viewers.ISelection)8 ILogEntry (org.tigris.subversion.subclipse.core.history.ILogEntry)8 PartInitException (org.eclipse.ui.PartInitException)7 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)7 RemoteFile (org.tigris.subversion.subclipse.core.resources.RemoteFile)7 ParseException (java.text.ParseException)6 Action (org.eclipse.jface.action.Action)6