use of org.eclipse.egit.gitflow.op.FeatureListOperation in project egit by eclipse.
the class FeatureTrackHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
if (gfRepo == null) {
return error(UIText.Handlers_noGitflowRepositoryFound);
}
final List<Ref> refs = new ArrayList<Ref>();
Shell activeShell = HandlerUtil.getActiveShell(event);
int timeout = Activator.getDefault().getPreferenceStore().getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT);
FeatureListOperation featureListOperation = new FeatureListOperation(gfRepo, timeout);
JobUtil.scheduleUserWorkspaceJob(featureListOperation, UIText.FeatureTrackHandler_fetchingRemoteFeatures, GITFLOW_FAMILY);
IJobManager jobMan = Job.getJobManager();
try {
jobMan.join(GITFLOW_FAMILY, null);
} catch (OperationCanceledException | InterruptedException e) {
return error(e.getMessage(), e);
}
List<Ref> remoteFeatures = featureListOperation.getResult();
if (remoteFeatures.isEmpty()) {
MessageDialog.openInformation(activeShell, UIText.FeatureTrackHandler_noRemoteFeatures, UIText.FeatureTrackHandler_noRemoteFeaturesFoundOnTheConfiguredRemote);
}
refs.addAll(remoteFeatures);
FeatureBranchSelectionDialog dialog = new FeatureBranchSelectionDialog(HandlerUtil.getActiveShell(event), refs, UIText.FeatureCheckoutHandler_selectFeature, UIText.FeatureTrackHandler_remoteFeatures, R_REMOTES + DEFAULT_REMOTE_NAME + SEP + gfRepo.getConfig().getFeaturePrefix(), gfRepo);
if (dialog.open() != Window.OK) {
return Status.CANCEL_STATUS;
}
Ref ref = dialog.getSelectedNode();
FeatureTrackOperation featureTrackOperation = new FeatureTrackOperation(gfRepo, ref, timeout);
JobUtil.scheduleUserWorkspaceJob(featureTrackOperation, UIText.FeatureTrackHandler_trackingFeature, GITFLOW_FAMILY);
return null;
}
Aggregations