Bug 230014 - Refactor MetricProvider.xpt
Summary: Refactor MetricProvider.xpt
Status: ASSIGNED
Alias: None
Product: GMF-Tooling (ARCHIVED)
Classification: Modeling
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 2.2   Edit
Assignee: Artem Tikhomirov CLA
QA Contact:
URL:
Whiteboard:
Keywords: test
Depends on:
Blocks:
 
Reported: 2008-05-02 14:38 EDT by Artem Tikhomirov CLA
Modified: 2010-07-19 12:19 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 Artem Tikhomirov CLA 2008-05-02 14:38:10 EDT
While working on bug #228913 (mostly item 4), few oddities of generated MetricProvider surfaced.
1. Way too 'runtime' style, rather than 'generated' one. A lot of stuff that is known during codegen is being used as configuration at run-time, rather than generated right away.
2. Flawed API: public getMetrics and getMetricsForTarget methods return private classes.
3. Complicated way to write own java metrics - wrapping into AbstractExpression (and reflective code) for the sake of simplicity of runtime configuration (which is not needed at all as all the information is available at codegen time)
4. Too generic model iteration and handling


Lite version should be refactored to reuse most of the functionality of the base template
Comment 1 Artem Tikhomirov CLA 2008-05-02 14:40:35 EDT
MetricRulesTest should be updated to include tests for overall diagram calculate methods, not only for specific metrics evaluation.
Comment 2 Artem Tikhomirov CLA 2008-05-02 14:44:42 EDT
Few questions that need to be answered:
1. GenDiagramElementTarget allwos only GenNodes - why?,
2. Metrics for semantic elements are being collected for diagram.getElement().eAllContents(), not for actual semantic elements present on diagram (although in many cases these sets may be similar, it's not always the case)
3. GenAuditedMetricTarget#metricValueContext is not in use?
Comment 3 Artem Tikhomirov CLA 2008-05-05 12:45:48 EDT
(In reply to comment #2)
4. Is there's need for DISABLED_NO_IMPL_EXCEPTION_LOG? Looks like it's only for the sake of tests.
Comment 4 Artem Tikhomirov CLA 2008-06-05 10:15:50 EDT
Tests pending, refactoring itself is done in 2.1.
Comment 5 Artem Tikhomirov CLA 2008-12-09 15:42:43 EST
(In reply to comment #2)
>> Few questions that need to be answered:
>> 1. GenDiagramElementTarget allwos only GenNodes - why?,

[Radek] 
>Looking back into history, it has been introduced by fixing bug #136701.
> The constraint then limits to GenNode only in case of multiple elements only.
>"element <> null and element->size() > 1 implies element->forAll(oclIsKindOf(GenNode))"
>
>So Audits/metrics for class-based link is valid, I suspect it was allowed.

>> 2. Metrics for semantic elements are being collected for
>> diagram.getElement().eAllContents(), not for actual semantic elements present
>> on diagram (although in many cases these sets may be similar, it's not always
>> the case)

>[Radek] it's rather a bug or perhaps I failed to find a better way at that time.

>> 3. GenAuditedMetricTarget#metricValueContext is not in use?
>>
>[Radek] This looks like obsolete.


Comment 6 Artem Tikhomirov CLA 2008-12-11 14:54:01 EST
ContributionItemProvider is no longer used to contribute MetricsAction, now IEditorActionBarContributor does that, instead.
Comment 7 Eclipse Webmaster CLA 2010-07-19 12:19:19 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Templates was the original product and component for this bug