Search code examples
javaswingmodal-dialogjdialogrhapsody

A modal frame in IBM Rational Rhapsody


I am currently creating a plugin for 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.

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; 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. 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. 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. 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


Solution

  • 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 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.