Not a code to copy without thinking. Has the function on line 57 ever returned non-null? -jt
Dne st 27. 10. 2021 11:07 uživatel Christian Lenz <christian.l...@gmx.net> napsal: > Here can you see, how I did this: > https://github.com/Chris2011/gitlogbeans/blob/main/src/main/java/io/github/chris2011/netbeans/plugins/gitlogbeans/PathUtils.java > the code is a copy of Markiewbs git branch in status bar plugin. > > > Cheers > > CHris > > Von: Jaroslav Tulach > Gesendet: Mittwoch, 27. Oktober 2021 07:22 > An: dev@netbeans.apache.org > Betreff: Re: can't lookup current project > > What do you mean by current project? > > There is > > https://bits.netbeans.org/12.5/javadoc/org-netbeans-modules-projectuiapi-base/ > org/netbeans/api/project/ui/OpenProjects.html#getOpenProjects-- > <https://bits.netbeans.org/12.5/javadoc/org-netbeans-modules-projectuiapi-base/org/netbeans/api/project/ui/OpenProjects.html#getOpenProjects--> > > or there is > > https://bits.netbeans.org/12.5/javadoc/org-netbeans-modules-projectapi/org/ > netbeans/api/project/ProjectManager.html#findProject- > <https://bits.netbeans.org/12.5/javadoc/org-netbeans-modules-projectapi/org/netbeans/api/project/ProjectManager.html#findProject-> > org.openide.filesystems.FileObject- > > -jt > > > Hi All > > > > These give me null: > > > > Lookup lookup = Utilities.actionsGlobalContext(); > > Project project = lookup.lookup(Project.class); > > > > This also null: > > > > OpenProjects.getDefault().getMainProject() > > > > How can I find the current selected project? thanks > > > > > > Thanks > > > > From Peter (System Architect, Quantr Limited https://www.quantr.hk , > Mobile > > : 96554595) > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org > For additional commands, e-mail: dev-h...@netbeans.apache.org > > For further information about the NetBeans mailing lists, visit: > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists > > > > >