0

I've been using a tool for a while and I like it so much I'd like to have it as an eclipse plugin. Unfortunately, I think it's written in C++. Is there any way such a code base could be used as the basis for a Eclipse plugin without re-writing it in Java?

BTW: the tool is closed source, commercial, maintained by someone else and would need to be used as a GUI widget. I'm mostly wondering if it would be at all likely that I could talk the owners into doing this.

4

4 回答 4

1

You could always use JNI

于 2010-12-07T01:46:53.287 回答
1

一般来说,将现有的本地应用程序和工具集成到 Eclipse 中是一项重大工作。如果您想说服维护人员这样做,您必须说服他们为什么移植到 Eclipse 对他们有好处。

但是,如果有合适的 C++ API,您可以自己做很多事情。您可以使用SWIG包装 API ,或编写使用某些序列化协议(例如Google Protobuf )进行通信的包装器可执行文件。但是,这不会考虑在 Eclipse 中集成 UI,因此如果该工具是 UI 密集型的,这可能对您没有多大帮助。

于 2010-12-08T07:58:37.833 回答
1

您可以尝试使用SWIG(或纯 JNI,虽然这是一个主要的 PITA)为您的 C++ 代码创建 Java 包装器。

于 2010-12-07T02:33:49.647 回答
1

根据它是什么工具,您可以考虑其他一些选项。如果它是一个代码生成或翻译工具,您可能只需要一个自定义构建器,它可以使用您选择的选项和目标来调用该工具作为构建过程的一部分。例如,您可以将 Visual Studio 构建作为 Eclipse 编译的一部分运行而不会出现问题。

或者,如果它是一个图形工具,请检查它是否是一个 COM 对象,它可以“轻松”地包装到 Java 中,从而包装到 Eclipse 插件中。

最后,我还想为 SWIG 投一票。这些东西非常好,可以很容易地将 C 或 C++ API 包装到 Java 中并为您生成大量 JNI 代码。

于 2010-12-08T08:36:43.557 回答