简体   繁体   English

IBM Rational Rhapsody中的模式框架

[英]A modal frame in IBM Rational Rhapsody

I am currently creating a plugin for IBM Rational Rhapsody. 我当前正在为IBM Rational Rhapsody创建一个插件。 Knowing the tool is not really necessary for this discussion, but I wanted to mention it just in case. 在本次讨论中,实际上并不需要了解该工具,但是我想提一下以防万一。 Basically I wrote the Java code in Eclipse and ran it through a Jar to be imported into Rhapsody. 基本上,我是用Eclipse编写Java代码,然后将其运行在Jar中,然后导入到Rhapsody中。

The plugin may require user interaction to run: for example, the plugin may be creating an element of the model, but doesn't know which packet to put it in, so it prompts the user for instructions. 该插件可能需要用户交互才能运行:例如,该插件可能正在创建模型的元素,但不知道将其放入哪个数据包,因此会提示用户输入说明。 To do this, I created a JDialog class which calls a setModal(true) method; 为此,我创建了一个JDialog类,该类调用setModal(true)方法。 this, as you may know, makes sure that the thread that creates the dialog stops running until the user provides input. 您可能知道,这可以确保创建对话框的线程在用户提供输入之前停止运行。 On Eclipse this all works perfectly, but when the jar runs on Rhapsody it doesn't do what I expect it to. 在Eclipse上,这一切都可以完美地工作,但是当jar在Rhapsody上运行时,它并没有达到我的预期。 Other than stopping the plugin from running until input is provided, it also stops the Rhapsody application and causes the UML model to be unusable. 除了停止运行插件直到提供输入外,它还会停止Rhapsody应用程序并导致UML模型不可用。 To be more clear, in order for users to know where to insert their input, they have to be able to use and analyze the UML model. 更清楚地说,为了使用户知道在哪里插入输入,他们必须能够使用和分析UML模型。 What I am trying to achieve is that my dialog only stops the plugin from running, not the entire model. 我想要实现的是我的对话框仅停止插件运行,而不是整个模型运行。

I haven't written a line of code since this is a concept question: how can I make a plugin that is external to a tool travel on a thread, allowing the tool to be used while the plugin is running? 我没有编写任何代码,因为这是一个概念问题:我如何才能使工具外部的插件在线程上移动,从而允许在插件运行时使用该工具?

I hope my question is clear, I had a hard time explaining the problem. 我希望我的问题很清楚,我很难解释这个问题。

Thank you all for your help, Giordano 谢谢大家的帮助,佐丹奴

Rhapsody plugins run in the same process as the Rhapsody application so one thing you could try is to use a helper instead of a plugin. Rhapsody插件的运行过程与Rhapsody应用程序相同,因此您可以尝试使用辅助方法而不是插件。 Rhapsody helpers run in a separate process. 狂想曲助手在一个单独的过程中运行。 You can add a helper under tools -> customize -> helpers. 您可以在工具->自定义->帮助器下添加帮助器。 From there you can call your Swing application and use the Rhapsody API to query/change the model. 从那里,您可以调用Swing应用程序,并使用Rhapsody API查询/更改模型。

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

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