Bug 529767 - [Markers] Missing problem marker target for "The required feature 'base_Interface' of ..."
Summary: [Markers] Missing problem marker target for "The required feature 'base_Inter...
Status: NEW
Alias: None
Product: MDT.UML2
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: UML2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on: 529780
Blocks:
  Show dependency tree
 
Reported: 2018-01-12 15:04 EST by Ed Willink CLA
Modified: 2018-01-13 18:55 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2018-01-12 15:04:32 EST
(The new EAnnotationValidator support provokes OCL to provide a nature/builder that auto-validates OCL embedded in Ecore or UML. This highlights some very poor functionality.)

Validating http://git.eclipse.org/c/ocl/org.eclipse.ocl.git/tree/plugins/org.eclipse.ocl/model/OCLCST.uml, which has hardly changed for many years, in the UML Model Editor shows over 100 errors

Most of these take the form "The required feature 'base_Interface' of 'EClass -> <<EClass>> <Class> DefCS' must be set"

Double clicking in the Problems View does not navigate to the corresponding problem object in the UML editor. This is usually due to a bad/missing eObject argument for the BasicDiagnostic.data[].

(In contrast double clicking "The feature 'target' of '<Element Import>' with 0 values must have at least 1 values" navigates as expected.)
Comment 1 Kenn Hussey CLA 2018-01-12 15:45:55 EST
I suspect this happens because the offending objects are stereotype applications, which are suppressed from the tree view of the UML editor. I was going to suggest intercepting the lookup attempt and redirecting it to the base element instead, but that won't work if the base element reference is empty (which is the exact problem being reported)...
Comment 2 Christian Damus CLA 2018-01-12 15:53:37 EST
(In reply to Kenn Hussey from comment #1)

Perhaps stereotype applications whose base element is either unset or unresolved should be shown in the editor, so that they user may notice that they are broken.
Comment 3 Kenn Hussey CLA 2018-01-12 15:59:26 EST
(In reply to comment #2)
> (In reply to Kenn Hussey from comment #1)
> 
> Perhaps stereotype applications whose base element is either unset or unresolved
> should be shown in the editor, so that they user may notice that they are
> broken.

Yes, the logic that suppresses their display could be modified to only suppress those with values for their base elements. Contributions are most welcome.
Comment 4 Ed Willink CLA 2018-01-12 17:19:10 EST
Bug 529780 highlights that the real problem is a missing child element for the stereotype application.

Since the Problem Marker navigation occurs via a URI, it may be possible to do some heroic EMF overloading to redirect the URI to the stereotype application feature in the stereotyped class' properties page.
Comment 5 Kenn Hussey CLA 2018-01-13 11:52:35 EST
(In reply to comment #4)
> Bug 529780 highlights that the real problem is a missing child element for the
> stereotype application.

As I've just commented there, it doesn't make sense to show stereotype applications as children of their base elements because they aren't.

> Since the Problem Marker navigation occurs via a URI, it may be possible to do
> some heroic EMF overloading to redirect the URI to the stereotype application
> feature in the stereotyped class' properties page.

IMO, it should navigate to the base element (if such a reference exists); otherwise, it should navigate to the stereotype application element itself (assuming it is being displayed in the editor as Christian has suggested).
Comment 6 Kenn Hussey CLA 2018-01-13 18:55:24 EST
(In reply to comment #1)
> I suspect this happens because the offending objects are stereotype
> applications, which are suppressed from the tree view of the UML editor. I was
> going to suggest intercepting the lookup attempt and redirecting it to the base
> element instead, but that won't work if the base element reference is empty
> (which is the exact problem being reported)...

Actually, given additional context from bug 529769 I believe the stereotype application in this particular case does actually have a base element (a class), just not a base interface. I should have realized this based on the way the stereotype application label was rendered (with a reference to the "DefCS" base class). So navigating to the base element (the "DefCS" class) would in fact be a viable solution in this particular scenario.

(In reply to comment #5)
> As I've just commented there, it doesn't make sense to show stereotype
> applications as children of their base elements because they aren't.

Actually, since the Ecore editor has already set a precedent of displaying child tree elements for things that aren't strictly children (in the containment sense), it may not be such a bad idea to optionally allow stereotype applications to be displayed as child tree elements of their base elements.

> > Since the Problem Marker navigation occurs via a URI, it may be possible to do
> > some heroic EMF overloading to redirect the URI to the stereotype application
> > feature in the stereotyped class' properties page.
> 
> IMO, it should navigate to the base element (if such a reference exists);
> otherwise, it should navigate to the stereotype application element itself
> (assuming it is being displayed in the editor as Christian has suggested).

I just took a look and diverting navigation to a base element instead of its referring stereotype application should be a simple matter of further customizing the UMLEditor#gotoMarker(IMarker) method. The default behavior could be to navigate to the base element of a stereotype application or, if the stereotype application is being rendered as a tree element (either because it has no resolvable base element or because an option has been added to display stereotype applications as child tree elements has been added and enabled per bug 529780) it would just navigate to that (using the existing behavior).