Search in sources :

Example 1 with NodeTooltipFigure

use of org.tigris.subversion.subclipse.graph.editors.NodeTooltipFigure in project subclipse by subclipse.

the class SetCommitPropertiesAction method run.

public void run() {
    try {
        IResource resource = ((RevisionGraphEditorInput) editor.getEditorInput()).getResource();
        ISVNRemoteResource remoteResource = ((RevisionGraphEditorInput) editor.getEditorInput()).getRemoteResource();
        ISVNInfo info = ((RevisionGraphEditorInput) editor.getEditorInput()).getInfo();
        final ProjectProperties projectProperties = (resource != null) ? ProjectProperties.getProjectProperties(resource) : ProjectProperties.getProjectProperties(remoteResource);
        SVNRevision.Number revision = new SVNRevision.Number(node.getRevision());
        SetCommitPropertiesDialog dialog = new SetCommitPropertiesDialog(Display.getDefault().getActiveShell(), revision, resource, projectProperties);
        dialog.setOldAuthor(node.getAuthor());
        dialog.setOldComment(node.getMessage());
        if (dialog.open() == SetCommitPropertiesDialog.OK) {
            final String author;
            final String commitComment;
            if (node.getAuthor().equals(dialog.getAuthor()))
                author = null;
            else
                author = dialog.getAuthor();
            if (node.getMessage().equals(dialog.getComment()))
                commitComment = null;
            else
                commitComment = dialog.getComment();
            ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(info.getRepository().toString());
            final ChangeCommitPropertiesCommand command = new ChangeCommitPropertiesCommand(repository, revision, commitComment, author);
            PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {

                public void run(IProgressMonitor monitor) throws InvocationTargetException {
                    try {
                        command.run(monitor);
                    } catch (SVNException e) {
                        throw new InvocationTargetException(e);
                    } finally {
                        if (command.isAuthorChanged())
                            node.setAuthor(author);
                        if (command.isLogMessageChanged())
                            node.setMessage(commitComment);
                        if (command.isAuthorChanged() || command.isLogMessageChanged()) {
                            nodeFigure.setToolTip(new NodeTooltipFigure(node));
                        }
                    }
                }
            });
        }
    } catch (Exception e) {
        SVNUIPlugin.openError(Display.getDefault().getActiveShell(), null, null, e, SVNUIPlugin.LOG_TEAM_EXCEPTIONS);
    }
}
Also used : NodeTooltipFigure(org.tigris.subversion.subclipse.graph.editors.NodeTooltipFigure) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) ProjectProperties(org.tigris.subversion.subclipse.ui.settings.ProjectProperties) SVNException(org.tigris.subversion.subclipse.core.SVNException) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException) SVNException(org.tigris.subversion.subclipse.core.SVNException) ChangeCommitPropertiesCommand(org.tigris.subversion.subclipse.core.commands.ChangeCommitPropertiesCommand) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) SetCommitPropertiesDialog(org.tigris.subversion.subclipse.ui.dialogs.SetCommitPropertiesDialog) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) RevisionGraphEditorInput(org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) IResource(org.eclipse.core.resources.IResource)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IResource (org.eclipse.core.resources.IResource)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)1 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)1 SVNException (org.tigris.subversion.subclipse.core.SVNException)1 ChangeCommitPropertiesCommand (org.tigris.subversion.subclipse.core.commands.ChangeCommitPropertiesCommand)1 NodeTooltipFigure (org.tigris.subversion.subclipse.graph.editors.NodeTooltipFigure)1 RevisionGraphEditorInput (org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput)1 SetCommitPropertiesDialog (org.tigris.subversion.subclipse.ui.dialogs.SetCommitPropertiesDialog)1 ProjectProperties (org.tigris.subversion.subclipse.ui.settings.ProjectProperties)1 ISVNInfo (org.tigris.subversion.svnclientadapter.ISVNInfo)1 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)1