This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 57656
Collapse All | Expand All

(-)freeform/src/org/netbeans/modules/ant/freeform/FreeformSources.java (+17 lines)
Lines 85-90 Link Here
85
                }
85
                }
86
            }
86
            }
87
        }
87
        }
88
        
89
        //Fix for #57656:
90
        List/*<Element>*/ genldataChildren = Util.findSubElements(genldata);
91
        
92
        Iterator it = genldataChildren.iterator();
93
        
94
        while (it.hasNext()) {
95
            Element possibleExport = (Element ) it.next();
96
            
97
            if ("export".equals(possibleExport.getLocalName()) && FreeformProjectType.NS_GENERAL.equals(possibleExport.getNamespaceURI())) {
98
                Element locationE = Util.findElement(possibleExport, "location", FreeformProjectType.NS_GENERAL);
99
                String location = Util.findText(locationE);
100
                
101
                h.addNonSourceRoot(location);
102
            }
103
        }
104
        
88
        ProjectManager.mutex().postWriteRequest(new Runnable() {
105
        ProjectManager.mutex().postWriteRequest(new Runnable() {
89
            public void run() {
106
            public void run() {
90
                h.registerExternalRoots(FileOwnerQuery.EXTERNAL_ALGORITHM_TRANSIENT);
107
                h.registerExternalRoots(FileOwnerQuery.EXTERNAL_ALGORITHM_TRANSIENT);
(-)project/src/org/netbeans/spi/project/support/ant/SourcesHelper.java (-24 / +22 lines)
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
        }

Return to bug 57656