简体   繁体   English

如何将plugin.xml部署到Eclipse安装?

[英]How to deploy plugin.xml to Eclipse installations?

I made a Plug-in Project (with a pop-up menu) and customized a plugin.xml file so it added a context-menu which launches a 3rd-party application (see the code below). 我制作了一个插件项目(带有弹出菜单),并自定义了plugin.xml文件,因此它添加了一个上下文菜单,该菜单启动了一个第三方应用程序(请参见下面的代码)。

Now it works on my host only, and I'd like to deploy it to other 20 hosts where Eclipse is installed (ie for all developers in my team). 现在,它仅在我的主机上工作,我想将其部署到安装了Eclipse的其他20台主机上(即,针对我团队中的所有开发人员)。

How to integrate it automatically with Eclipse? 如何自动将其与Eclipse集成? Ie I'd prefer to avoid ask the users to run it manually with a 20-steps procedure. 即,我希望避免要求用户使用20个步骤的步骤来手动运行它。

Could it be that we have to copy this file (or another file) to a certain location? 难道我们必须将此文件(或另一个文件)复制到某个位置?

I use Eclipse on Windows only. 我仅在Windows上使用Eclipse。 Thank you. 谢谢。

** **

/**
 * @see IActionDelegate#selectionChanged(IAction, ISelection)
 */
public void selectionChanged(IAction action, ISelection selection) {
    // set selection
    this.selection = selection;
}



public void run(IAction action) {
        // Get file from selection
        if (selection instanceof IStructuredSelection) {
            IStructuredSelection ssel = (IStructuredSelection) selection;
            Object obj = ssel.getFirstElement();
            IFile file = (IFile) Platform.getAdapterManager().getAdapter(obj,
                    IFile.class);
            if (file == null) {
                if (obj instanceof IAdaptable) {
                    file = (IFile) ((IAdaptable) obj).getAdapter(IFile.class);
                }
            }
            if (file != null) {
                // Display Message with selected path
                MessageDialog.openInformation(
                        shell,
                        "MyPlugin Found file",
                        "File path"+file.getFullPath().toOSString());
            }
        }
    }

Probably you created an plugin-project containing this plugin.xml. 可能您创建了一个包含此plugin.xml的插件项目。 You can create a jar-file for a plugin-project and all the user which want to use it, copy that jar-file into the "dropin" subdirectory of eclipse. 您可以为一个插件项目和所有想要使用它的用户创建一个jar文件,将该jar文件复制到eclipse的“ dropin”子目录中。

The structure of the JAR file is eclipse specific. JAR文件的结构是特定于Eclipse的。 Check examples in the "plugins" directory of eclipse. 在eclipse的“插件”目录中检查示例。 You need the plugin.xml but also an META-INF/MANIFEST.MF and other files of the plugin project. 您需要plugin.xml,还需要META-INF / MANIFEST.MF和插件项目的其他文件。

Without more information about this plugin - its hard to find out what you are doing :-) So this can be only a startup help for your problem... 没有有关此插件的更多信息-很难找到您在做什么:-)因此,这只能是您的问题的启动帮助...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM