Hi again totoroliu,
Had a play with the Multi Branch plug-in. It was my first time using or debugging the plug-in, so feel free to correct me if anything I say here is not correct.
I had to install the multibranch and git plug-ins in my development environment. Then created a very simple job pointing to the active-choices-plugin repository, and with a single parameter. That generated one job for each branch in the GitHub repository (interestingly, after I removed one branch I had to save the project again to sync the local projects).
The problem is that when you save a multibranch project, it invokes the project with parameters. At that moment, the active-choices plugin stores the project name, which at that moment contains only the multibranch project name (not its subproject name). Furthermore, the plugin has access to the web request. There it can look for things like form information submitted by the user.
There I can see the branches names, which relate to the project names. But there is no clear way to find which of those branches, the current project will be assigned.
So it's not easy (not sure if that's doable as well) to retrieve the correct project name.
And the reason why the multibranch project name is not displayed, is because it is not a Project Java object, it is a TopLevelItem in Jenkins, that creates Projects (FreeStyleProject or MavenProject from what I understood from quickly sifting through the code base).
totoroliu, if you really want this feature, I suggest we close this issue for projects under a Folder, and then you can create a separate issue for multibranch-multiconfiguration jobs. Then we can work on that issue later. Does that make sense to you?
Bruno
While testing for this bug,
I found JENKINS-32461 bug still exists:
jenkinsProject variable is not available in Multi-configuration project (at top level outside folder)