Bug 519088 - Enhance exception message for AbstractBehavior#getFeedbackPartFactory(IViewer viewer)
Summary: Enhance exception message for AbstractBehavior#getFeedbackPartFactory(IViewer...
Status: NEW
Alias: None
Product: GEF
Classification: Tools
Component: GEF MVC (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard: low-hanging fruit
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-03 03:29 EDT by Markus Muehlbrandt CLA
Modified: 2018-10-15 14:13 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Muehlbrandt CLA 2017-07-03 03:29:56 EDT
In the actual GEF 5.0.0 release the getFeedBackPartFactory(IViewer viewer) method of AbstractBehavior class has a default implementation which directly throws an UnsupportedOperationException.

Maybe it makes more sense to remove the default implementation and make the function abstract so that subclasses are forced to implement the method.
Comment 1 Matthias Wienand CLA 2017-07-06 09:08:45 EDT
In addition to getFeedbackPartFactory(IViewer), AbstractBehavior also defines getHandlePartFactory(IViewer). Both methods throw an UnsupportedOperationException in their default implementation, so that they only need to be implemented if the individual behavior needs to access a feedback or handle part factory.

Behaviors can apply any logic in response to changes. Some behaviors might need to generate feedback, others might need to generate handles, others might need to generate both or none. Therefore, I think it is wrong to force an implementation for these methods, however, I am open for a discussion.

There is no doubt that the exception message can be enhanced, though. It should probably give more information about the error, along the lines: "The default mechanism for generation of feedback depends on a feedback part factory that needs to be made accessible by implementing the getFeedbackPartFactory(IViewer) method of the respective behavior. In order to query the factory from the viewer using a dedicated rule, an implementation can delegate to getFeedbackPartFactory(IViewer, String)."

What do you think?