如何在 Papyrus UML (Eclipse) 中使用核心 Java 类?

发布于 2024-11-17 08:31:31 字数 251 浏览 5 评论 0原文

我是 Eclipse 中的 Papyrus UML 新手。我正在尝试制作也使用标准Java 类(例如java.awt.Point)的类的类图。例如:类跟踪器有一个属性点位置。但是,如果我单击属性位置,我无法将其类型设置为任何标准 Java 类。

我尝试从注册库导入,但没有包含标准 Java 包的选项。

如何在我的类图中使用这些标准类?

I'm new to Papyrus UML in Eclipse. I'm trying to make a class diagram of classes that also use standard Java classes (e.g. java.awt.Point). So for example: Class Tracker has a property Point location. However, if I click the property location, I cannot set its type to any standard Java class.

I tried Import from registered library but there are no options that include the standard Java packages.

How can I use these standard classes in my class diagram?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

奈何桥上唱咆哮 2024-11-24 08:31:31

一些 Papyrus/Java 爱好者应该编写核心 java 配置文件并将其捐赠给 Papyrus 项目。

Some Papyrus/Java lover should write the core java profile and donate it to the papyrus project.

只是我以为 2024-11-24 08:31:31

您不能将 Papyrus 与 Java 现有的 java 代码一起使用。通常,您建模然后从模型生成 java 代码。
您可以尝试逆向工程功能,但它会创建现在与现有 java 类无关的模型。

我看到的唯一解决方案是使用实时代码和模型同步 UML 工具。

You can not use Papyrus with Java existing java code. Usually you model then generate a java code from the model.
You can try the reverse engineering feature but it would create model which is now not related to your existing java class.

The only solution I see is to use live code and model synchronization UML tool.

后来的我们 2024-11-24 08:31:31

经过多次搜索,我找到了一种方法..

只需下载我在这里制作的Java Core(JCL)API UML文件:

https://mega.nz/#!qVdAAAIL!gWstAOCyQFWVHTqxVrgnYssiOJZSAEN-rbxMIaZzMJo

并使用 model->import->import package from user model features in papyrus in eclipse

eclipse import package papyrus

然后,您可以在 Papyrus 中使用基元之外的标准 Java 库类型UML图。

我已经使用代码生成器对此进行了测试,它可以使用,但有一个警告,您最终会在生成的项目中获得标准库包的额外本地副本。只需删除这些,您就可以继续新的一天。我不确定,但 eclipse payprus codegen 目前似乎没有生成必要的导入,因此您必须手动执行此操作或让 IDE 为您执行此操作,但它肯定胜过占位符类型。

如果您想知道这是如何完成的,我使用了以下插件:

https://marketplace.eclipse。 org/content/jar2uml

生成标准库 jar 文件版本 1.8 的 UML 文件,该文件通常位于 jre 安装目录下的 lib 文件夹内。

这给了我一个包含所有标准库包的模型,但该模型被命名为 rt.java.* 而不是 java.*,这扰乱了代码生成过程。所以我只是删除了除 java.* 之外的其他包,并使 java 成为模型本身而不是包。

After much searching, i found a way..

Simply download the Java Core (JCL) API UML file I made here:

https://mega.nz/#!qVdAAAIL!gWstAOCyQFWVHTqxVrgnYssiOJZSAEN-rbxMIaZzMJo

And use the model->import->import package from user model functionality in papyrus in eclipse

eclipse import package papyrus

Then you can use standard java library types outside of just primitives in your papyrus UML diagram.

I've tested this with the code generator and it works with one caveat, you end up with an extra local copy of the standard library packages in the generated project. Simply delete these and you can move on with your day. I'm not sure, but eclipse payprus codegen doesn't currently seem to generate the imports necessary, so you'll have to do that manually or let the IDE do it for you, but it sure beats having placeholder types.

If you're wondering how this was done, I used the following plugin:

https://marketplace.eclipse.org/content/jar2uml

To generate a UML file for the standard library jar file version 1.8, this is usually under the jre installation directory inside the lib folder.

This gave me a model with all the standard library packages within it, but the model was named rt.java.* instead of java.* which messed with the code generation process. So i simply removed the other packages other than java.* and made java the model itself instead of a package.

如歌彻婉言 2024-11-24 08:31:31

Papyrus Software Designer 扩展中有一个 java 配置文件和库/包。
您可以通过市场安装它。
另请参阅:https://wiki.eclipse.org/Java_Code_Generation

There is a java profile and library/package in Papyrus Software Designer extention.
You may install it via the market place.
See also: https://wiki.eclipse.org/Java_Code_Generation

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文