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.
Dev build, Mustang. Start IDE. With no projects open, press Ctrl-N. Exception thrown. Should rather do nothing, or beep, or something.
Created attachment 22486 [details] Stack trace
*** Issue 61173 has been marked as a duplicate of this issue. ***
It seems to me that this was introduced in revision 1.19 of NewFile.java: revision 1.19 date: 2005/05/17 00:15:43; author: jglick; state: Exp; lines: +7 -2 Threading fix, avoids stack trace. The problem is IMO following: 1. The user presses Ctrl-N, on an instance of NewFile action "createContextAwareAction" method is called with appropriate Lookup (in the AWT Thread probably). 2. New "NewFile" action is created (newly created actions have isEnabled() == true). 3. In the NewFile's constructor, "refresh" is called. The refresh replans to AWT Thread to perform setEnabled and setDisplayName. (originaly, the setEnabled was called synchronously in the refresh method). 4. isEnabled() is called on the newly created action (returns true as the setEnabled(false) has not been runned yet), and as the result is true, actionPerformed is called (resulting in the exception). Please note that the action should be enabled only if "OpenProjectList.getDefault().getOpenProjects().length > 0" and in such a case calling OpenProjectList.getDefault().getOpenProjects()[0] seems OK.
Yup, needed to change enablement synch if already in EQ.
Checking in projects/projectui/src/org/netbeans/modules/project/ui/actions/NewFile.java; /cvs/projects/projectui/src/org/netbeans/modules/project/ui/actions/NewFile.java,v <-- NewFile.java new revision: 1.20; previous revision: 1.19 done
Marking this issue as VERIFIED since the issue reporter == issue owner.