Eclipse plug-in: add Launch command group to Custom Perspective

我的未来我决定 提交于 2019-12-01 18:29:42

问题


I have looked for a lot of tutorials online and it is very difficult to find anything related to Launches.

I am implementing an IDE plug-in which implements a custom perspective and I cannot see any of the Run or Debug toolbar buttons except the Run Last Tool button. Everytime I launch the perspective, I need to go into Customize Perspective and then Command Group Visibility and activate the Launch command group.

I have implemented a LaunchConfigurationType and am basically trying to add LaunchShortcuts.

I read somewhere that you need to create an ILaunchable adapter to make the Run as... and Debug as... visible. Here is what I added in the plugin.xml,

<extension point="org.eclipse.core.runtime.adapters">
    <factory adaptableType="org.eclipse.core.resources.IFile" class=" ">
        <adapter type="org.eclipse.debug.ui.actions.ILaunchable">
        </adapter>
    </factory>
</extension>

I have tried many types of adaptableTypes: IResource, IFile, the custom perspective, but none of them make the buttons show up on the toolbar.


回答1:


You need to extend your perspective using org.eclipse.ui.perspectiveExtensions extension point. To add Run and Debug buttons add org.eclipse.debug.ui.launchActionSet actionSet like this:

   <extension
         point="org.eclipse.ui.perspectiveExtensions">
      <perspectiveExtension
            targetID="your.perspective.id">
         <actionSet
               id="org.eclipse.debug.ui.launchActionSet">
         </actionSet>
      </perspectiveExtension>
   </extension>


来源:https://stackoverflow.com/questions/4335458/eclipse-plug-in-add-launch-command-group-to-custom-perspective

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!