Custom palette depending on diagram instance [message #1709056] |
Wed, 23 September 2015 15:37 |
Rafal Filipiuk Messages: 14 Registered: September 2015 |
Junior Member |
|
|
Hi,
So I've been coding my implementation of my DiagramType using patterns, and I understand that the FeatureProvider is responsible for registering them (with addPattern()). What I need to be able to do is register patterns depending on the presence of some EObjects in my diagram instance's model file resource. For example, if an EObject of type Foo with name 'This is X' is present, I need to add a pattern as such: addPattern(new FooPattern('This is x')).
The main goal is so that when the user boots up the Diagram, the palette displays all instances of Foo as independent EClasses that, once the user creates them, will be serialized into instances of Bar.
To reiterate and clarify:
-Diagram resource (model file) has serialized instances of Foo.
-For every instance of Foo, a palette entry should exist
-Every palette entry creates instances of Bar, which are then serialized into our resource.
So essentially, I need to create patterns from an instance of a diagram, not from the diagram type. How would I do that? Is there anywhere I can regenerate the palette when opening a diagram file?
Thanks again for such prompt responses to questions.
Raf
|
|
|
|
Re: Custom palette depending on diagram instance [message #1709197 is a reply to message #1709112] |
Thu, 24 September 2015 19:25 |
Rafal Filipiuk Messages: 14 Registered: September 2015 |
Junior Member |
|
|
From what method can I refer to the diagram editor to be able to add patterns from my model file's Foos? The palette needs to be updated right away when the user opens the diagram file.
From what I understand, when I open a diagram file, the diagramEditor is initialized (along with my featureProvider and its patterns), and then the diagram file is drawn. Is there a way to change the 'opening diagram file' behavior so I can deserialize its model file and add the missing patterns? I just don't know at what point I can refer to the diagram editor's diagram file..
[Updated on: Thu, 24 September 2015 21:10] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03430 seconds