Question & Answer
Question
How do you display information of Class parameters such as In, Out, InOut on a tag in IBM Rational Rhapsody?
Answer
In order to display the information in a tag in Rational Rhapsody, you can use of the following piece of JavaScript code:
All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
---|
import com.telelogic.rhapsody.core.IRPApplication;
import com.telelogic.rhapsody.core.IRPArgument;
import com.telelogic.rhapsody.core.IRPModelElement;
import com.telelogic.rhapsody.core.IRPOperation;
import com.telelogic.rhapsody.core.IRPProject;
import com.telelogic.rhapsody.core.IRPTag;
import com.telelogic.rhapsody.core.RhapsodyAppServer;
public class argInfoToTag {
public static void main(String[] args) {
IRPApplication app = RhapsodyAppServer.getActiveRhapsodyApplication();
IRPProject prj = app.activeProject();
for (Object obj : prj.getNestedElementsRecursive().toList())
{
if(obj instanceof IRPOperation)
{
IRPOperation myOp = (IRPOperation) obj;
if(myOp.getArguments().getCount() > 0)
{
IRPModelElement myEle = myOp.addNewAggr("Tag", "Tag_"+myOp.getName());
IRPTag myTag = (IRPTag) myEle;
String str = "";
int count=1;
for(Object obj1 : myOp.getArguments().toList())
{
IRPArgument myArg = (IRPArgument) obj1;
str = str + "Argument"+count+": --> ";
str = str + "Name: " + myArg.getName() + " ";
str = str + "Type: " + myArg.getType().getName() + " ";
str = str + "Direction: " + myArg.getArgumentDirection() + " \n\n";
count++;
}
myTag.setDescription(str);
}
}
}
}
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg21456035