use of org.eclipse.egit.core.EclipseGitProgressTransformer in project egit by eclipse.
the class SubmoduleAddOperation method execute.
@Override
public void execute(IProgressMonitor monitor) throws CoreException {
IWorkspaceRunnable action = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor pm) throws CoreException {
final SubmoduleAddCommand add = Git.wrap(repo).submoduleAdd();
add.setProgressMonitor(new EclipseGitProgressTransformer(pm));
add.setPath(path);
add.setURI(uri);
try {
Repository subRepo = add.call();
if (subRepo != null) {
subRepo.close();
repo.notifyIndexChanged();
}
} catch (GitAPIException e) {
throw new TeamException(e.getLocalizedMessage(), e.getCause());
}
}
};
ResourcesPlugin.getWorkspace().run(action, getSchedulingRule(), IWorkspace.AVOID_UPDATE, monitor);
}
use of org.eclipse.egit.core.EclipseGitProgressTransformer in project egit by eclipse.
the class FetchOperation method run.
/**
* @param monitor
* @throws InvocationTargetException
*/
public void run(IProgressMonitor monitor) throws InvocationTargetException {
if (operationResult != null)
throw new IllegalStateException(CoreText.OperationAlreadyExecuted);
EclipseGitProgressTransformer gitMonitor = new EclipseGitProgressTransformer(monitor);
try (Git git = new Git(repository)) {
FetchCommand command;
if (rc == null)
command = git.fetch().setRemote(uri.toPrivateString()).setRefSpecs(specs);
else
command = git.fetch().setRemote(rc.getName());
command.setCredentialsProvider(credentialsProvider).setTimeout(timeout).setDryRun(dryRun).setProgressMonitor(gitMonitor);
if (tagOpt != null)
command.setTagOpt(tagOpt);
try {
operationResult = command.call();
} catch (JGitInternalException e) {
throw new InvocationTargetException(e.getCause() != null ? e.getCause() : e);
} catch (Exception e) {
throw new InvocationTargetException(e);
}
}
}
Aggregations