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.

Bug 42609 - API to get all opened projects
Summary: API to get all opened projects
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 4.x
Hardware: All All
: P2 blocker (vote)
Assignee: Petr Hrebejk
URL:
Keywords: API
Depends on:
Blocks: 40721 41535
  Show dependency tree
 
Reported: 2004-04-29 15:33 UTC by _ pkuzel
Modified: 2004-08-13 12:11 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ pkuzel 2004-04-29 15:33:52 UTC
I need API to get all opened projects. Replacement
to temporary workaround:

        // XXX there is planed better api to get
all opened projects
        GlobalPathRegistry registry =
GlobalPathRegistry.getDefault();
        Set sourceRoots =
registry.getPaths(ClassPath.SOURCE);
        Iterator it = sourceRoots.iterator();
        while (it.hasNext()) {
            ClassPath next = (ClassPath) it.next();
            FileObject[] roots = next.getRoots();
            if (roots == null || roots.length ==
0) continue;
            Project project =
FileOwnerQuery.getOwner(roots[0]);
            if (projects.contains(project)) continue;
            projects.add(project);

            Sources sources = (Sources)
project.getLookup().lookup(Sources.class);


I expect ProjectManager's method:

  public Project[] getAllOpened();
Comment 1 Petr Hrebejk 2004-05-05 10:19:02 UTC
Jesse do you really want me to do it? The last decision was to avoid it.
I'm confused
Comment 2 _ pkuzel 2004-05-05 14:06:02 UTC
Well, last decision was to add it. With Javadoc describing valid vs.
invalid usages.
Comment 3 Petr Hrebejk 2004-05-05 15:58:16 UTC
Not the very last one. Then we found that for debuuger are MainProject
and Project sensitive actions enough. Form the bug I can't tell
whether it would help you as well. Would you be so kind and specify
why you are requesting it.
Comment 4 _ pkuzel 2004-05-05 16:12:35 UTC
I need to list all opened projects. I have window with global action:
find TODOs in selected folder. The globalness is mapped to all opened
projects. User can choose arbitrary folder from any opened project.
Comment 5 Jesse Glick 2004-05-05 19:24:56 UTC
I believe this use case does require such an API.
Comment 6 Petr Hrebejk 2004-05-10 16:14:31 UTC
Finally decided to publish the list of open project. Thus making it a
defect and setting the TM to promo-d
Comment 7 Petr Hrebejk 2004-05-12 17:18:48 UTC
The API is in, including tests. See
org.netbeans.api.project.ui.OpenProjects.
Comment 8 _ pkuzel 2004-05-13 13:57:54 UTC
Thanks.

Support for PCLs is an extra (from my side).
Comment 9 _ pkuzel 2004-05-13 14:11:37 UTC
Not enlisted in Public-Packages attribute.
Comment 10 Petr Hrebejk 2004-05-13 15:27:46 UTC
Oops. Sorry.