Lines 74-79
Link Here
|
74 |
import org.openide.filesystems.FileStateInvalidException; |
74 |
import org.openide.filesystems.FileStateInvalidException; |
75 |
import org.openide.filesystems.FileUtil; |
75 |
import org.openide.filesystems.FileUtil; |
76 |
import org.openide.util.ChangeSupport; |
76 |
import org.openide.util.ChangeSupport; |
|
|
77 |
import org.openide.util.Parameters; |
77 |
import org.openide.util.WeakListeners; |
78 |
import org.openide.util.WeakListeners; |
78 |
|
79 |
|
79 |
// XXX should perhaps be legal to call add* methods at any time (should update things) |
80 |
// XXX should perhaps be legal to call add* methods at any time (should update things) |
Lines 98-104
Link Here
|
98 |
if (val == null) { |
99 |
if (val == null) { |
99 |
return null; |
100 |
return null; |
100 |
} |
101 |
} |
101 |
return project.resolveFile(val); |
102 |
return aph.resolveFile(val); |
102 |
} |
103 |
} |
103 |
public Collection<FileObject> getIncludeRoots() { |
104 |
public Collection<FileObject> getIncludeRoots() { |
104 |
File loc = getActualLocation(); |
105 |
File loc = getActualLocation(); |
Lines 285-291
Link Here
|
285 |
} |
286 |
} |
286 |
} |
287 |
} |
287 |
|
288 |
|
288 |
private final AntProjectHelper project; |
289 |
private final AntProjectHelper aph; |
|
|
290 |
private final Project project; |
289 |
private final PropertyEvaluator evaluator; |
291 |
private final PropertyEvaluator evaluator; |
290 |
private final List<SourceRoot> principalSourceRoots = new ArrayList<SourceRoot>(); |
292 |
private final List<SourceRoot> principalSourceRoots = new ArrayList<SourceRoot>(); |
291 |
private final List<Root> nonSourceRoots = new ArrayList<Root>(); |
293 |
private final List<Root> nonSourceRoots = new ArrayList<Root>(); |
Lines 304-314
Link Here
|
304 |
/** |
306 |
/** |
305 |
* Create the helper object, initially configured to recognize only sources |
307 |
* Create the helper object, initially configured to recognize only sources |
306 |
* contained inside the project directory. |
308 |
* contained inside the project directory. |
307 |
* @param project an Ant project helper |
309 |
* @param aph an Ant project helper |
308 |
* @param evaluator a way to evaluate Ant properties used to define source locations |
310 |
* @param evaluator a way to evaluate Ant properties used to define source locations |
|
|
311 |
* @deprecated Rather use {@link #SourcesHelper(Project, AntProjectHelper, PropertyEvaluator)}. |
309 |
*/ |
312 |
*/ |
310 |
public SourcesHelper(AntProjectHelper project, PropertyEvaluator evaluator) { |
313 |
@Deprecated |
|
|
314 |
public SourcesHelper(AntProjectHelper aph, PropertyEvaluator evaluator) { |
315 |
this.project = null; |
316 |
this.aph = aph; |
317 |
this.evaluator = evaluator; |
318 |
} |
319 |
|
320 |
/** |
321 |
* Create the helper object, initially configured to recognize only sources |
322 |
* contained inside the project directory. |
323 |
* @param project the project object (need not yet be registered in {@link ProjectManager}) |
324 |
* @param aph an Ant project helper |
325 |
* @param evaluator a way to evaluate Ant properties used to define source locations |
326 |
* @since XXX |
327 |
*/ |
328 |
public SourcesHelper(Project project, AntProjectHelper aph, PropertyEvaluator evaluator) { |
329 |
Parameters.notNull("project", project); |
311 |
this.project = project; |
330 |
this.project = project; |
|
|
331 |
this.aph = aph; |
312 |
this.evaluator = evaluator; |
332 |
this.evaluator = evaluator; |
313 |
} |
333 |
} |
314 |
|
334 |
|
Lines 462-468
Link Here
|
462 |
} |
482 |
} |
463 |
|
483 |
|
464 |
private Project getProject() { |
484 |
private Project getProject() { |
465 |
return AntBasedProjectFactorySingleton.getProjectFor(project); |
485 |
return project != null ? project : AntBasedProjectFactorySingleton.getProjectFor(aph); |
466 |
} |
486 |
} |
467 |
|
487 |
|
468 |
/** |
488 |
/** |
Lines 496-506
Link Here
|
496 |
* {@link FileOwnerQuery#EXTERNAL_ALGORITHM_TRANSIENT}. |
516 |
* {@link FileOwnerQuery#EXTERNAL_ALGORITHM_TRANSIENT}. |
497 |
* </p> |
517 |
* </p> |
498 |
* <p> |
518 |
* <p> |
499 |
* You may <em>not</em> call this method inside the project's constructor, as |
519 |
* If you used the old constructor form |
500 |
* it requires the actual project to exist and be registered in {@link ProjectManager}. |
520 |
* {@link #SourcesHelper(AntProjectHelper, PropertyEvaluator)} |
501 |
* Typically you would use {@link org.openide.util.Mutex#postWriteRequest} to run it |
521 |
* then you may <em>not</em> call this method inside the project's constructor, as |
|
|
522 |
* it requires the actual project to exist and be registered in {@link ProjectManager}; |
523 |
* in this case you could still use {@link org.openide.util.Mutex#postWriteRequest} to run it |
502 |
* later, if you were creating the helper in your constructor, since the project construction |
524 |
* later, if you were creating the helper in your constructor, since the project construction |
503 |
* normally occurs in read access. |
525 |
* normally occurs in read access. |
|
|
526 |
* Better to use {@link #SourcesHelper(Project, AntProjectHelper, PropertyEvaluator)}. |
504 |
* </p> |
527 |
* </p> |
505 |
* @param algorithm an external root registration algorithm as per |
528 |
* @param algorithm an external root registration algorithm as per |
506 |
* {@link FileOwnerQuery#markExternalOwner} |
529 |
* {@link FileOwnerQuery#markExternalOwner} |
Lines 521-527
Link Here
|
521 |
allRoots.addAll(nonSourceRoots); |
544 |
allRoots.addAll(nonSourceRoots); |
522 |
allRoots.addAll(ownedFiles); |
545 |
allRoots.addAll(ownedFiles); |
523 |
Project p = getProject(); |
546 |
Project p = getProject(); |
524 |
FileObject pdir = project.getProjectDirectory(); |
547 |
FileObject pdir = aph.getProjectDirectory(); |
525 |
// First time: register roots and add to lastRegisteredRoots. |
548 |
// First time: register roots and add to lastRegisteredRoots. |
526 |
// Subsequent times: add to newRootsToRegister and maybe add them later. |
549 |
// Subsequent times: add to newRootsToRegister and maybe add them later. |
527 |
if (lastRegisteredRoots == null) { |
550 |
if (lastRegisteredRoots == null) { |