如何将菜单项添加到“运行方式"? [英] How to add menu entry to "Run As"?

查看:38
本文介绍了如何将菜单项添加到“运行方式"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Eclipse 的插件开发环境中,如何为特定的编辑器添加菜单项到运行方式"?

解决方案

你可以在 Eclipse 文章中获得一些技巧:

我们已经升空:Eclipse 中的启动框架

<块引用>

声明启动配置类型

创建小程序启动器的第一步是声明一个配置类型,如下面插件的 plugin.xml 文件中的 XML 片段所示:
非 UI 声明

<extension point="org.eclipse.debug.core.launchConfigurationTypes>

<块引用>

这个声明最重要的部分是delegate属性,它指定了实现接口org.eclipse.debug.core.model.ILaunchConfigurationDelegate.
委托是启动器的大脑,实现了启动指定配置的launch()方法.

In Plugin Developpment Environnement of Eclipse, How ca i add an menu entry to "Run As" for a specific Editor?

解决方案

You can get some tips in the Eclipse article:

We Have Lift-off: The Launching Framework in Eclipse

Declaring a launch configuration type

The first step in creating our applet launcher is declaring a config type, as shown in the following snippet of XML from our plug-in's plugin.xml file:
Non-UI declaration

<extension point="org.eclipse.debug.core.launchConfigurationTypes">
    <launchConfigurationType
        name="Java Applet"
        delegate="org.eclipse.jdt.internal.launching.JavaAppletLaunchConfigurationDelegate"
        modes="run, debug"               
        id="org.eclipse.jdt.launching.javaApplet">        
    </launchConfigurationType>
</extension>

The most important part of this declaration is the delegate attribute which specifies the fully-qualified name of a class that implements the interface org.eclipse.debug.core.model.ILaunchConfigurationDelegate.
The delegate is the brains of the launcher, and implements the launch() method which launches a specified config.

这篇关于如何将菜单项添加到“运行方式"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