Lines 10-20
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.team.internal.ui.synchronize.patch; |
11 |
package org.eclipse.team.internal.ui.synchronize.patch; |
12 |
|
12 |
|
13 |
import java.util.*; |
|
|
14 |
|
15 |
import org.eclipse.compare.internal.patch.PatchDiffNode; |
13 |
import org.eclipse.compare.internal.patch.PatchDiffNode; |
16 |
import org.eclipse.compare.structuremergeviewer.IDiffElement; |
14 |
import org.eclipse.compare.structuremergeviewer.IDiffElement; |
17 |
import org.eclipse.core.resources.IProject; |
|
|
18 |
import org.eclipse.core.resources.IResource; |
15 |
import org.eclipse.core.resources.IResource; |
19 |
import org.eclipse.core.resources.mapping.*; |
16 |
import org.eclipse.core.resources.mapping.*; |
20 |
import org.eclipse.core.runtime.CoreException; |
17 |
import org.eclipse.core.runtime.CoreException; |
Lines 23-42
import org.eclipse.jface.viewers.ITreeContentProvider;
Link Here
|
23 |
import org.eclipse.team.core.mapping.ISynchronizationContext; |
20 |
import org.eclipse.team.core.mapping.ISynchronizationContext; |
24 |
import org.eclipse.team.core.mapping.ISynchronizationScope; |
21 |
import org.eclipse.team.core.mapping.ISynchronizationScope; |
25 |
import org.eclipse.team.internal.ui.TeamUIPlugin; |
22 |
import org.eclipse.team.internal.ui.TeamUIPlugin; |
26 |
import org.eclipse.team.internal.ui.Utils; |
|
|
27 |
import org.eclipse.team.internal.ui.mapping.SynchronizationResourceMappingContext; |
23 |
import org.eclipse.team.internal.ui.mapping.SynchronizationResourceMappingContext; |
28 |
import org.eclipse.team.ui.mapping.SynchronizationContentProvider; |
24 |
import org.eclipse.team.ui.mapping.SynchronizationContentProvider; |
29 |
import org.eclipse.ui.navigator.*; |
25 |
import org.eclipse.ui.navigator.ICommonContentExtensionSite; |
30 |
|
26 |
|
31 |
public class PatchSyncContentProvider extends SynchronizationContentProvider |
27 |
public class PatchSyncContentProvider extends SynchronizationContentProvider { |
32 |
implements IPipelinedTreeContentProvider { |
|
|
33 |
|
28 |
|
34 |
private PatchWorkbenchContentProvider delegate; |
29 |
private PatchWorkbenchContentProvider delegate; |
35 |
|
30 |
|
36 |
public PatchSyncContentProvider() { |
|
|
37 |
super(); |
38 |
} |
39 |
|
40 |
public void init(ICommonContentExtensionSite site) { |
31 |
public void init(ICommonContentExtensionSite site) { |
41 |
super.init(site); |
32 |
super.init(site); |
42 |
delegate = new PatchWorkbenchContentProvider(/*getPatcher()*/); |
33 |
delegate = new PatchWorkbenchContentProvider(/*getPatcher()*/); |
Lines 56-62
public class PatchSyncContentProvider extends SynchronizationContentProvider
Link Here
|
56 |
protected String getModelProviderId() { |
47 |
protected String getModelProviderId() { |
57 |
return PatchModelProvider.ID; |
48 |
return PatchModelProvider.ID; |
58 |
} |
49 |
} |
59 |
|
50 |
|
60 |
protected Object getModelRoot() { |
51 |
protected Object getModelRoot() { |
61 |
return PatchWorkspace.getInstance(); |
52 |
return PatchWorkspace.getInstance(); |
62 |
} |
53 |
} |
Lines 93-165
public class PatchSyncContentProvider extends SynchronizationContentProvider
Link Here
|
93 |
return super.getChildrenInContext(context, parent, children); |
84 |
return super.getChildrenInContext(context, parent, children); |
94 |
} |
85 |
} |
95 |
|
86 |
|
96 |
public void getPipelinedChildren(Object aParent, Set theCurrentChildren) { |
|
|
97 |
// Nothing to do |
98 |
} |
99 |
|
100 |
public void getPipelinedElements(Object anInput, Set theCurrentElements) { |
101 |
if (anInput instanceof ISynchronizationContext) { |
102 |
// Do not show hunks when all models are visible |
103 |
//XXX |
104 |
return; |
105 |
} else if (anInput == getModelProvider()) { |
106 |
List newProjects = new ArrayList(); |
107 |
for (Iterator iter = theCurrentElements.iterator(); iter.hasNext();) { |
108 |
Object element = iter.next(); |
109 |
IResource[] resources = Utils.getContributedResources(new Object[] {element}); |
110 |
//TODO: what about the rest? |
111 |
IResource resource = resources[0]; |
112 |
if (resource instanceof IProject) { |
113 |
IProject project = (IProject) resource; |
114 |
IDiffElement diffProject = PatchModelProvider.getModelObject(project/*, getPatcher()*/); |
115 |
if (diffProject != null) { |
116 |
iter.remove(); |
117 |
newProjects.add(diffProject); |
118 |
} |
119 |
} |
120 |
} |
121 |
theCurrentElements.addAll(newProjects); |
122 |
} else if (anInput instanceof ISynchronizationScope) { |
123 |
// When the root is a scope, we should return |
124 |
// our model provider so all model providers appear |
125 |
// at the root of the viewer. |
126 |
theCurrentElements.add(getModelProvider()); |
127 |
} |
128 |
} |
129 |
|
130 |
public Object getPipelinedParent(Object anObject, Object aSuggestedParent) { |
131 |
// TODO Auto-generated method stub |
132 |
System.out |
133 |
.println(">> [aSuggestedParent] PatchSyncContentProvider.getPipelinedParent: aSuggestedParent-> " + aSuggestedParent); //$NON-NLS-1$ |
134 |
return aSuggestedParent; |
135 |
} |
136 |
|
137 |
public PipelinedShapeModification interceptAdd( |
138 |
PipelinedShapeModification anAddModification) { |
139 |
// TODO Auto-generated method stub |
140 |
System.out |
141 |
.println(">> [null] PatchSyncContentProvider.interceptAdd: anAddModification-> " + anAddModification); //$NON-NLS-1$ |
142 |
return null; |
143 |
} |
144 |
|
145 |
public boolean interceptRefresh( |
146 |
PipelinedViewerUpdate aRefreshSynchronization) { |
147 |
// No need to intercept the refresh |
148 |
return false; |
149 |
} |
150 |
|
151 |
public PipelinedShapeModification interceptRemove( |
152 |
PipelinedShapeModification aRemoveModification) { |
153 |
return aRemoveModification; |
154 |
} |
155 |
|
156 |
public boolean interceptUpdate(PipelinedViewerUpdate anUpdateSynchronization) { |
157 |
// No need to intercept the update |
158 |
System.out |
159 |
.println(">> [false] PatchSyncContentProvider.interceptUpdate: anUpdateSynchronization-> " + anUpdateSynchronization); //$NON-NLS-1$ |
160 |
return false; |
161 |
} |
162 |
|
163 |
protected boolean isInScope(ISynchronizationScope scope, Object parent, |
87 |
protected boolean isInScope(ISynchronizationScope scope, Object parent, |
164 |
Object element) { |
88 |
Object element) { |
165 |
if (element instanceof PatchDiffNode) { |
89 |
if (element instanceof PatchDiffNode) { |