Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 419325 - Stylesheets: [appliedStereotypes~="myStereotype"] does not work
Summary: Stylesheets: [appliedStereotypes~="myStereotype"] does not work
Status: RESOLVED FIXED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Diagram (show other bugs)
Version: 0.10.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Camille Letavernier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-13 15:06 EDT by Toni Siljamäki CLA
Modified: 2013-10-30 05:11 EDT (History)
3 users (show)

See Also:


Attachments
Screenshot showing that it doesnt work (568.35 KB, image/jpeg)
2013-10-19 09:00 EDT, Toni Siljamäki CLA
no flags Details
...and here is the test project I used (439.76 KB, application/x-zip-compressed)
2013-10-19 09:01 EDT, Toni Siljamäki CLA
no flags Details
...and here is all my installed Luna software (253.39 KB, image/jpeg)
2013-10-19 09:10 EDT, Toni Siljamäki CLA
no flags Details
Screenshot - Sample project - Luna Nightly (94.07 KB, image/png)
2013-10-21 07:06 EDT, Camille Letavernier CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Toni Siljamäki CLA 2013-10-13 15:06:15 EDT
We have a proprietary profile defined for a graphical DSL.

The [appliedStereotypes~="myStereotype"] described in
Papyrus Help does not work.

Component {
  fillColor: white;
}

...works fine, but the following does not:

[appliedStereotypes~="myStereotype"] {
  fillColor: white;
}

...where the myStereotype is applied to components.
Comment 1 Camille Letavernier CLA 2013-10-16 05:16:08 EDT
I cannot reproduce this issue.

Few questions:

- The W3C CSS Specification is case-insensitive. However, the Eclipse/Papyrus implementation is case-sensitive. Did you check the case?
- Rules are ordered by priority, depending on the complexity of the rule. Then, if two rules are equally complex, the last one is used. Do you have some other rules with a higher complexity? (e.g. Component.myStyle {...} would have a higher priority than [appliedStereotypes~="something"], because it combines two selectors)
- Rules occuring after a Stylesheet parse error are ignored, whereas rules occuring before the parse error are correctly handled. Is your stylesheet 100% valid?
- User-defined styles always have a higher priority than CSS-Computed styles. Did you manually change the color of your component? If so, did you try the "reset style" action, to remove user-defined styles?
Comment 2 Toni Siljamäki CLA 2013-10-16 13:53:23 EDT
1) Yes, I have checked the case.

2) I looked under Papyrus Help, which doesn't say anything about "complexity",
   like providing examples of what works and what doesn't,
   but I could not understand why this would affect my very simple example.

3) The stylesheet appears to be valid, and no messages in the Error Log´.

4) The "reset style" / "Default style" makes the diagram look really ugly.
   I usually close the model and open it again to get back to where I were
   graphics-wise to make another try

Here is an example that works:

* {
	gradient: white vertical;
	routing: Rectilinear;
}

Component {
	fillColor: white;
 	transparency: 100;
	lineColor: white;
	bold: true;
}

The <<component>> and its name get bold typeface.
Here is an example that doesn't work, after I closed and reopened the model:

* {
	gradient: white vertical;
	routing: Rectilinear;
}

Component {
	fillColor: white;
 	transparency: 100;
	lineColor: white;
}

Component [appliedStereotypes~="MYComponent"] {
	bold: true;
}

No bold typeface! I even tried the following:

Component [appliedStereotypes~="mYComponent"] {
	bold: true;
}

...because sometimes I have seen in other proprietary profiles that
the first capital letter in the stereotype for some reason get
turned into lower case, like in the XYZProfile in other bug reports.

No bold typeface here either.

The component actually has two stereotypes applied,
so I have also tested the following two cases:

Component [appliedStereotypes~="TypeSymbolDefinition"] {
	bold: true;
}

Component [appliedStereotypes~="PapyurusInternal::Symbols::TypeSymbolDefinition"] {
	bold: true;
}

...since both of them should work, according to Help,
but a newly added component does not get bold typeface.

