NetBeans Keycap Listing
"ask.melnyk" <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <[email protected]> |
ask.melnyk wrote:
>
> RamiS wrote:
> > Hi,
> >
> > this should get you started:
> >
> > FileObject shortcuts = FileUtil.getConfigFile("Shortcuts");
> > for (FileObject shortcut : shortcuts.getChildren()) {
> > KeyStroke key = Utilities.stringToKey(shortcut.getName());
> > action = shortcut.getAttribute(...)
> > }
> >
> > You still need to figure out, which attribute points to the original
> > action, but there should be one (check via shortcut.getAttributes()).
> > If the attribute value is a string you might need to look up the Action
> > via Actions.forID().
> >
> > Regards,
> > Johannes
> >
> > On 09.06.2016 17:53, ask.melnyk wrote:
> >
> > > I'm write platform plugin for catching shortcuts and showing tips in the status bar. But i need showing action associated with shortcut.
> > >
> > >
> > >
> > >
> >
>
>
>
> Thank you very much!
>
> I'm getting keys from config with your code and nice look have with
>
>
> Code:
> String ksts = org.netbeans.editor.Utilities.keyStrokeToString(ks);
>
>
>
> How can i get action name by shortcut?
i get action tree by this code
Code:
private void listActions(FileObject parent, int depth) {
for (int i = 0; i < depth; i++) {
System.out.print(" ");
}
System.out.print(parent.getName());
if (!parent.isFolder()) {
System.out.print(" :: ");
Enumeration<String> attributes = parent.getAttributes();
while (attributes.hasMoreElements()) {
attributes.nextElement();
System.out.print(attributes.nextElement() + ", ");
}
}
System.out.println();
for (FileObject action : parent.getChildren()) {
listActions(action, depth + 1);
}
}
but i can't do mind relate it to shortcuts list
help please
:?