This is a sample extract of my plugin.xml
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
<command
commandId="com.test.plugin.MyCommandName"
label="PersonCommand">
<visibleWhen>
<and>
<with
variable="activePartId">
<equals
value="com.test.plugin.ui.view.MyView">
</equals>
</with>
<instanceof
value="com.test.plugin..sdk.Person">
</instanceof></and></visibleWhen>
</command>
</menuContribution>
where com.test.plugin.ui.view.MyView is the id of the view where I want
my command to be shown and com.test.plugin..sdk.Person is the class of
the object (like object contribution).