Just in case, since I don't really get this thing about "complexity" etc.
I have also tried to reverse the order of the two simple rules like this:

* {
	gradient: white vertical;
	routing: Rectilinear;
}

Component [appliedStereotypes~="TypeSymbolDefinition"] {
	bold: true;
}

Component {
	fillColor: white;
 	transparency: 100;
	lineColor: white;
}

...but there is still no bold typeface.
But the following works fine:

* {
	gradient: white vertical;
	routing: Rectilinear;
}

Component [appliedStereotypes~="TypeSymbolDefinition"] {
	bold: true;
}

Component {
	fillColor: white;
 	transparency: 100;
	lineColor: white;
	bold: true;           /* THIS ONE WORKS */
}

...so apparently there is something wrong with the support for
[appliedStereotypes~="something"], from what I can understand.

I simply cannot get it to work.
Comment 3 Camille Letavernier CLA 2013-10-17 04:01:15 EDT
The CSS syntax is sensitive to white spaces. The following rules are *not* equivalent:

Component[appliedStereotypes~="MyStereotype"]{

}

Component [appliedSteretoypes~="MyStereotype"]{

}

The first one means "Components with the Stereotype MyStereotype"

The second one means "Elements with the Stereotype MyStereotype, and that are children of a Component" (The white space between two selectors means "Descendant").
Comment 4 Toni Siljamäki CLA 2013-10-17 08:27:59 EDT
OK - I didn't even notice that white space. :(
So I just gave it another try.

I now have a stylesheet with only a single rule in it, one at the time
of the rules below, closing and reopening the model for each attempt,
and then trying to create one stereotypes component with bold typeface.

The first two works:

Component {
	bold:true;
}

* {
	bold:true;
}


...but the ones below does *not* work.

