如何将源代码位置附加到Eclipse RCP目标平台中的插件?

时间:2023-01-19 18:15:16

I've got a workspace with multiple RCP plugin projects.

我有一个包含多个RCP插件项目的工作区。

We've set the target platform, so we can build against a standard set of plugins, but are not able to see source code and Javadoc for all the platform plugins.

我们已经设置了目标平台,因此我们可以针对一组标准插件进行构建,但是无法查看所有平台插件的源代码和Javadoc。

The Windows -> Preferences -> Plug-in Development -> Target Platform -> Source Code Locations page doesn't seem to have any effect when I add the eclipse directory (it only allows you to add directories).

当我添加eclipse目录时,Windows - >首选项 - >插件开发 - >目标平台 - >源代码位置页面似乎没有任何效果(它只允许您添加目录)。

Copying the source jars from the eclipse directory into the target platform has a similar effect.

将源jar从eclipse目录复制到目标平台具有类似的效果。

What am I doing wrong? How do I attach a set of Source jars to my target platform?

我究竟做错了什么?如何将一组Source jar附加到我的目标平台?

4 个解决方案

#1


11  

I had the same problem today. In my case I wanted to debug into the source of the plugin embedded jetty (org.mortbay.jetty_5.1.14.v200806031611.jar) which comes with Eclipse Equinox (OSGI) which is part of my eclipse target platform.

我今天遇到了同样的问题。在我的情况下,我想调试插件嵌入式jetty(org.mortbay.jetty_5.1.14.v200806031611.jar)的源代码,它与Eclipse Equinox(OSGI)一起提供,它是我的eclipse目标平台的一部分。

When debugged and wanted to go into any class inside a jetty package I always got the message that it is a class from Plugin-Dependencies and the source attachment cannot be modified.

当调试并想进入jetty包中的任何类时,我总是得到消息,它是来自Plugin-Dependencies的类,并且源附件不能被修改。

I solved it like this:

我这样解决了:

  1. Switch to the Plugins View in Eclipse ( Window / Show View / Plugins)
  2. 切换到Eclipse中的插件视图(窗口/显示视图/插件)

  3. locate the bundle org.mortbay.jetty
  4. 找到包org.mortbay.jetty

  5. right click on that bundle and select "Import as" -> "Binary Project with linked content"
  6. 右键单击该包并选择“导入为” - >“包含链接内容的二进制项目”

Now that Bundle shows up in your Package Explorer as a new Eclipse project, in my case org.mortbay.jetty.

现在Bundle在你的Package Explorer中显示为一个新的Eclipse项目,在我的例子中是org.mortbay.jetty。

Now right click on that new project in the package explorer and goto 'Properties / Java Build Path / Libraries'. You see the the jetty jar file there and if you expand this entry you can edit the 'Source Attachment' as usual. I pointed it to the downloaded Jetty Source code located in a completely different folder than my target platform which I am using for my project.

现在,右键单击包资源管理器中的新项目,然后转到“属性/ Java构建路径/库”。您可以在那里看到jetty jar文件,如果展开此条目,您可以像往常一样编辑“源附件”。我把它指向下载的Jetty源代码,该代码位于一个完全不同的文件夹中,而不是我用于我的项目的目标平台。

#2


3  

If you use Eclipse SDK bundles when building your target platform, you should be immediately provided with "Java Source Attachment" and "Javadoc Location" for each Eclipse plugin. For example, I used "Eclipse Platform SDK" (eclipse-platform-SDK-3.4.2-win32) as target space and when I display the "Source Code Locations page" that you mentionned, it is filled with "Source locations declared in the target platform". In the Eclise IDE, I can then see Eclipse core plugins source code and javadoc (in JFace packages for example).

如果在构建目标平台时使用Eclipse SDK包,则应立即为每个Eclipse插件提供“Java Source Attachment”和“Javadoc Location”。例如,我使用“Eclipse Platform SDK”(eclipse-platform-SDK-3.4.2-win32)作为目标空间,当我显示您提到的“源代码位置页面”时,它填充了“在目标平台“。在Eclise IDE中,我可以看到Eclipse核心插件的源代码和javadoc(例如在JFace包中)。

Otherway, it is not so easy to add plugins source code locations but you can succeed it in 2 ways :

另外,添加插件源代码位置并不是那么容易,但是你可以通过两种方式成功:

  • providing a "source plugin" (the easiest way if the plugin provider also supplies the source plugin) into the target platform, as an ordinary plugin (PDE will recognise it)
  • 提供“源插件”(插件提供商也提供源插件的最简单方法)到目标平台,作为普通插件(PDE将识别它)

  • providing an additional source location (not the easy way ...)
  • 提供额外的源位置(不是简单的方法......)

You can find more information about Target Source Code Locations in you Eclipse Help, in the following topic : Plug-in Development Environment Guide > Tools > Preferences > Target Platform Preferences > Source Code Locations

您可以在以下主题中找到有关目标源代码位置的更多信息:插件开发环境指南>工具>首选项>目标平台首选项>源代码位置

#3


1  

All sources are available if you download the 'Eclipse for RCP and RAP Developers' build from the main downloads page. At least, that's what it's called for the Juno build, it used to be called Eclipse for RCP/Plug-in Developers.

如果从主下载页面下载“Eclipse for RCP和RAP Developers”构建,则可以使用所有源代码。至少,这就是它所谓的Juno构建,它曾经被称为Eclipse for RCP / Plug-in Developers。

It doesn't look like the plugin source code is available via the standard Java/J2ee Eclipse builds any longer. I was assuming the sources would be available via the update mechanism but have been unable to find the correct update site/feature. If anyone knows, please comment.

