Lines 17-22
Link Here
|
17 |
import java.beans.PropertyChangeListener; |
17 |
import java.beans.PropertyChangeListener; |
18 |
import java.io.File; |
18 |
import java.io.File; |
19 |
import java.io.IOException; |
19 |
import java.io.IOException; |
|
|
20 |
import java.net.URI; |
20 |
import java.net.URL; |
21 |
import java.net.URL; |
21 |
import java.util.ArrayList; |
22 |
import java.util.ArrayList; |
22 |
import java.util.HashMap; |
23 |
import java.util.HashMap; |
Lines 266-300
Link Here
|
266 |
while (it.hasNext()) { |
267 |
while (it.hasNext()) { |
267 |
Root r = (Root)it.next(); |
268 |
Root r = (Root)it.next(); |
268 |
File locF = r.getActualLocation(); |
269 |
File locF = r.getActualLocation(); |
|
|
270 |
URI uri = locF.toURI(); |
269 |
FileObject loc = locF != null ? FileUtil.toFileObject(locF) : null; |
271 |
FileObject loc = locF != null ? FileUtil.toFileObject(locF) : null; |
270 |
if (loc == null) { |
272 |
if (loc != null) { |
271 |
// Not there; skip it. |
273 |
if (FileUtil.getRelativePath(pdir, loc) != null) { |
272 |
continue; |
274 |
// Inside projdir already. Skip it. |
273 |
} |
275 |
continue; |
274 |
if (!loc.isFolder()) { |
276 |
} |
275 |
// Actually a file. Skip it. |
277 |
try { |
276 |
continue; |
278 |
if (loc.isFolder()) { |
277 |
} |
279 |
Project other = ProjectManager.getDefault().findProject(loc); |
278 |
if (FileUtil.getRelativePath(pdir, loc) != null) { |
280 |
if (other != null) { |
279 |
// Inside projdir already. Skip it. |
281 |
// This is a foreign project; we cannot own it. Skip it. |
280 |
continue; |
282 |
continue; |
281 |
} |
283 |
} |
282 |
try { |
284 |
} |
283 |
Project other = ProjectManager.getDefault().findProject(loc); |
285 |
} catch (IOException e) { |
284 |
if (other != null) { |
286 |
// Assume it is a foreign project and skip it. |
285 |
// This is a foreign project; we cannot own it. Skip it. |
|
|
286 |
continue; |
287 |
continue; |
287 |
} |
288 |
} |
288 |
} catch (IOException e) { |
|
|
289 |
// Assume it is a foreign project and skip it. |
290 |
continue; |
291 |
} |
289 |
} |
292 |
// It's OK to go. |
290 |
// It's OK to go. |
293 |
if (newRootsToRegister != null) { |
291 |
if (newRootsToRegister != null) { |
294 |
newRootsToRegister.add(loc); |
292 |
newRootsToRegister.add(uri); |
295 |
} else { |
293 |
} else { |
296 |
lastRegisteredRoots.add(loc); |
294 |
lastRegisteredRoots.add(uri); |
297 |
FileOwnerQuery.markExternalOwner(loc, p, registeredRootAlgorithm); |
295 |
FileOwnerQuery.markExternalOwner(uri, p, registeredRootAlgorithm); |
298 |
} |
296 |
} |
299 |
} |
297 |
} |
300 |
if (newRootsToRegister != null) { |
298 |
if (newRootsToRegister != null) { |
Lines 303-315
Link Here
|
303 |
toUnregister.removeAll(newRootsToRegister); |
301 |
toUnregister.removeAll(newRootsToRegister); |
304 |
Iterator rootIt = toUnregister.iterator(); |
302 |
Iterator rootIt = toUnregister.iterator(); |
305 |
while (rootIt.hasNext()) { |
303 |
while (rootIt.hasNext()) { |
306 |
FileObject loc = (FileObject)rootIt.next(); |
304 |
URI loc = (URI)rootIt.next(); |
307 |
FileOwnerQuery.markExternalOwner(loc, null, registeredRootAlgorithm); |
305 |
FileOwnerQuery.markExternalOwner(loc, null, registeredRootAlgorithm); |
308 |
} |
306 |
} |
309 |
newRootsToRegister.removeAll(lastRegisteredRoots); |
307 |
newRootsToRegister.removeAll(lastRegisteredRoots); |
310 |
rootIt = newRootsToRegister.iterator(); |
308 |
rootIt = newRootsToRegister.iterator(); |
311 |
while (rootIt.hasNext()) { |
309 |
while (rootIt.hasNext()) { |
312 |
FileObject loc = (FileObject)rootIt.next(); |
310 |
URI loc = (URI)rootIt.next(); |
313 |
FileOwnerQuery.markExternalOwner(loc, p, registeredRootAlgorithm); |
311 |
FileOwnerQuery.markExternalOwner(loc, p, registeredRootAlgorithm); |
314 |
} |
312 |
} |
315 |
} |
313 |
} |