java - 如何为 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)。我确信有一种更聪明的方法可以实现我想要的。有人已经写过这样的选择器和/或可以帮助我吗?
解决方案
Block 是基于 Class 的“新名词”刻板印象。
因此,您应该能够通过以下方式识别块:1) 获取所有类 2) 遍历类并调用方法 IRPModelElement.getUserDefinedMetaClass() 以查看它是否与 Block 匹配。
推荐阅读
- .net-core - 如何使用 .netcore 获取日历(谷歌日历或交换)
- node.js - Mocha 测试无法在 Jenkins 上运行,并因超时错误而失败
- bash - bash:使用参数从一段时间内调用函数
- javascript - 从 axios post 外部访问变量
- vb.net - VB Visual Studio 2017:错误托管调试助手“DisconnectedContext”
- azure - 将 Azure 托管实例数据库备份导出到存储帐户
- azure - Azure AD - 注销时禁用帐户选择
- android - Android数据绑定双向绑定无法解析布尔属性的setter
- jquery - cy.get 返回无效的 jquery 元素
- javascript - ng-select 的自动关闭下拉菜单问题