Search in sources :

Example 1 with RepositoryJob

use of org.eclipse.egit.ui.internal.jobs.RepositoryJob in project egit by eclipse.

the class FetchOperationUI method start.

/**
 * Starts the operation asynchronously showing a confirmation dialog after
 * completion
 */
public void start() {
    final Repository repo = repository;
    if (repo == null) {
        return;
    }
    Job job = new RepositoryJob(NLS.bind(UIText.FetchOperationUI_FetchJobName, sourceString), UIPreferences.SHOW_FETCH_POPUP_SUCCESS) {

        private FetchResult result;

        @Override
        public IStatus performJob(IProgressMonitor monitor) {
            try {
                result = execute(monitor);
            } catch (CoreException e) {
                return Activator.createErrorStatus(e.getStatus().getMessage(), e);
            }
            return Status.OK_STATUS;
        }

        @Override
        protected IAction getAction() {
            return new ShowResultAction(repo, result, sourceString);
        }

        @Override
        public boolean belongsTo(Object family) {
            if (JobFamilies.FETCH.equals(family)) {
                return true;
            }
            return super.belongsTo(family);
        }
    };
    job.setUser(true);
    job.schedule();
}
Also used : Repository(org.eclipse.jgit.lib.Repository) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) FetchResult(org.eclipse.jgit.transport.FetchResult) CoreException(org.eclipse.core.runtime.CoreException) RepositoryJob(org.eclipse.egit.ui.internal.jobs.RepositoryJob) Job(org.eclipse.core.runtime.jobs.Job) RepositoryJob(org.eclipse.egit.ui.internal.jobs.RepositoryJob)

Aggregations

CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Job (org.eclipse.core.runtime.jobs.Job)1 RepositoryJob (org.eclipse.egit.ui.internal.jobs.RepositoryJob)1 Repository (org.eclipse.jgit.lib.Repository)1 FetchResult (org.eclipse.jgit.transport.FetchResult)1