Lines 22-34
Link Here
|
22 |
import java.io.InputStream; |
22 |
import java.io.InputStream; |
23 |
import java.net.URI; |
23 |
import java.net.URI; |
24 |
import java.net.URISyntaxException; |
24 |
import java.net.URISyntaxException; |
25 |
import java.util.*; |
25 |
import java.util.ArrayDeque; |
|
|
26 |
import java.util.ArrayList; |
27 |
import java.util.Arrays; |
28 |
import java.util.Collection; |
29 |
import java.util.Comparator; |
30 |
import java.util.Deque; |
31 |
import java.util.HashMap; |
32 |
import java.util.HashSet; |
33 |
import java.util.Iterator; |
34 |
import java.util.LinkedHashSet; |
35 |
import java.util.LinkedList; |
36 |
import java.util.List; |
37 |
import java.util.Map; |
38 |
import java.util.Set; |
39 |
import java.util.SortedSet; |
40 |
import java.util.TreeSet; |
26 |
import java.util.concurrent.CopyOnWriteArrayList; |
41 |
import java.util.concurrent.CopyOnWriteArrayList; |
27 |
import java.util.function.Predicate; |
42 |
import java.util.function.Predicate; |
|
|
43 |
|
28 |
import org.eclipse.core.filesystem.EFS; |
44 |
import org.eclipse.core.filesystem.EFS; |
29 |
import org.eclipse.core.filesystem.IFileStore; |
45 |
import org.eclipse.core.filesystem.IFileStore; |
30 |
import org.eclipse.core.filesystem.URIUtil; |
46 |
import org.eclipse.core.filesystem.URIUtil; |
31 |
import org.eclipse.core.internal.events.*; |
47 |
import org.eclipse.core.internal.events.BuildManager; |
|
|
48 |
import org.eclipse.core.internal.events.ILifecycleListener; |
49 |
import org.eclipse.core.internal.events.LifecycleEvent; |
50 |
import org.eclipse.core.internal.events.NotificationManager; |
51 |
import org.eclipse.core.internal.events.ResourceChangeEvent; |
52 |
import org.eclipse.core.internal.events.ResourceComparator; |
32 |
import org.eclipse.core.internal.localstore.FileSystemResourceManager; |
53 |
import org.eclipse.core.internal.localstore.FileSystemResourceManager; |
33 |
import org.eclipse.core.internal.preferences.PreferencesService; |
54 |
import org.eclipse.core.internal.preferences.PreferencesService; |
34 |
import org.eclipse.core.internal.properties.IPropertyManager; |
55 |
import org.eclipse.core.internal.properties.IPropertyManager; |
Lines 36-47
Link Here
|
36 |
import org.eclipse.core.internal.refresh.RefreshManager; |
57 |
import org.eclipse.core.internal.refresh.RefreshManager; |
37 |
import org.eclipse.core.internal.resources.ComputeProjectOrder.Digraph; |
58 |
import org.eclipse.core.internal.resources.ComputeProjectOrder.Digraph; |
38 |
import org.eclipse.core.internal.resources.ComputeProjectOrder.VertexOrder; |
59 |
import org.eclipse.core.internal.resources.ComputeProjectOrder.VertexOrder; |
39 |
import org.eclipse.core.internal.utils.*; |
60 |
import org.eclipse.core.internal.utils.Messages; |
40 |
import org.eclipse.core.internal.watson.*; |
61 |
import org.eclipse.core.internal.utils.Policy; |
41 |
import org.eclipse.core.resources.*; |
62 |
import org.eclipse.core.internal.utils.StringPoolJob; |
42 |
import org.eclipse.core.resources.team.*; |
63 |
import org.eclipse.core.internal.watson.ElementTree; |
43 |
import org.eclipse.core.runtime.*; |
64 |
import org.eclipse.core.internal.watson.ElementTreeIterator; |
44 |
import org.eclipse.core.runtime.jobs.*; |
65 |
import org.eclipse.core.internal.watson.IElementContentVisitor; |
|
|
66 |
import org.eclipse.core.resources.IBuildConfiguration; |
67 |
import org.eclipse.core.resources.IContainer; |
68 |
import org.eclipse.core.resources.IFile; |
69 |
import org.eclipse.core.resources.IFileModificationValidator; |
70 |
import org.eclipse.core.resources.IFilterMatcherDescriptor; |
71 |
import org.eclipse.core.resources.IMarker; |
72 |
import org.eclipse.core.resources.IPathVariableManager; |
73 |
import org.eclipse.core.resources.IProject; |
74 |
import org.eclipse.core.resources.IProjectDescription; |
75 |
import org.eclipse.core.resources.IProjectNatureDescriptor; |
76 |
import org.eclipse.core.resources.IResource; |
77 |
import org.eclipse.core.resources.IResourceChangeEvent; |
78 |
import org.eclipse.core.resources.IResourceChangeListener; |
79 |
import org.eclipse.core.resources.IResourceRuleFactory; |
80 |
import org.eclipse.core.resources.IResourceStatus; |
81 |
import org.eclipse.core.resources.ISaveContext; |
82 |
import org.eclipse.core.resources.ISaveParticipant; |
83 |
import org.eclipse.core.resources.ISavedState; |
84 |
import org.eclipse.core.resources.ISynchronizer; |
85 |
import org.eclipse.core.resources.IWorkspace; |
86 |
import org.eclipse.core.resources.IWorkspaceDescription; |
87 |
import org.eclipse.core.resources.IWorkspaceRoot; |
88 |
import org.eclipse.core.resources.IWorkspaceRunnable; |
89 |
import org.eclipse.core.resources.IncrementalProjectBuilder; |
90 |
import org.eclipse.core.resources.ProjectScope; |
91 |
import org.eclipse.core.resources.ResourcesPlugin; |
92 |
import org.eclipse.core.resources.team.FileModificationValidationContext; |
93 |
import org.eclipse.core.resources.team.FileModificationValidator; |
94 |
import org.eclipse.core.resources.team.IMoveDeleteHook; |
95 |
import org.eclipse.core.resources.team.TeamHook; |
96 |
import org.eclipse.core.runtime.Assert; |
97 |
import org.eclipse.core.runtime.CoreException; |
98 |
import org.eclipse.core.runtime.IConfigurationElement; |
99 |
import org.eclipse.core.runtime.ICoreRunnable; |
100 |
import org.eclipse.core.runtime.IPath; |
101 |
import org.eclipse.core.runtime.IProgressMonitor; |
102 |
import org.eclipse.core.runtime.ISafeRunnable; |
103 |
import org.eclipse.core.runtime.IStatus; |
104 |
import org.eclipse.core.runtime.MultiStatus; |
105 |
import org.eclipse.core.runtime.NullProgressMonitor; |
106 |
import org.eclipse.core.runtime.OperationCanceledException; |
107 |
import org.eclipse.core.runtime.Path; |
108 |
import org.eclipse.core.runtime.Platform; |
109 |
import org.eclipse.core.runtime.PlatformObject; |
110 |
import org.eclipse.core.runtime.Plugin; |
111 |
import org.eclipse.core.runtime.SafeRunner; |
112 |
import org.eclipse.core.runtime.Status; |
113 |
import org.eclipse.core.runtime.SubMonitor; |
114 |
import org.eclipse.core.runtime.jobs.ISchedulingRule; |
115 |
import org.eclipse.core.runtime.jobs.Job; |
116 |
import org.eclipse.core.runtime.jobs.JobGroup; |
45 |
import org.eclipse.osgi.util.NLS; |
117 |
import org.eclipse.osgi.util.NLS; |
46 |
import org.osgi.framework.Bundle; |
118 |
import org.osgi.framework.Bundle; |
47 |
import org.xml.sax.InputSource; |
119 |
import org.xml.sax.InputSource; |
Lines 188-193
Link Here
|
188 |
protected IFileModificationValidator validator = null; |
260 |
protected IFileModificationValidator validator = null; |
189 |
|
261 |
|
190 |
/** |
262 |
/** |
|
|
263 |
* Map K(new resource node Id (Long)) V(old resource (Resource)) used to |
264 |
* find the resource that was copied from. Used only during Resource.copy() |
265 |
* We use the nodeId as the key so we don't have to create a resource |
266 |
* when checking the map during delta computation. The value can be a resource |
267 |
* because that's already available during the copy. |
268 |
* |
269 |
* The copyMap is created automatically when first written to, and removed at |
270 |
* the end of the top level operation if it exists. |
271 |
* |
272 |
* fix bug 217489 |
273 |
*/ |
274 |
protected Map<Long, IResource> copyMap; |
275 |
|
276 |
/** |
191 |
* Data structure for holding the multi-part outcome of |
277 |
* Data structure for holding the multi-part outcome of |
192 |
* <code>IWorkspace.computeProjectBuildConfigOrder</code>. |
278 |
* <code>IWorkspace.computeProjectBuildConfigOrder</code>. |
193 |
* <p> |
279 |
* <p> |
Lines 1139-1144
Link Here
|
1139 |
project.writeDescription(updateFlags); |
1225 |
project.writeDescription(updateFlags); |
1140 |
} |
1226 |
} |
1141 |
|
1227 |
|
|
|
1228 |
// For tracking COPIED_FROM |
1229 |
getCopyMap().put(Long.valueOf(newInfo.getNodeId()), source); |
1230 |
|
1142 |
// do the recursion. if we have a file then it has no members so return. otherwise |
1231 |
// do the recursion. if we have a file then it has no members so return. otherwise |
1143 |
// recursively call this method on the container's members if the depth tells us to |
1232 |
// recursively call this method on the container's members if the depth tells us to |
1144 |
if (depth == IResource.DEPTH_ZERO || source.getType() == IResource.FILE) |
1233 |
if (depth == IResource.DEPTH_ZERO || source.getType() == IResource.FILE) |
Lines 1195-1201
Link Here
|
1195 |
|
1284 |
|
1196 |
IPath srcValue = URIUtil.toPath(srcPathVariableManager.getURIValue(variable)); |
1285 |
IPath srcValue = URIUtil.toPath(srcPathVariableManager.getURIValue(variable)); |
1197 |
if (srcValue == null) // if the variable doesn't exist, return another |
1286 |
if (srcValue == null) // if the variable doesn't exist, return another |
1198 |
// variable that doesn't exist either |
1287 |
// variable that doesn't exist either |
1199 |
return PathVariableUtil.getUniqueVariableName(variable, dest); |
1288 |
return PathVariableUtil.getUniqueVariableName(variable, dest); |
1200 |
IPath resolvedSrcValue = URIUtil.toPath(srcPathVariableManager.resolveURI(URIUtil.toURI(srcValue))); |
1289 |
IPath resolvedSrcValue = URIUtil.toPath(srcPathVariableManager.resolveURI(URIUtil.toURI(srcValue))); |
1201 |
|
1290 |
|
Lines 1276-1294
Link Here
|
1276 |
if (!tree.includes(root)) |
1365 |
if (!tree.includes(root)) |
1277 |
return 0; |
1366 |
return 0; |
1278 |
switch (depth) { |
1367 |
switch (depth) { |
1279 |
case IResource.DEPTH_ZERO : |
1368 |
case IResource.DEPTH_ZERO : |
1280 |
return 1; |
1369 |
return 1; |
1281 |
case IResource.DEPTH_ONE : |
1370 |
case IResource.DEPTH_ONE : |
1282 |
return 1 + tree.getChildCount(root); |
1371 |
return 1 + tree.getChildCount(root); |
1283 |
case IResource.DEPTH_INFINITE : |
1372 |
case IResource.DEPTH_INFINITE : |
1284 |
final int[] count = new int[1]; |
1373 |
final int[] count = new int[1]; |
1285 |
IElementContentVisitor visitor = (aTree, requestor, elementContents) -> { |
1374 |
IElementContentVisitor visitor = (aTree, requestor, elementContents) -> { |
1286 |
if (phantom || !((ResourceInfo) elementContents).isSet(M_PHANTOM)) |
1375 |
if (phantom || !((ResourceInfo) elementContents).isSet(M_PHANTOM)) |
1287 |
count[0]++; |
1376 |
count[0]++; |
1288 |
return true; |
1377 |
return true; |
1289 |
}; |
1378 |
}; |
1290 |
new ElementTreeIterator(tree, root).iterate(visitor); |
1379 |
new ElementTreeIterator(tree, root).iterate(visitor); |
1291 |
return count[0]; |
1380 |
return count[0]; |
1292 |
} |
1381 |
} |
1293 |
return 0; |
1382 |
return 0; |
1294 |
} |
1383 |
} |
Lines 1639-1645
Link Here
|
1639 |
for (IProject project : projects) { |
1728 |
for (IProject project : projects) { |
1640 |
if (!project.isAccessible()) { |
1729 |
if (!project.isAccessible()) { |
1641 |
continue; |
1730 |
continue; |
1642 |
} |
1731 |
} |
1643 |
IProject[] refs = ((Project)project).internalGetDescription().getReferencedProjects(false); |
1732 |
IProject[] refs = ((Project)project).internalGetDescription().getReferencedProjects(false); |
1644 |
List<IProject> dangling = new ArrayList<>(refs.length); |
1733 |
List<IProject> dangling = new ArrayList<>(refs.length); |
1645 |
for (IProject ref : refs) { |
1734 |
for (IProject ref : refs) { |
Lines 1904-1911
Link Here
|
1904 |
//create anonymous subclass because TeamHook is abstract |
1993 |
//create anonymous subclass because TeamHook is abstract |
1905 |
if (teamHook == null) |
1994 |
if (teamHook == null) |
1906 |
teamHook = new TeamHook() { |
1995 |
teamHook = new TeamHook() { |
1907 |
// empty |
1996 |
// empty |
1908 |
}; |
1997 |
}; |
1909 |
} |
1998 |
} |
1910 |
} |
1999 |
} |
1911 |
|
2000 |
|
Lines 2101-2116
Link Here
|
2101 |
protected ResourceInfo newElement(int type) { |
2190 |
protected ResourceInfo newElement(int type) { |
2102 |
ResourceInfo result = null; |
2191 |
ResourceInfo result = null; |
2103 |
switch (type) { |
2192 |
switch (type) { |
2104 |
case IResource.FILE : |
2193 |
case IResource.FILE : |
2105 |
case IResource.FOLDER : |
2194 |
case IResource.FOLDER : |
2106 |
result = new ResourceInfo(); |
2195 |
result = new ResourceInfo(); |
2107 |
break; |
2196 |
break; |
2108 |
case IResource.PROJECT : |
2197 |
case IResource.PROJECT : |
2109 |
result = new ProjectInfo(); |
2198 |
result = new ProjectInfo(); |
2110 |
break; |
2199 |
break; |
2111 |
case IResource.ROOT : |
2200 |
case IResource.ROOT : |
2112 |
result = new RootInfo(); |
2201 |
result = new RootInfo(); |
2113 |
break; |
2202 |
break; |
2114 |
} |
2203 |
} |
2115 |
result.setNodeId(nextNodeId()); |
2204 |
result.setNodeId(nextNodeId()); |
2116 |
updateModificationStamp(result); |
2205 |
updateModificationStamp(result); |
Lines 2133-2154
Link Here
|
2133 |
public Resource newResource(IPath path, int type) { |
2222 |
public Resource newResource(IPath path, int type) { |
2134 |
String message; |
2223 |
String message; |
2135 |
switch (type) { |
2224 |
switch (type) { |
2136 |
case IResource.FOLDER : |
2225 |
case IResource.FOLDER : |
2137 |
if (path.segmentCount() < ICoreConstants.MINIMUM_FOLDER_SEGMENT_LENGTH) { |
2226 |
if (path.segmentCount() < ICoreConstants.MINIMUM_FOLDER_SEGMENT_LENGTH) { |
2138 |
message = "Path must include project and resource name: " + path.toString(); //$NON-NLS-1$ |
2227 |
message = "Path must include project and resource name: " + path.toString(); //$NON-NLS-1$ |
2139 |
Assert.isLegal(false, message); |
2228 |
Assert.isLegal(false, message); |
2140 |
} |
2229 |
} |
2141 |
return new Folder(path.makeAbsolute(), this); |
2230 |
return new Folder(path.makeAbsolute(), this); |
2142 |
case IResource.FILE : |
2231 |
case IResource.FILE : |
2143 |
if (path.segmentCount() < ICoreConstants.MINIMUM_FILE_SEGMENT_LENGTH) { |
2232 |
if (path.segmentCount() < ICoreConstants.MINIMUM_FILE_SEGMENT_LENGTH) { |
2144 |
message = "Path must include project and resource name: " + path.toString(); //$NON-NLS-1$ |
2233 |
message = "Path must include project and resource name: " + path.toString(); //$NON-NLS-1$ |
2145 |
Assert.isLegal(false, message); |
2234 |
Assert.isLegal(false, message); |
2146 |
} |
2235 |
} |
2147 |
return new File(path.makeAbsolute(), this); |
2236 |
return new File(path.makeAbsolute(), this); |
2148 |
case IResource.PROJECT : |
2237 |
case IResource.PROJECT : |
2149 |
return (Resource) getRoot().getProject(path.lastSegment()); |
2238 |
return (Resource) getRoot().getProject(path.lastSegment()); |
2150 |
case IResource.ROOT : |
2239 |
case IResource.ROOT : |
2151 |
return (Resource) getRoot(); |
2240 |
return (Resource) getRoot(); |
2152 |
} |
2241 |
} |
2153 |
Assert.isLegal(false); |
2242 |
Assert.isLegal(false); |
2154 |
// will never get here because of assertion. |
2243 |
// will never get here because of assertion. |
Lines 2648-2651
Link Here
|
2648 |
} |
2737 |
} |
2649 |
return Status.OK_STATUS; |
2738 |
return Status.OK_STATUS; |
2650 |
} |
2739 |
} |
|
|
2740 |
|
2741 |
public Map<Long, IResource> getCopyMap() { |
2742 |
if (copyMap == null) |
2743 |
copyMap = new HashMap<>(); |
2744 |
return copyMap; |
2745 |
} |
2746 |
|
2747 |
public Map<Long, IResource> getCopyMapRead() { |
2748 |
// Don't create it |
2749 |
return copyMap; |
2750 |
} |
2651 |
} |
2751 |
} |