Home » Eclipse Projects » Sirius » Dynamic creation of layers
Dynamic creation of layers [message #1386785] |
Fri, 20 June 2014 12:56 |
Daniel Strueber Messages: 11 Registered: April 2014 |
Junior Member |
|
|
Hi,
one of the greatest features in Sirius seems to be its support for multiple layers that can be switched on and off. This really has the potential to make life easier when working on big models.
However, as far as I recognize from the documentation, layers are always defined statically, that is, I need to know each desired layer at design time and include an entry for each layer in the .odesign model. Is this true, or is there maybe support for dynamic layers where I just create an arbitrary number of layers depending on a property outside the scope of the .odesign model?
Regards,
Daniel
[Updated on: Fri, 20 June 2014 12:57] Report message to a moderator
|
|
|
Re: Dynamic creation of layers [message #1386803 is a reply to message #1386785] |
Fri, 20 June 2014 15:28 |
|
Hi Daniel,
Indeed, the layers are defined statically in the VSM (.odesign file).
Regards,
Laurent
Le 20/06/2014 14:56, Daniel Strueber a écrit :
> Hi,
>
> one of the greatest features in Sirius seems to be its support for
> multiple layers that can be switched on and off. This really has to
> potential to make life easier when working on big models.
>
> However, as far as I recognize from the documentation, layers are always
> defined statically, i.e. I need to know each desired layer at design
> time and include an entry for each layer in the .odesign model. Is this
> true, or is there maybe support for dynamic layers where I just create
> an arbitrary number of layers depending on a property outside the scope
> of the .odesign model?
>
> Regards,
> Daniel
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| |
Re: Dynamic creation of layers [message #1386931 is a reply to message #1386804] |
Mon, 23 June 2014 07:41 |
|
Hi,
It's not possible. The refresh mechanism does not support dynamic
layers. During a refresh, this mechanism uses the layers of activated
viewpoints. So the new layers (dynamic layers) are ignored during this step.
This new feature would require, among others, specific code in refresh
mechanism.
Regards,
Laurent
Le 20/06/2014 17:36, Daniel Strueber a écrit :
> Thanks Laurent. My question would be if there was any way to make
> dynamic layers possible, maybe by working around the VSM? I have at
> least 3 use-cases in mind where dynamic layers would be really handy.
>
> Regards,
> Daniel
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: Dynamic creation of layers [message #1386947 is a reply to message #1386804] |
Mon, 23 June 2014 08:41 |
|
Le 20/06/2014 17:36, Daniel Strueber a écrit :
> Thanks Laurent. My question would be if there was any way to make
> dynamic layers possible, maybe by working around the VSM? I have at
> least 3 use-cases in mind where dynamic layers would be really handy.
Can you give us a hint about these use cases you have in mind? Maybe
other existing mechanisms in Sirius could work for your case. An if not,
it could give us ideas for future evolutions.
Pierre-Charles David - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| | |
Re: Dynamic creation of layers [message #1387147 is a reply to message #1386991] |
Tue, 24 June 2014 12:18 |
Daniel Strueber Messages: 11 Registered: April 2014 |
Junior Member |
|
|
One of the use-cases is a tool that allows to split a large model into sub-models [1]. One component of the tool is a Sirius-based editor that is used to review an automatically generated splitting suggestion. In the viewpoint, we assign different colours and labels for each target sub-model. However, it would make life even easier if the user could hide/emphasize particular sub-models. We would need dynamic layers for that because the number of sub-models is not fixed.
The other two use-cases are similar, except that they would benefit from dynamic layers even more: In scenarios where one element can have multiple assignments (or "tags", as accurately described by Felix), colors and labels quickly reach their limitations.
[1] www.uni-marburg.de/fb12/swt/forschung/software/splittr/
[Updated on: Tue, 24 June 2014 12:23] Report message to a moderator
|
|
|
Re: Dynamic creation of layers [message #1387614 is a reply to message #1387147] |
Wed, 25 June 2014 10:28 |
|
Hi.
Le 24/06/2014 14:18, Daniel Strueber a écrit :
> One of the use-cases is a tool that allows to split a large model into
> sub-models [1]. One component of the tool is a Sirius-based editor that
> is used to review an automatically generated splitting suggestion. In
> the viewpoint, we assign different colours and tags for each target
> sub-model. However, it would make life even easier if the user could
> hide/emphasize particular sub-models. We would need dynamic layers for
> that because the number of sub-models is not fixed.
>
> The other two use-cases are similar, except that they would benefit from
> dynamic layers even more: In scenarios where one element can have
> multiple assignments (or "tags", as accurately described by Felix),
> colors and labels quickly reach their limitations.
I understand the need, but I'm not sure layers are the right tool to
adress it (at least they were not designed with this in mind).
There may be other ways to achieve the result you want though. The
different parts you need seem to be:
1. A model, that you can populate dynamically, that identifies which
sub-models (or tags in Felix's example) are available, and which ones
are selected. You propose to reuse Sirius's notion of Layer for this,
but this could be another model. The "which sub-models are available"
part probably already exists in your domain model in a more or less
explicit way. The "which ones are selected" probably doesn't, but let's
assume for now it does.
2. You also need a UI to allow users to see these "categories", and
control which ones are selected. Your proposal is to reuse the "Layers"
combo in the tabbar, but it could be something else: a (dynamic) context
menu created in Java using the standard Eclipse contribution mechanisms,
or even another combo integrated into the diagram's integrated tab-bar
(if you are running on Luna, the tab-bar can be extended with your own
actions using standard Eclipse mechanisms).
3. Finally, you need a way to control the visibility and/or styling of
your diagram elements depending on which categories the user has
enabled. To completely hide elements which are not part of a selected
category, you can use a Mapping Filter [1] with a condition which
depends on the current selection of categories. To alter the visual
style of elements instead of completly hiding them, you can use
Conditional Styles [2], once again with a condition on the current
selection of categories.
I mentioned earlier that "which categories are selected" is probably not
an information you have in your domain model. Depending on your case it
could make sense to store it there, but if not, there is a mechanism in
Sirius (called "feature extensions") which allows you to store custom
data inside the aird files, so that you can access them in the
definition of your representations, but they do not "pollute" your
domain model. This mechanism is not documented right now, but if you
decide to go this way we can provide some pointers, and maybe take this
opportunity to write the missing doc.
Hope this helps. Don't hesitate if you have further questions.
[1]
https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#mapping_filter
[2]
https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#conditional_styles
Pierre-Charles David - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| |
Re: Dynamic creation of layers [message #1391043 is a reply to message #1388298] |
Mon, 30 June 2014 11:11 |
|
Le 26/06/2014 10:25, Daniel Strueber a écrit :
> Thanks a lot, Pierre. In the light of your proposed solutions, I now
> agree that dynamic layers are indeed not necessary to handle our
> use-cases. The feature extension mechanism surely sounds relevant for
> us. Documentation would be brillant, but a usage example may also help.
You can find an example in the project at [1]. The example still refers
to the old pre-Sirius fr.obeo.dsl.viewpoint namespace, but except for
the package names this API has not changed in Sirius.
Basically you need the following things:
1. A (generally small) metamodel which defines the custom data you want
to put into the aird file. You must have a "root type" which extends
DFeatureExtension from the Sirius metamodel. See [2].
2. A Java class which implements the FeatureExtension interface from the
Sirius API and one which implements FeatureExtensionServices. In basic
cases they can be pretty trivial. See [3].
3. The extension must be registered through the appropriate extension
point, see [4].
4. Once this is done, you can use the FeatureExtensionsManager API to
retrieve (or create) the instance of your data model associated to a
given Sirius session (represented by a DAnalysis in the code). You can
then query and manipulate it however you want. See [5] for an exemple of
Java methods to help with the lifecycle.
Going back to your case, you would then write filtering and/or
conditional style expressions which invoke Java code (for example as
"service:" calls [6]) to test the current state of your custom "which
categories are selected" model.
> By the way, congratulations for releasing Sirius 1.0.0!
Thanks!
[1] https://github.com/ObeoNetwork/InformationSystem
[2]
https://github.com/ObeoNetwork/InformationSystem/tree/master/designs/graal/plugins/org.obeonetwork.graal.design/model
[3]
https://github.com/ObeoNetwork/InformationSystem/tree/master/designs/graal/plugins/org.obeonetwork.graal.design/src/org/obeonetwork/graal/design/extension
[4]
https://github.com/ObeoNetwork/InformationSystem/blob/master/designs/graal/plugins/org.obeonetwork.graal.design/plugin.xml#L17
[5]
https://github.com/ObeoNetwork/InformationSystem/blob/master/designs/graal/plugins/org.obeonetwork.graal.design/src/org/obeonetwork/graal/design/services/configuration/UIConfigurationServices.java
[6]
https://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html#specialized
Pierre-Charles David - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Goto Forum:
Current Time: Wed Sep 25 13:42:51 GMT 2024
Powered by FUDForum. Page generated in 0.07362 seconds
|