We have checked your code, and have several comments.
if(tv == null) {
// this is meaningless (just create, no one has ref to the tagged value)
IModelElementFactory.instance().createTaggedValue();
tv = model.getTaggedValues().createTaggedValue();
tv.setName("ParticularTaggedValueName");
// This is meaningless as well because "tv" is created by
// TaggedValueContainer.createTaggedValue(),
// so "tv" is added into Container while create.
model.getTaggedValues().addTaggedValue(tv);
}
Although there are some statements that seems to be meaningless, we do not find any problem with displaying tagged values tab. Could you explain more, perhaps with screenshots, to show what the problem is?
Of course, you’re right. These lines are meaningless.
Should be:
if(rm.getTaggedValues() == null) {
rm.setTaggedValues(IModelElementFactory.instance().createTaggedValueContainer());
}
ITaggedValue tv = rm.getTaggedValues().getTaggedValueByName("ParticulerTaggedValueName");
if(tv == null) {
tv = rm.getTaggedValues().createTaggedValue();
tv.setName("ParticulerTaggedValueName");
}
tv.setValue("ParticulerTaggedValueValue");
It’s difficult to show screenshots, because the tagged values tab simply does not appear.
The problem occurs only when creating new TaggedValueContainer.