Edit operation only works with objects in the context. If you define this operation in the menu, context is not defined unless the user selects something.
Edit operations should not be generally put in the menu, but defined as ITEM OPERATIONS where they are placed next to each record in the query.