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 57068 - Show general context menu for blank space in tree views
Summary: Show general context menu for blank space in tree views
Status: CLOSED FIXED
Alias: None
Product: ide
Classification: Unclassified
Component: Code (show other bugs)
Version: 4.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jesse Glick
URL: http://projects.netbeans.org/nonav/bu...
Keywords:
: 42994 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-03-28 17:21 UTC by Jesse Glick
Modified: 2006-03-24 13:18 UTC (History)
4 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
Proposed patch (37.17 KB, patch)
2005-03-28 17:22 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2005-03-28 17:21:50 UTC
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.
Comment 1 Jesse Glick 2005-03-28 17:22:21 UTC
Created attachment 21165 [details]
Proposed patch
Comment 2 jrojcek 2005-04-04 17:13:14 UTC
Please note we have a UI spec for this context menu (in the URL field). I don't say the spec is 
unchangeable ;-).
Comment 3 Jesse Glick 2005-04-05 01:47:07 UTC
How about a merge? The context menu as envisioned in the spec, plus Recent
Projects and View Java Packages as > ...?
Comment 4 Jesse Glick 2005-04-05 02:39:39 UTC
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.
Comment 5 Jesse Glick 2005-04-05 19:32:19 UTC
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
Comment 6 Jesse Glick 2005-04-06 19:27:42 UTC
*** Issue 42994 has been marked as a duplicate of this issue. ***
Comment 7 Marian Mirilovic 2005-07-19 15:33:19 UTC
verified in NB.dev(200507181800)