use of org.eclipse.jgit.api.StashApplyCommand in project egit by eclipse.
the class StashApplyOperation method execute.
@Override
public void execute(IProgressMonitor monitor) throws CoreException {
IWorkspaceRunnable action = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor pm) throws CoreException {
SubMonitor progress = SubMonitor.convert(pm, 3);
try {
IProject[] validProjects = ProjectUtil.getValidOpenProjects(repository);
progress.worked(1);
StashApplyCommand command = Git.wrap(repository).stashApply().setStashRef(commit.name());
MergeStrategy strategy = Activator.getDefault().getPreferredMergeStrategy();
if (strategy != null) {
command.setStrategy(strategy);
}
command.call();
progress.worked(1);
ProjectUtil.refreshValidProjects(validProjects, progress.newChild(1));
} 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);
}
Aggregations