Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Attach CSS to Profile plugin
Attach CSS to Profile plugin [message #1755524] Sat, 04 March 2017 14:07 Go to next message
Athanasios Zolotas is currently offline Athanasios ZolotasFriend
Messages: 52
Registered: November 2016
Location: York
Member
Hi,

I created a UML profile in Papyrus and I converted it to a plugin project. I can see this profile in the registered profiles when I create a new model (in a new Papyrus instance that has the plugin loaded). I am also able to create a custom palette for the stereotypes and this palette appears when I create a new Class diagram that has the profile applied (my stereotypes extend the Class and Association metaclasses of UML).

What I am not able to do and I don't know even how to start is to "attach" a css file to my profile so it will be automatically applied to the models I create using the registered profile.

For example, let's say that I would like all the elements that are stereotyped as "Stereo A" to by a red oval or use a custom SVG. I don't want to force the user apply the css style to the class diagram while creating the diagram. I want the stylesheet to be connected with the profile (thus, somehow add it to the profile when I create it in the plugin project) and when the user drags the "Stereo A" from the custom palette to have the style applied and shown automatically.
Re: Attach CSS to Profile plugin [message #1755596 is a reply to message #1755524] Mon, 06 March 2017 09:00 Go to previous messageGo to next message
Patrik Nandorf is currently offline Patrik NandorfFriend
Messages: 195
Registered: January 2013
Location: Sweden
Senior Member
Hi Athanasios,

I assume you have a working css.

You have to register the css using the org.eclipse.papyrus.infra.gmfdiag.css.theme extension point.

This information seems to be missing from the help.
Re: Attach CSS to Profile plugin [message #1755649 is a reply to message #1755596] Mon, 06 March 2017 14:46 Go to previous messageGo to next message
Athanasios Zolotas is currently offline Athanasios ZolotasFriend
Messages: 52
Registered: November 2016
Location: York
Member
Hi Patrik,

thanks for your reply. I did what you suggested but I understand that this creates, let's say, a global css them for the papyrus instance. Even in this case, doesn't have the user to select the theme manually? I tried to set my theme to be the default but my understanding according to the documentation is that in order for this to happen you have to change the .ini file that is shipped with the papyrus instance. Right?
Re: Attach CSS to Profile plugin [message #1755717 is a reply to message #1755649] Tue, 07 March 2017 08:29 Go to previous messageGo to next message
Patrik Nandorf is currently offline Patrik NandorfFriend
Messages: 195
Registered: January 2013
Location: Sweden
Senior Member
Ok, I actually assumed that would be enough to register the css as the default one.

I usually tie the css to the diagram using viewpoints, see http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.papyrus.infra.viewpoints.doc%2Ftarget%2Fgenerated-eclipse-help%2Fviewpoints.html. It is a bit more advanced but I feel it gives a more coherent approach since it ties profiles, palette, diagrams and css together nicely.

Regards
Patrik
Re: Attach CSS to Profile plugin [message #1755767 is a reply to message #1755717] Tue, 07 March 2017 18:03 Go to previous messageGo to next message
Athanasios Zolotas is currently offline Athanasios ZolotasFriend
Messages: 52
Registered: November 2016
Location: York
Member
Hi Patrik,

I didn't know that I could do that until yesterday evening. I agree with you that it is way better than having the palette.xml file so I started since yesterday implementing my profile using Viewpoints. (No luck so far as I get an exception I can't resolve but I will get there).

[Updated on: Tue, 07 March 2017 18:04]

Report message to a moderator

Re: Attach CSS to Profile plugin [message #1756208 is a reply to message #1755524] Tue, 14 March 2017 00:31 Go to previous messageGo to next message
Tonero toneo is currently offline Tonero toneoFriend
Messages: 24
Registered: March 2017
Junior Member
Hi,

I am trying to create a UML profile and a plugin, similar to what you did. How do I go about it?
Your help is appreciated.
Re: Attach CSS to Profile plugin [message #1756292 is a reply to message #1756208] Wed, 15 March 2017 07:36 Go to previous messageGo to next message
Athanasios Zolotas is currently offline Athanasios ZolotasFriend
Messages: 52
Registered: November 2016
Location: York
Member
Hi,

I suggest you to do it using a custom Viewpoint. As Patrick suggested you can find more information here.

What I found very useful, was this open source project where they use the afortementioned technology to build an editor for Archimate (take a look on what they have done at the archimate and archimate.diagram projects).
Re: Attach CSS to Profile plugin [message #1757800 is a reply to message #1756292] Mon, 20 March 2017 00:42 Go to previous message
Tonero toneo is currently offline Tonero toneoFriend
Messages: 24
Registered: March 2017
Junior Member
I looked at the project and was able to make some progress. I defined a viewpoint extension, a custom diagram and a viewpoint category. However, I am unable to display my custom diagram in the "Select a Diagram Kind" Editor. Do you know what I am missing? Thanks
Previous Topic:Custom diagram type for DSML: plugin/extension
Next Topic:Display Requirements in all other diagrams
Goto Forum:
  


Current Time: Sun Oct 06 20:01:43 GMT 2024

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

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

Back to the top