I have also removed the whitespace between ] and { just in case
that whitespace also happened to have some unexpected semantics.

Component[appliedStereotypes~="MYComponent"] {
	bold:true;
}

Component[appliedStereotypes~="mYComponent"] {
	bold:true;
}

Component[appliedStereotypes~="MYProfile::MYComponent"] {
	bold:true;
}

Component[appliedStereotypes~="TypeSymbolDefinition"] {
	bold: true;
}

Component[appliedStereotypes~="PapyurusInternal::Symbols::TypeSymbolDefinition"] {
	bold: true;
}

[appliedStereotypes~="MYComponent"] {
	bold:true;
}

[appliedStereotypes~="mYComponent"] {
	bold:true;
}

[appliedStereotypes~="MYProfile::MYComponent"] {
	bold:true;
}

[appliedStereotypes~="TypeSymbolDefinition"] {
	bold: true;
}

[appliedStereotypes~="PapyurusInternal::Symbols::TypeSymbolDefinition"] {
	bold: true;
}
Comment 5 Camille Letavernier CLA 2013-10-18 08:53:56 EDT
This works for me (I've tried with SysML Blocks in the Component Diagram):

Component[appliedStereotypes~="Block"]{
	bold:true;
}

[appliedStereotypes~="SysML::Blocks::Block"]{
	fontColor:red;
}


Components stereotyped with SysML::Blocks::Block are bold & red. Tested on Luna M2/Nightly.

(Note: you don't need to re-open the diagram when you change a Stylesheet. You can simply use the "Refresh" button in the toolbar (although the F5 bind does not work))
Comment 6 Camille Letavernier CLA 2013-10-18 08:56:14 EDT
BTW, CSS Stylesheets are an extra-component of Papyrus, so they are not updated through the same update site as Papyrus itself. I'm just thinking that we may have forgotten to update the Discovery Site ("Install Papyrus extra components").

So maybe you're still using the Kepler version of the CSS?

You should try updating CSS with the following update site:

http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/luna/extra
Comment 7 Toni Siljamäki CLA 2013-10-19 09:00:46 EDT
Created attachment 236682 [details]
Screenshot showing that it doesnt work

I'm using Luna and I have the following update site:
http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/luna/

Each time I make an update the CSS gets updated to. :)
...probably because I installed it manually and it needs to be updated?

Your example doesn't work either.
I reopen the model each time, but hat seems to be necessary only when
something has been removed, not when new things are added to the graphics.

The F5 problem has a separate bug report.
Comment 8 Toni Siljamäki CLA 2013-10-19 09:01:49 EDT
Created attachment 236683 [details]
...and here is the test project I used
Comment 9 Toni Siljamäki CLA 2013-10-19 09:10:28 EDT
Created attachment 236684 [details]
...and here is all my installed Luna software
Comment 10 Klaas Gadeyne CLA 2013-10-21 06:14:14 EDT
(In reply to Toni Siljamäki from comment #9)
> Created attachment 236684 [details]
> ...and here is all my installed Luna software

I have the same problem here.  Works fine in Kepler, but not in Luna.  I thought first that this was related to the discovery site problem mentioned in https://bugs.eclipse.org/bugs/show_bug.cgi?id=419325#c6 (see first Luna versions), but after updating (see second luna versions) it still doesn't work...

--
Luna: Doesn't work
  Papyrus CSS Feature (Incubation)      0.10.0.v201306261119    org.eclipse.papyrus.extra.infra.gmfdiag.css.feature.feature.group Eclipse Modeling Project
  Papyrus UML (Incubation)              0.10.1.v201309181302    org.eclipse.papyrus.sdk.feature.feature.group                     Eclipse Modeling Project

  Papyrus CSS Feature (Incubation)      0.10.1.v201310210510    org.eclipse.papyrus.extra.infra.gmfdiag.css.feature.feature.group Eclipse Modeling Project
  Papyrus UML (Incubation)              0.10.1.v201310020936    org.eclipse.papyrus.sdk.feature.feature.group                     Eclipse Modeling Project

Kepler: works fine
  Papyrus Extra Feature (Incubation)    0.10.1.v201310170739    org.eclipse.papyrus.extra.feature.feature.group Eclipse Modeling Project
  Papyrus UML (Incubation)              0.10.1.v201310170722    org.eclipse.papyrus.sdk.feature.feature.group   Eclipse Modeling Project
Comment 11 Camille Letavernier CLA 2013-10-21 07:06:38 EDT
Created attachment 236701 [details]
Screenshot - Sample project - Luna Nightly

> I have the same problem here. Works fine in Kepler, but not in Luna. 

Which is really strange, because the stereotypes support has never been implemented on Kepler

> ...and here is the test project I used

Works for me.

I've used my previously installed Luna version (~ 2013/10/18 nightly), it worked. Then I updated to today's version, and it still works.

I need to find some time to update the version numbers on Luna and Kepler (0.10.2 for Kepler and 1.0.0 for Luna, instead of 0.10.1 for both), to get rid of any possible confusion.
Comment 12 Camille Letavernier CLA 2013-10-21 07:14:02 EDT
> I'm using Luna and I have the following update site:
> http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/luna/
> 
> Each time I make an update the CSS gets updated to. :)
> ...probably because I installed it manually and it needs to be updated?

http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/luna/ is actually a composite update site. It contains the following:

http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/luna/main
http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/luna/extra

So, if you use it for updates, it also updates the CSS feature.
Comment 13 Klaas Gadeyne CLA 2013-10-21 09:55:17 EDT
(In reply to Camille Letavernier from comment #11)
> Created attachment 236701 [details]
> Screenshot - Sample project - Luna Nightly
> 
> > I have the same problem here. Works fine in Kepler, but not in Luna. 
> 
> Which is really strange, because the stereotypes support has never been
> implemented on Kepler
> 
> > ...and here is the test project I used
> 
> Works for me.
> 
> I've used my previously installed Luna version (~ 2013/10/18 nightly), it
> worked. Then I updated to today's version, and it still works.

Very strange.  I noticed above that my Papyrus UML plugin in c10 was not the latest and greatest, so I upgraded that one too (using http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/luna/).  The result is.

clipse Modeling Tools

Version: Luna Release
Build id: 20131003-0825

  Eclipse Modeling Tools	2.1.0.20131003-0759	epp.package.modeling	null
  Papyrus CSS Feature (Incubation)	0.10.1.v201310210510	org.eclipse.papyrus.extra.infra.gmfdiag.css.feature.feature.group	Eclipse Modeling Project
  Papyrus UML (Incubation)	0.10.1.v201310210455	org.eclipse.papyrus.sdk.feature.feature.group	Eclipse Modeling Project

With this version, it is not working either here...

(Notice that I've not installed any additional extra plugins apart from the CSS feature, but I guess that shouldn't be a problem, right?)
Comment 14 Camille Letavernier CLA 2013-10-21 10:23:42 EDT
Can you check if you have the following plug-in installed:

org.eclipse.papyrus.uml.diagram.css / 0.10.1 (> 2013/10/...)

Help > About Eclipse SDK > Installation details > Plug-in tab

If it's absent, then this is an installation issue.

If it's present, then maybe there is a missing declared dependency. You can try the following:

- Open the "Plug-in registry" view (Window > Show view... > Plug-in Registry). This view usually freezes my environment for a few dozens of seconds.
- Find "org.eclipse.papyrus.uml.diagram.css"
- Right click > Show advanced operations
- Right click > Diagnose

I will try a new fresh installation of Eclipse Luna M2 + Papyrus Luna M2 with only the CSS Extra Feature (From the Discovery site) and see if I can reproduce the issue.
Comment 15 Klaas Gadeyne CLA 2013-10-21 10:32:14 EDT
(In reply to Camille Letavernier from comment #14)
> Can you check if you have the following plug-in installed:
> 
> org.eclipse.papyrus.uml.diagram.css / 0.10.1 (> 2013/10/...)
> 
> Help > About Eclipse SDK > Installation details > Plug-in tab
> 
> If it's absent, then this is an installation issue.

I don't have it, only papyrus.infra.gmfdiag.css.* are present, but not uml.diagram.css
Comment 16 Camille Letavernier CLA 2013-10-21 10:35:51 EDT
Ok I see. I will fix that then.

These are two separate features (Basic CSS Framework, and UML CSS Specialization). The discovery site has not been updated, and only installs the generic framework.

I've installed all extra components, which includes the UML/CSS Integration.
Comment 17 Camille Letavernier CLA 2013-10-21 10:54:43 EDT
Fixed in 3ee46e3945765fb4b413e2a9a29cfe3464610c75 (Website repo/Discovery site). Pushed to master
Fixed in 1f1d9cdf477451904a10e10405c8d716b8c60719 (Papyrus repo). Pushed to master

The discovery site is fixed (Now includes the UML/CSS Integration with support for Stereotypes).
I've also renamed the UML/CSS Integration feature to be more consistent.

Note that the Discovery Site is based on Luna M2, which is an older version than the Nightly build. So, you may have some installation issues (But I'm almost sure Eclipse Installer can find an alternative solution). If the installation (using the Discovery site) doesn't work, you have two alternative solutions:

1) Re-install the CSS Component:

- Uninstall Papyrus CSS (Help > About Eclipse SDK > Installation Details > Installed Software Tab > Select Papyrus CSS Feature > Uninstall)
- Restart
- Help > Install Papyrus Additional Components > Diagram Stylesheets

2) Install only UML Diagram CSS

- Using the nightly update site: Uncheck "Group items by category"
- Install "UML CSS Feature" (Or "Papyrus UML CSS Feature" after the rename)
Comment 18 Camille Letavernier CLA 2013-10-21 11:28:02 EDT
Tested with the following installation:

- Eclipse Classic / Luna M2 (4.4M2)
- Papyrus / Luna nightly Main*: http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/luna/main
- Use the discovery site to install Diagram Stylesheets

* Papyrus Luna M2 will not work because it still uses the Kepler discovery site

With these steps, the two features (CSS Framework + UML/CSS Integration) are properly installed, and the attached example works.
Comment 19 Toni Siljamäki CLA 2013-10-30 05:11:03 EDT
Yep, works now! :)