如何为Rhapsody表生成自定义选择器?

时间:2019-05-14 14:03:44

标签: java picker rhapsody

我正在为IBM Rhapsody表编写自定义选择器。选择器用于选择满足特定要求的块(代表功能)。我希望选择器仅显示子目录中选择树中的块,以使每次满意度节省约10次点击。

我已经发现了这一点:https://www.ibm.com/developerworks/community/forums/html/topic?id=46c45210-b12e-4779-aac5-4c22b04c69fb,但是它根本没有帮助,因为它没有告诉它如何完成。

这是选择器的当前代码段:

public List<IRPModelElement> pick_3_UserDefinedImplementation(IRPModelElement cellElement, IRPModelElement oldValue){

IRPCollection refCollection = cellElement.getReferences();
IRPDependency dependency = null;
ArrayList<IRPModelElement>  elementList = new AayList<IRPModelElement>();

    for(int i = 1; i <= refCollection.getCount(); i++) 
    {
              if (refCollection.getItem(i) instanceof BLOCKCLASS)  
             { 
                IRPDependency depLink =  (IRPDependency)refCollection.getItem(i);
                elementList.add(depLink.getDependent());
             }
    }
    return elementList;
}

我找不到Rhapsody块的类(或IRPMetaclass)。 我敢肯定,有一种更聪明的方式来实现我想要的。 有人已经写过这样的选择器和/或可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

块是基于类的“新术语”定型。

因此,您应该能够通过以下方式识别块:   1)获得所有课程   2)遍历这些类并调用方法IRPModelElement.getUserDefinedMetaClass()以查看其是否与Block匹配。