We could manage array valued contexts for various interesting resource sets, like "java projects" or "source folders" and use those to more precisely contribute actions to the explorer context menu. The code would look like:
setContext('java.projects', ['path/To/Project1', '/path/To/Project']);
and then in our context actions:
when: resourcePath in java.projects