use of org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet in project egit by eclipse.
the class GitChangeSetModelProvider method getMappings.
@Override
public ResourceMapping[] getMappings(IResource resource, ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
if (context instanceof GitSubscriberResourceMappingContext) {
GitSubscriberResourceMappingContext gitContext = (GitSubscriberResourceMappingContext) context;
GitSynchronizeDataSet gsds = gitContext.getSyncData();
GitSynchronizeData data = gsds.getData(resource.getProject());
if (data != null) {
GitModelObject object = null;
try {
object = GitModelObject.createRoot(data);
} catch (IOException e) {
Activator.logError(e.getMessage(), e);
}
if (object != null) {
ResourceMapping rm = AdapterUtils.adapt(object, ResourceMapping.class);
return new ResourceMapping[] { rm };
}
}
}
return super.getMappings(resource, context, monitor);
}
use of org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet in project egit by eclipse.
the class GitModelSynchronizeParticipant method init.
@Override
public void init(String secondaryId, IMemento memento) throws PartInitException {
try {
boolean forceFetchPref = Activator.getDefault().getPreferenceStore().getBoolean(UIPreferences.SYNC_VIEW_FETCH_BEFORE_LAUNCH);
boolean forceFetch = getBoolean(memento.getBoolean(FORCE_FETCH_KEY), forceFetchPref);
gsds = new GitSynchronizeDataSet(forceFetch);
IMemento[] children = memento.getChildren(DATA_NODE_KEY);
if (children != null)
restoreSynchronizationData(children);
} finally {
super.init(secondaryId, memento);
}
}
use of org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet in project egit by eclipse.
the class GitSynchronizeWizard method performFinish.
@Override
public boolean performFinish() {
GitSynchronizeDataSet gsdSet = new GitSynchronizeDataSet(page.forceFetch());
Map<Repository, String> branches = page.getSelectedBranches();
boolean shouldIncludeLocal = page.shouldIncludeLocal();
for (Entry<Repository, String> branchesEntry : branches.entrySet()) try {
Repository repo = branchesEntry.getKey();
GitSynchronizeData data = new GitSynchronizeData(repo, HEAD, branchesEntry.getValue(), shouldIncludeLocal);
Set<IResource> resources = getSelectedResources(repo);
if (resources != null && resources.size() > 0)
data.setIncludedResources(resources);
gsdSet.add(data);
} catch (IOException e) {
Activator.logError(e.getMessage(), e);
}
Set<IProject> selectedProjects = page.getSelectedProjects();
GitModelSynchronize.launch(gsdSet, selectedProjects.toArray(new IResource[selectedProjects.size()]));
return true;
}
use of org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet in project egit by eclipse.
the class ModelAwareGitSynchronizer method createResourceMappingContext.
/**
* @param resources
* @param repository
* @param leftRev
* @param rightRev
* @param includeLocal
* @param monitor
* @return A resource mapping context to access the versions of the content
* of the resources involved in the synchronization.
*/
protected ResourceMappingContext createResourceMappingContext(Set<IResource> resources, Repository repository, String leftRev, String rightRev, boolean includeLocal, IProgressMonitor monitor) {
try {
GitSynchronizeData gsd = new GitSynchronizeData(repository, leftRev, rightRev, includeLocal, resources);
GitSynchronizeDataSet gsds = new GitSynchronizeDataSet(gsd);
GitLazyResourceVariantTreeSubscriber subscriber = new GitLazyResourceVariantTreeSubscriber(gsds);
subscriber.init(monitor);
return new GitSubscriberResourceMappingContext(subscriber, gsds);
} catch (IOException e) {
Activator.logError(e.getMessage(), e);
}
return ResourceMappingContext.LOCAL_CONTEXT;
}
use of org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet in project egit by eclipse.
the class GitModelRootTest method shouldIgnoreEmptyRepositories.
@Test
public void shouldIgnoreEmptyRepositories() throws Exception {
// given
touchAndSubmit("second commit");
GitSynchronizeDataSet gsds = new GitSynchronizeDataSet();
gsds.add(new GitSynchronizeData(repo1, HEAD, HEAD + "^1", false));
gsds.add(new GitSynchronizeData(repo2, HEAD, HEAD, false));
// when
GitModelRoot root = new GitModelRoot(gsds);
// then
assertThat(Integer.valueOf(root.getChildren().length), is(Integer.valueOf(1)));
}
Aggregations