79745483

Date: 2025-08-25 08:15:23
Score: 1
Natty:
Report link

I found out the way is: to create a separate action which registers itself in the IDE menu with the associated accelerator

@ActionID(
        category = "Window",
        id = "ste.netbeans.nblogmanager.logviewer.LogViewerShortcutAction"
)
@ActionRegistration(
        displayName = "#CTL_LogViewerShortcutAction",
        key = "DS-L" // Ctrl+Shift+L
)
@ActionReference(path = "Menu/Window", position = 333)
@Messages({
    "CTL_LogViewerShortcutAction=Show Log Viewer"
})
public final class LogViewerShortcutAction extends AbstractAction {
    public LogViewerShortcutAction() {
        putValue(NAME, Bundle.CTL_LogViewerShortcutAction());
    }
    @Override
    public void actionPerformed(ActionEvent e) {
        TopComponent tc = WindowManager.getDefault().findTopComponent("LogViewerTopComponent");
        if (tc == null) {
            tc = new LogViewerTopComponent();
        }
        tc.open();
        tc.requestActive();
    }
}
Reasons:
  • Contains signature (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Ste