Search in sources :

Example 1 with RevisionGraphEditorInput

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());
        }
    }
}
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 RevisionGraphEditorInput

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());
    }
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) RevisionGraphEditorInput(org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput) DifferencesDialog(org.tigris.subversion.subclipse.ui.dialogs.DifferencesDialog) RemoteFolder(org.tigris.subversion.subclipse.core.resources.RemoteFolder) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile)

Example 3 with RevisionGraphEditorInput

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);
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) RevisionGraphEditorInput(org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput) TeamException(org.eclipse.team.core.TeamException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 4 with RevisionGraphEditorInput

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);
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) RevisionGraphEditorInput(org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 5 with RevisionGraphEditorInput

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());
    }
}
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

RevisionGraphEditorInput (org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput)7 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)5 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 IResource (org.eclipse.core.resources.IResource)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)3 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)3 ISVNInfo (org.tigris.subversion.svnclientadapter.ISVNInfo)3 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)3 RemoteFile (org.tigris.subversion.subclipse.core.resources.RemoteFile)2 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 TeamException (org.eclipse.team.core.TeamException)1 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)1 SVNException (org.tigris.subversion.subclipse.core.SVNException)1 ChangeCommitPropertiesCommand (org.tigris.subversion.subclipse.core.commands.ChangeCommitPropertiesCommand)1 GetLogsCommand (org.tigris.subversion.subclipse.core.commands.GetLogsCommand)1 Alias (org.tigris.subversion.subclipse.core.history.Alias)1 AliasManager (org.tigris.subversion.subclipse.core.history.AliasManager)1 RemoteFolder (org.tigris.subversion.subclipse.core.resources.RemoteFolder)1