Reputation: 1061
I want to fix the last warning in my plugin.xml file, must have caused it as I followed tutorials from some older post. The warning says: Element perspective is deprecated, in the following extension:
<extension
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
class="my.launch.MyLaunchShortcut"
icon="icons/my_icon.gif"
id="my.run.shortcut"
label="my Workflow"
modes="run, debug">
<perspective <---here is the warning
id="my.perspective">
</perspective>
<configurationType
id="my.run">
</configurationType>
<contextualLaunch>
<enablement>
<with
variable="selection">
<count
value="1">
</count>
<iterate>
<or>
<instanceof
value="org.eclipse.core.resources.IProject">
</instanceof>
</or>
</iterate>
</with>
</enablement>
</contextualLaunch>
</shortcut>
I try to remove the perspective element and add <test>
in <contextualLaunch>
, but all my tryings won't work. So how can I solve it?
btw. It's working fine. I can see my own context submenu in Run as -> Run My Project. But as long as I remove the <perspective>
element, no matter what else I add in <contextualLaunch>
, the submenu won't appear.
Upvotes: 0
Views: 113
Reputation: 111142
Your <contextualLaunch>
element will only show the shortcut when you have a single Project selected. Something like the following will show it for any resource:
<contextualLaunch>
<enablement>
<with
variable="selection">
<count
value="1">
</count>
<iterate>
<or>
<instanceof
value="org.eclipse.core.resources.IResource">
</instanceof>
</or>
</iterate>
</with>
</enablement>
</contextualLaunch>
You probably need to specify a <contextLabel>
as well - the following is the entry that the Ant plugin uses:
<contextualLaunch>
<enablement>
<with variable="selection">
<count value="1"/>
<iterate>
<or>
<instanceof value="org.eclipse.ant.internal.ui.model.AntElementNode"/>
<test property="org.eclipse.debug.ui.matchesContentType" value="org.eclipse.ant.core.antBuildFile"/>
</or>
</iterate>
</with>
</enablement>
<contextLabel
mode="run"
label="%AntLaunchShortcut.label"/>
<contextLabel
mode="debug"
label="%AntLaunchShortcut.label"/>
</contextualLaunch>
Upvotes: 1