Hi,
it depends on how you created the ClasspathInfo.
If the ClasspathInfo was created by `ClasspathInfo.create(FileObject)` or 
`ClasspathInfo.create(File)`
the returned types (packages) are the types (packages) from the project where 
the `FileObject` comes from and
projects the project depends on.
If you need only the types (packages) from the project itself you can use 
SearchScope.SOURCE like:

ci.getDeclaredTypes(“Foo”, NameKind.SIMPLE_NAME, 
Collections.singleton(SearchScopeType.SOURCE))

When you need to search in a specific set of roots you can always create a 
custom ClasspathInfo to search just in given roots
using `ClasspathInfo.create(ClassPath, ClassPath, ClassPath)`.
The classpath for required roots can be constructed using 
`ClassPathSupport.createClassPath`.

— Tomas

> On 11 Nov 2019, at 14:27, Alessandro <[email protected]> wrote:
> 
> Hi all,
>  In a plugin I am writing I would like to complete a user text looking for
> package an class names of the maven java project the edited file belongs
> to. I am using the ClassIndex obtained via ClasspathInfo but it helps me
> complete package and class names coming from all opened projects.
> 
> Is there a way to limit the class index search to a single project?
> 
> Thank you in advance.
> 
> Regards,
> Alex


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to