Bug 125900 - Redundant annotations added to View in generated view factory
Summary: Redundant annotations added to View in generated view factory
Status: RESOLVED FIXED
Alias: None
Product: GMF-Tooling (ARCHIVED)
Classification: Modeling
Component: Core (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 1.0   Edit
Assignee: Alex Shatalin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-31 14:35 EST by Steven R. Shaw CLA
Modified: 2010-07-19 22:19 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steven R. Shaw CLA 2006-01-31 14:35:52 EST
See Taipan example ShipViewFactory.  It is adding annotations to the View for the modelID and visualID.  This is unnessarily added to the file format and adding an extra EObject memory requirement (to all views?) which is potentially very heavy weight.

1. modelID could be derived instead from the semantic EObject element.
i.e.
EObject semanticEl = containerView.getElement();
EClass eclass = semanticEl.eStaticClass();
EPackage package = eclass.getEPackage();
if (package instanceof TaiPanPackage) {
... // probably good enough here to identify it as part of the taipan meta-model
}

2. viewID should be stored in the view type instead of an annotation
i.e. 
view.setType("1002")
Comment 1 Alex Shatalin CLA 2006-02-01 07:51:55 EST
>1. modelID could be derived instead from the semantic EObject element.
i.e.
What about having several diagram types for the same meta-model? If we will have two different ViewProviders working with the same metamodels, but creating different views - we have to determine the type of the diagram we are working with using parent view element.. 

BTW, I really do not think that it is big overhead to create an annotation object for each view.. 

>2. viewID should be stored in the view type instead of an annotation
i.e. 
Yes, that's good improvement. We where thinking about it, but just for now store viewID as an additional annotation to not change all the rest of existing templates.
Comment 2 Steven R. Shaw CLA 2006-02-01 09:47:22 EST
Actually the overhead is potentially huge...

It's about 130 bytes for a single EObject, if this is multiplied by every view in a shape including list items then it could be considerable.  If we consider the ship view from Taipan with 20 cargo items:
1 master view
2 sub views
20 list item views
= 23 x 130 = 4K per shape.  

If you consider a large model with many diagrams in memory (UML perhaps), it's not unreasonable to have 100 different diagrams with an average of 20 shapes per diagram.
= 4K x 100 x 20 = 8 Megabytes

Regarding the example you gave, to determine the diagram type, you could simply navigate to the diagram and check it's type.
i.e. view.getDiagram().getType()

Comment 3 Frederic Plante CLA 2006-02-23 11:49:26 EST
Hi Alex,

Do we plan to fix this one?

  Thanks

    - Fred
Comment 4 Alex Shatalin CLA 2006-02-24 06:31:34 EST
There are still some questions connected with shortcutting functionality (AFAIU, the same functionality will be provided by runtime).

But, in general yes. M6.
Comment 5 Alex Shatalin CLA 2006-04-14 08:57:57 EDT
Visual ID <-> View.getType()
Model ID <-> Diagram.getType()

Additional annotation holding Model ID will be created only for shortcuts.
Comment 6 Richard Gronback CLA 2008-08-13 13:07:21 EDT
[target cleanup] 1.0 M6 was the original target milestone for this bug
Comment 7 Eclipse Webmaster CLA 2010-07-19 22:19:53 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Generation was the original product and component for this bug