How can I fix "WARNING [org.openide.util.Utilities]: findContextMenuImpl, getPopupPresenter returning null for" when using a PopupPresenter ?

You cannot return null, but you can return an invisible JMenuItem. Use DynamicMenuContent.HIDE_WHEN_DISABLED for that.

    public JMenuItem getPopupPresenter() {
        final Lookup lookup = Utilities.actionsGlobalContext();
        JMenu main = createMenu(lookup);
        if (null == main) {
            final JMenuItem invisibleMenuItem = new JMenuItem();
            invisibleMenuItem.putClientProperty(DynamicMenuContent.HIDE_WHEN_DISABLED, true);
            return invisibleMenuItem;

        setEnabled(main.getMenuComponentCount() > 0);
        return main;
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo