Is it possible to give menu items an execution context similar to how key bindings work? In other words, if the context operation fails, the menu item would be disabled.

Is it possible to make the sublime text window pop to the front via a plugin if another app has stolen the focus and come in front of it? I'm working on a GDB plugin and I'm thinking about the situation where the app being debugged creates its own window and then a breakpoint is hit and so I'd like the sublime text window to pop in front of the app being debugged.