I want to get the User id of a referenced element which has been added as a model element
For example, I have a Task element which has a reference to a use-case element
Using the below code I can get the model element of the referenced element but when I try to get its view it returns a null value.
IReference reference; IModelElement model = reference.getUrlAsModel(); IDiagramElement view = model.getMasterView(); IUseCase usecase = (IUseCase) view ; String userId = usecase.getUserID();
This code will not work and it causes a null pointer exception on the fourth line because the view object is null. I have used the getMasterView() method before and it worked fine but in this case and for a reference that has been added as a model element it not work and returns null.
Would you please help me find the user id of that use-case element?
Thanks in advance