Search in sources :

Example 1 with StashDropCommand

use of org.eclipse.jgit.api.StashDropCommand in project egit by eclipse.

the class StashDropOperation method execute.

@Override
public void execute(IProgressMonitor monitor) throws CoreException {
    IWorkspaceRunnable action = new IWorkspaceRunnable() {

        @Override
        public void run(IProgressMonitor pm) throws CoreException {
            StashDropCommand command = Git.wrap(repo).stashDrop();
            command.setStashRef(index);
            try {
                command.call();
                repo.fireEvent(new RefsChangedEvent());
            } catch (JGitInternalException e) {
                throw new TeamException(e.getLocalizedMessage(), e.getCause());
            } catch (GitAPIException e) {
                throw new TeamException(e.getLocalizedMessage(), e.getCause());
            }
        }
    };
    ResourcesPlugin.getWorkspace().run(action, getSchedulingRule(), IWorkspace.AVOID_UPDATE, monitor);
}
Also used : GitAPIException(org.eclipse.jgit.api.errors.GitAPIException) IWorkspaceRunnable(org.eclipse.core.resources.IWorkspaceRunnable) TeamException(org.eclipse.team.core.TeamException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) JGitInternalException(org.eclipse.jgit.api.errors.JGitInternalException) RefsChangedEvent(org.eclipse.jgit.events.RefsChangedEvent) StashDropCommand(org.eclipse.jgit.api.StashDropCommand)

Aggregations

IWorkspaceRunnable (org.eclipse.core.resources.IWorkspaceRunnable)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 StashDropCommand (org.eclipse.jgit.api.StashDropCommand)1 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)1 JGitInternalException (org.eclipse.jgit.api.errors.JGitInternalException)1 RefsChangedEvent (org.eclipse.jgit.events.RefsChangedEvent)1 TeamException (org.eclipse.team.core.TeamException)1