@Override public void onApplicableProjectChanged(Project project, boolean applicable) { final ApplicableContext context = editedCommand.getApplicableContext(); if (applicable) { // if command is bound with one project at least // then remove command from the workspace if (context.getApplicableProjects().isEmpty()) { context.setWorkspaceApplicable(false); } context.addProject(project.getPath()); } else { context.removeProject(project.getPath()); // if command isn't bound to any project // then save it to the workspace if (context.getApplicableProjects().isEmpty()) { context.setWorkspaceApplicable(true); } } notifyDirtyStateChanged(); }