neilcsmith-net commented on PR #7925:
URL: https://github.com/apache/netbeans/pull/7925#issuecomment-2462928250

   > I need something like "Select in Files". ...For "Favorites" I need yet 
another action "Select in Favorites".
   
   Check out the actions registered to `CTRL+SHIFT+1`, `CTRL+SHIFT+2` and 
`CTRL+SHIFT+3`.  You can search in the Tools / Options / Keymap / Search in 
Shortcuts. Which will tell you they're in the `Window/SelectDocumentNode` 
category.  A search for that 
https://github.com/search?q=repo%3Aapache%2Fnetbeans%20Window%2FSelectDocumentNode&type=code
   
   Finds 
   
   
https://github.com/apache/netbeans/blob/master/ide/projectui/src/org/netbeans/modules/project/ui/actions/SelectNodeAction.java#L43
   
   
https://github.com/apache/netbeans/blob/master/platform/favorites/src/org/netbeans/modules/favorites/Actions.java#L82
   
   > For collapse all icon for "Files" and "Projects" there is already 
registered action. There is no need to register new one. I am not calling this 
functionality via "action" because this action is in the same file as my other 
code. So I simply can call same method which is used by action.
   
   This is where you're going wrong!  The decoupling is important.  You need to 
load the actions via a layer folder, and attach them to your buttons.  The 
folder contains shadows (symlinks) to the actions - you are not registering a 
new action, but you are referencing it from somewhere else.
   
   It looks like the collapse all action relies on a String in the view root 
node Lookup - 
https://github.com/apache/netbeans/blob/master/ide/projectui/src/org/netbeans/modules/project/ui/ProjectsRootNode.java#L116
  Seems odd to use a String.  You'll probably need to use the variant of 
loading that allows passing in a Lookup 
https://bits.netbeans.org/23/javadoc/org-openide-util-ui/org/openide/util/Utilities.html#actionsForPath-java.lang.String-org.openide.util.Lookup-
 Probably the one from the root node of the view??


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to