Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Providing default style for notation element
Providing default style for notation element [message #1738432] Tue, 19 July 2016 19:27 Go to next message
Leonid Ripeynih is currently offline Leonid RipeynihFriend
Messages: 150
Registered: February 2012
Senior Member
Hello!

I'd like to provide default style for some elements in my diagram. Basically what I need is some kind of callback like:
viewAboutToBeCreated(Element domain, View view) {
...
}

Where I can analyze domain elements and set some styles in view. (I want to automatically set style to sync view with a model)
As I'm writing It it seems to me that setting a listener on editing domain and listening for view creation should work. But I wonder, is there more idiomatic, papyrus/gmf specific way of doing it, maybe better integrated with style application lifecycle?

Thanks in advance!
Re: Providing default style for notation element [message #1738433 is a reply to message #1738432] Tue, 19 July 2016 19:37 Go to previous message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1199
Registered: July 2009
Location: Canada
Senior Member

Hi,

Yes, the idomatic "Papyrus way" is to use CSS to control the styling of
your diagrams. This includes the 'canonical' style which, although
perhaps not a style in the traditional sense, is implemented in the GMF
run-time (and therefore in Papyrus) as a notation style.

So, something like:

Class {
canonical: true;
}

in a stylesheet makes all views of classes synchronized. And this:

* {
canonical: true;
}

makes all views in a diagram synchronized.

Stylesheets can be attached to a specific diagram, to a model, to a
project, or to the entire workspace. They can be applied by reference
to *.css resources in the workspace or (in the case of model/diagram
stylesheets) by reference to stylesheet text embedded in the model,
itself.

Look for documentation in the on-line help, in a "CSS Stylesheets"
topic under the "Papyrus Guide". Sorry, I can't provide a web link
because the Papyrus help isn't (yet) published to help.eclipse.org.

HTH,

Christian


On 2016-07-19 19:27:06 +0000, Leonid Ripeynih said:

> Hello!
>
> I'd like to provide default style for some elements in my diagram.
> Basically what I need is some kind of callback like:
>
> viewAboutToBeCreated(Element domain, View view) {
> ..
> }
>
> Where I can analyze domain elements and set some styles in view. (I
> want to automatically set style to sync view with a model)
> As I'm writing It it seems to me that setting a listener on editing
> domain and listening for view creation should work. But I wonder, is
> there more idiomatic, papyrus/gmf specific way of doing it, maybe
> better integrated with style application lifecycle?
>
> Thanks in advance!
Previous Topic:Framework-Independent Types
Next Topic:Values of stereotype attributes not shown
Goto Forum:
  


Current Time: Tue Feb 25 13:56:36 GMT 2020

Powered by FUDForum. Page generated in 0.10191 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top