通过标准Java / J2ee Eclipse构建,它看起来不像插件源代码。我假设源可以通过更新机制获得,但无法找到正确的更新站点/功能。如果有人知道,请评论。

#4


0  

I can modify the target platform at runtime, using the -install runtime option. Keep the targetPlatform as the eclipse platform.

我可以使用-install运行时选项在运行时修改目标平台。将targetPlatform保留为eclipse平台。

However, this loses a lot of the benefits of using a target platform in the first place - i.e. compile time safety.

然而,这首先失去了使用目标平台的许多好处 - 即编译时安全性。

#1


11  

I had the same problem today. In my case I wanted to debug into the source of the plugin embedded jetty (org.mortbay.jetty_5.1.14.v200806031611.jar) which comes with Eclipse Equinox (OSGI) which is part of my eclipse target platform.

我今天遇到了同样的问题。在我的情况下,我想调试插件嵌入式jetty(org.mortbay.jetty_5.1.14.v200806031611.jar)的源代码,它与Eclipse Equinox(OSGI)一起提供,它是我的eclipse目标平台的一部分。

When debugged and wanted to go into any class inside a jetty package I always got the message that it is a class from Plugin-Dependencies and the source attachment cannot be modified.

当调试并想进入jetty包中的任何类时,我总是得到消息,它是来自Plugin-Dependencies的类,并且源附件不能被修改。

I solved it like this:

我这样解决了:

  1. Switch to the Plugins View in Eclipse ( Window / Show View / Plugins)
  2. 切换到Eclipse中的插件视图(窗口/显示视图/插件)

  3. locate the bundle org.mortbay.jetty
  4. 找到包org.mortbay.jetty

  5. right click on that bundle and select "Import as" -> "Binary Project with linked content"
  6. 右键单击该包并选择“导入为” - >“包含链接内容的二进制项目”

Now that Bundle shows up in your Package Explorer as a new Eclipse project, in my case org.mortbay.jetty.

现在Bundle在你的Package Explorer中显示为一个新的Eclipse项目,在我的例子中是org.mortbay.jetty。

Now right click on that new project in the package explorer and goto 'Properties / Java Build Path / Libraries'. You see the the jetty jar file there and if you expand this entry you can edit the 'Source Attachment' as usual. I pointed it to the downloaded Jetty Source code located in a completely different folder than my target platform which I am using for my project.

现在,右键单击包资源管理器中的新项目,然后转到“属性/ Java构建路径/库”。您可以在那里看到jetty jar文件,如果展开此条目,您可以像往常一样编辑“源附件”。我把它指向下载的Jetty源代码,该代码位于一个完全不同的文件夹中,而不是我用于我的项目的目标平台。

#2


3  

If you use Eclipse SDK bundles when building your target platform, you should be immediately provided with "Java Source Attachment" and "Javadoc Location" for each Eclipse plugin. For example, I used "Eclipse Platform SDK" (eclipse-platform-SDK-3.4.2-win32) as target space and when I display the "Source Code Locations page" that you mentionned, it is filled with "Source locations declared in the target platform". In the Eclise IDE, I can then see Eclipse core plugins source code and javadoc (in JFace packages for example).

如果在构建目标平台时使用Eclipse SDK包,则应立即为每个Eclipse插件提供“Java Source Attachment”和“Javadoc Location”。例如,我使用“Eclipse Platform SDK”(eclipse-platform-SDK-3.4.2-win32)作为目标空间,当我显示您提到的“源代码位置页面”时,它填充了“在目标平台“。在Eclise IDE中,我可以看到Eclipse核心插件的源代码和javadoc(例如在JFace包中)。

Otherway, it is not so easy to add plugins source code locations but you can succeed it in 2 ways :

另外,添加插件源代码位置并不是那么容易,但是你可以通过两种方式成功:

  • providing a "source plugin" (the easiest way if the plugin provider also supplies the source plugin) into the target platform, as an ordinary plugin (PDE will recognise it)
  • 提供“源插件”(插件提供商也提供源插件的最简单方法)到目标平台,作为普通插件(PDE将识别它)

  • providing an additional source location (not the easy way ...)
  • 提供额外的源位置(不是简单的方法......)

You can find more information about Target Source Code Locations in you Eclipse Help, in the following topic : Plug-in Development Environment Guide > Tools > Preferences > Target Platform Preferences > Source Code Locations

您可以在以下主题中找到有关目标源代码位置的更多信息:插件开发环境指南>工具>首选项>目标平台首选项>源代码位置

#3


1  

All sources are available if you download the 'Eclipse for RCP and RAP Developers' build from the main downloads page. At least, that's what it's called for the Juno build, it used to be called Eclipse for RCP/Plug-in Developers.

如果从主下载页面下载“Eclipse for RCP和RAP Developers”构建,则可以使用所有源代码。至少,这就是它所谓的Juno构建,它曾经被称为Eclipse for RCP / Plug-in Developers。

It doesn't look like the plugin source code is available via the standard Java/J2ee Eclipse builds any longer. I was assuming the sources would be available via the update mechanism but have been unable to find the correct update site/feature. If anyone knows, please comment.

通过标准Java / J2ee Eclipse构建,它看起来不像插件源代码。我假设源可以通过更新机制获得,但无法找到正确的更新站点/功能。如果有人知道,请评论。

#4


0  

I can modify the target platform at runtime, using the -install runtime option. Keep the targetPlatform as the eclipse platform.

我可以使用-install运行时选项在运行时修改目标平台。将targetPlatform保留为eclipse平台。

However, this loses a lot of the benefits of using a target platform in the first place - i.e. compile time safety.

然而,这首先失去了使用目标平台的许多好处 - 即编译时安全性。