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.
I have found that it is pretty easy to display a context menu in the blank space for tree views. TreeView *almost* supported it already, but for some reason it was disabled. I have a patch which I guess I will put in for F - it seems to work fine but I am a bit nervous about putting it into E this late. The effects of the patch: 1. If you have a TreeView for which !isRootVisible(), yet the current root node has some actions, right-click the blank area in the view (or S-F10 when there are zero nodes selected) displays the actions from the root node in a context menu. 1a. The root node is also "selected" in case some of the actions require the node selection to include the node the action was "invoked on". Since the root node is invisible, this has the visible effect of clearing any existing selection. 2. Hiding root node for Favorites, since it is not needed now; Add Favorites available via #1. 3. Adding a context menu to Projects (not Files) via #1: New Project Open Project Recent Projects > [as in File menu] ----------------------- View Java Packages as > List Tree This requires a minor layer-based API to let the last action be registered from java/project. 4. Removing "Package View" node from Options window, as the same functionality is now accessible from #3.
Created attachment 21165 [details] Proposed patch
Please note we have a UI spec for this context menu (in the URL field). I don't say the spec is unchangeable ;-).
How about a merge? The context menu as envisioned in the spec, plus Recent Projects and View Java Packages as > ...?
Have it mostly working - only remaining problem is that Ctrl-N does not appear as the accelerator for New File, but I do not know how to fix this. The action system in projectui is too complicated to understand, IMHO, since a single class is often reused for different purposes (context-sensitive vs. global), which makes the code rather confusing, so I have had to put in a few hacks just to make menu items appear the same in context menus.
Please take a look (Jano especially) and if we need to make some changes to the menu just file a new bug. committed 1.15 core/favorites/src/org/netbeans/modules/favorites/Tab.java committed 1.13 java/project/arch.xml committed 1.33 java/project/src/org/netbeans/modules/java/project/Bundle.properties added 1.1 java/project/src/org/netbeans/modules/java/project/ChangePackageViewTypeAction.java committed 1.3 java/project/src/org/netbeans/modules/java/project/PackageViewSettings.java removed 1.2 java/project/src/org/netbeans/modules/java/project/PackageViewSettingsBeanInfo.java removed 1.2 java/project/src/org/netbeans/modules/java/project/PackageViewTypeEditor.java committed 1.20 java/project/src/org/netbeans/modules/java/project/layer.xml committed 1.191 openide/src/org/openide/explorer/view/TreeView.java committed 1.7 projects/projectui/arch.xml committed 1.34 projects/projectui/src/org/netbeans/modules/project/ui/ProjectsRootNode.java committed 1.20 projects/projectui/src/org/netbeans/modules/project/ui/actions/Actions.java committed 1.18 projects/projectui/src/org/netbeans/modules/project/ui/actions/NewFile.java committed 1.10 projects/projectui/src/org/netbeans/modules/project/ui/actions/RecentProjects.java committed 1.7 projects/projectui/src/org/netbeans/modules/project/ui/actions/SetMainProject.java committed 1.52 projects/projectui/src/org/netbeans/modules/project/ui/resources/layer.xml
*** Issue 42994 has been marked as a duplicate of this issue. ***
verified in NB.dev(200507181800)