My colleagues and I needed to know the current project the user is on in our Plugin and we came up with this solution:
Assuming your plugin also resides in a web-item and has it’s own servlet:
<web-item name="yourWebitemName" i18n-name-key="yourWebitemTranslationKey"
key="yourKey" section="sectionOfYourChoice"
weight="1000">
<description key="yourDescriptionKey"/>
<label key="yourLabelKey"/>
<link linkId="yourLink">
/plugins/servlet/your/servlet?target=1&projectKey=$helper.project.key
</link>
</web-item>
This is the important part to include
?target=1&projectKey=$helper.project.key
Hope this helps.