Search in sources :

Example 6 with GitSubscriberResourceMappingContext

use of org.eclipse.egit.core.synchronize.GitSubscriberResourceMappingContext in project egit by eclipse.

the class GitChangeSetContentProvider method getTraversals.

@Override
protected ResourceTraversal[] getTraversals(ISynchronizationContext context, Object object) {
    if (object instanceof IAdaptable) {
        if (traversalCache.containsKey(object)) {
            return traversalCache.get(object);
        }
        ResourceMapping rm = getResourceMapping(object);
        if (rm == null) {
            return null;
        }
        GitSubscriberMergeContext ctx = (GitSubscriberMergeContext) getContext();
        ResourceMappingContext rmCtx = new GitSubscriberResourceMappingContext((GitResourceVariantTreeSubscriber) ctx.getSubscriber(), ctx.getSyncData());
        try {
            ResourceTraversal[] traversals = rm.getTraversals(rmCtx, new NullProgressMonitor());
            traversalCache.put(object, traversals);
            return traversals;
        } catch (CoreException e) {
            Activator.logError(e.getMessage(), e);
        }
    }
    return null;
}
Also used : ResourceTraversal(org.eclipse.core.resources.mapping.ResourceTraversal) IAdaptable(org.eclipse.core.runtime.IAdaptable) GitSubscriberResourceMappingContext(org.eclipse.egit.core.synchronize.GitSubscriberResourceMappingContext) ResourceMappingContext(org.eclipse.core.resources.mapping.ResourceMappingContext) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) GitSubscriberResourceMappingContext(org.eclipse.egit.core.synchronize.GitSubscriberResourceMappingContext) CoreException(org.eclipse.core.runtime.CoreException) ResourceMapping(org.eclipse.core.resources.mapping.ResourceMapping) GitSubscriberMergeContext(org.eclipse.egit.core.synchronize.GitSubscriberMergeContext)

Example 7 with GitSubscriberResourceMappingContext

use of org.eclipse.egit.core.synchronize.GitSubscriberResourceMappingContext in project egit by eclipse.

the class GitContainerMapping method getTraversals.

@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
    GitModelObject[] children = ((GitModelObjectContainer) getModelObject()).getChildren();
    Set<ResourceTraversal> result = new LinkedHashSet<>();
    final GitSynchronizeDataSet dataSet;
    if (context instanceof GitSubscriberResourceMappingContext)
        dataSet = ((GitSubscriberResourceMappingContext) context).getSyncData();
    else
        dataSet = null;
    for (GitModelObject child : children) {
        if (child.isContainer())
            result.addAll(createTraversalForContainer(child, dataSet));
        else
            result.add(createTraversalForFile(child, dataSet));
    }
    return result.toArray(new ResourceTraversal[result.size()]);
}
Also used : ResourceTraversal(org.eclipse.core.resources.mapping.ResourceTraversal) LinkedHashSet(java.util.LinkedHashSet) GitSynchronizeDataSet(org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet) GitSubscriberResourceMappingContext(org.eclipse.egit.core.synchronize.GitSubscriberResourceMappingContext) GitModelObjectContainer(org.eclipse.egit.ui.internal.synchronize.model.GitModelObjectContainer) GitModelObject(org.eclipse.egit.ui.internal.synchronize.model.GitModelObject)

Aggregations

GitSubscriberResourceMappingContext (org.eclipse.egit.core.synchronize.GitSubscriberResourceMappingContext)7 GitSynchronizeDataSet (org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet)4 ResourceMapping (org.eclipse.core.resources.mapping.ResourceMapping)3 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 GitResourceVariantTreeSubscriber (org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriber)3 GitSubscriberMergeContext (org.eclipse.egit.core.synchronize.GitSubscriberMergeContext)3 GitSynchronizeData (org.eclipse.egit.core.synchronize.dto.GitSynchronizeData)3 IOException (java.io.IOException)2 ResourceMappingContext (org.eclipse.core.resources.mapping.ResourceMappingContext)2 ResourceTraversal (org.eclipse.core.resources.mapping.ResourceTraversal)2 GitModelObject (org.eclipse.egit.ui.internal.synchronize.model.GitModelObject)2 SubscriberScopeManager (org.eclipse.team.core.subscribers.SubscriberScopeManager)2 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 IResource (org.eclipse.core.resources.IResource)1 WorkspaceJob (org.eclipse.core.resources.WorkspaceJob)1 ModelProvider (org.eclipse.core.resources.mapping.ModelProvider)1 RemoteResourceMappingContext (org.eclipse.core.resources.mapping.RemoteResourceMappingContext)1 CoreException (org.eclipse.core.runtime.CoreException)1 IAdaptable (org.eclipse.core.runtime.IAdaptable)1