Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Grayed diagram name when reopening aird(repon diagram)
Grayed diagram name when reopening aird [message #1829110] Thu, 25 June 2020 10:18 Go to next message
Franco Bergomi is currently offline Franco BergomiFriend
Messages: 6
Registered: July 2009
Junior Member
Hi, I'm having a strange behaviour with Sirius.

I designed a simple viewpoint with a couple of diagram representations, to display some xml files in a fancy way.
The xml files are constrained by an XSD that I transformed to .ecore, and then corresponding model/edit/editor.
I added some derived/transient/volatile references in order to easily handle name-based references in the XML.

When I create a new representation file for an xml file, I have absolutely no problem when creating diagrams, showing/removing elements from the diags, edition through property views, and saving.

If i close and then reopen the project, the aird will properly open, with the model tree.
BUT the diagrams names appear "grayed", and when I click them nothing happens.
No log, no console message, no stacktrace (even in runtime).
> see attached "Sirius_Gray.jpg" file.
I am using Obeo designer 11.1.1 / Sirius 6.1.1

How can I investigate this issues by Myself?

regards!
Franco

[Updated on: Thu, 25 June 2020 10:19]

Report message to a moderator

Re: Grayed diagram name when reopening aird [message #1829114 is a reply to message #1829110] Thu, 25 June 2020 11:18 Go to previous messageGo to next message
Antonio Garmendia is currently offline Antonio GarmendiaFriend
Messages: 93
Registered: May 2014
Member
Hi Franco,

I think that we are having the same problem, and I was about to comment on this when I saw your post.

Do you generate an Ecore from the XSD right? May I ask you if the ExtendedMetada attached to the package equals to false? If that is the case I would say that this is a problem. In my case, I changed this (qualified = true) an the problem disappear. Would you check that and let me know? Thanks. At this moment, I do not have a better solution for this, but probably any other user will propose something better.

Cheers,
Anthony
Re: Grayed diagram name when reopening aird [message #1829122 is a reply to message #1829114] Thu, 25 June 2020 12:19 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
Hi,

The greyed labels for representation are used to indicate a representation (diagram) which exists in the aird file, but is considered invalid (as per org.eclipse.sirius.business.api.query.DRepresentationDescriptorQuery.isRepresentationValid()).

The most common reason for this to happen is that the semantic element to which it is attached can no longer be found, at least using the URI which was stored in the aird. This can happen if you modify your semantic models outside the scope of the Sirius session in a way that changes the URI of the element.

Regards,
Pierre-Charles


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Grayed diagram name when reopening aird [message #1829123 is a reply to message #1829122] Thu, 25 June 2020 12:58 Go to previous messageGo to next message
Antonio Garmendia is currently offline Antonio GarmendiaFriend
Messages: 93
Registered: May 2014
Member
Hi Pierre,

Based on this [1] basic family example I just added to the basicfamily package qualified=false. The obtained result is the one described by Franco. Find attached the minimal example. Would you take a look at the code? Thanks in advance.

Kind regards,
Anthony

[1] https://www.eclipse.org/forums/index.php?t=msg&goto=1273183

[Updated on: Thu, 25 June 2020 12:59]

Report message to a moderator

Re: Grayed diagram name when reopening aird [message #1829130 is a reply to message #1829122] Thu, 25 June 2020 14:51 Go to previous messageGo to next message
Franco Bergomi is currently offline Franco BergomiFriend
Messages: 6
Registered: July 2009
Junior Member
Hi Pierre Charles,
I found the method DRepresentationDescriptorQuery#isDangling, and it if finding that repDescriptor.getTarget() actually returns "null".

I watched the content of the aird file (target of the DSemanticDiagram:
it shows :
"<target xmi:type="TypeDtp5g" href="My.dtp5g#//@dtp5g"/>"

I notice that

However, I did some testing by adding a cross reference between 2 of my "xml" models and the link is properly resolved with the same "href" when using the reflexive EMF editor (or my dedicated generated editor)

In the opposite way, when opening my aird with the reflexive ecore editor, the referenced model is not loaded at all, even if i explicitely click on the DSemanticDiagram & refresh the property view (target).

And if I validate the .aird i get an NPE :
java.lang.NullPointerException
	at org.eclipse.emf.ecore.util.EObjectValidator.validate_EveryProxyResolves(EObjectValidator.java:748)
	at org.eclipse.emf.ecore.util.EObjectValidator.validate_EveryDefaultConstraint(EObjectValidator.java:351)
	at org.eclipse.emf.ecore.util.EObjectValidator$DynamicEClassValidator.validate(EObjectValidator.java:1426)
	at org.eclipse.emf.ecore.util.EObjectValidator$DynamicEClassValidator.validate(EObjectValidator.java:1429)
	at org.eclipse.emf.ecore.util.EObjectValidator.validate(EObjectValidator.java:333)
	at org.eclipse.sirius.tools.internal.validation.EValidatorAdapter.validate(EValidatorAdapter.java:70)


Seems like Sirius internally load the model in the bad way.
I'm looking if I can help Sirius do that :)

regards,
Franco

[Updated on: Thu, 25 June 2020 16:24]

Report message to a moderator

Re: Grayed diagram name when reopening aird [message #1829135 is a reply to message #1829114] Thu, 25 June 2020 16:23 Go to previous messageGo to next message
Franco Bergomi is currently offline Franco BergomiFriend
Messages: 6
Registered: July 2009
Junior Member
Hi Anthony
Quote:
May I ask you if the ExtendedMetada attached to the package equals to false? If that is the case I would say that this is a problem

Yes, it is tagged "false".
I Tried putting it to "true" but then, i cannot open my .xml files anymore with my generated plug-ins, so I haven't be able to do more testing in this direction.

regard,
Franco

[Updated on: Thu, 25 June 2020 16:24]

Report message to a moderator

Re: Grayed diagram name when reopening aird [message #1829141 is a reply to message #1829135] Thu, 25 June 2020 17:48 Go to previous messageGo to next message
Antonio Garmendia is currently offline Antonio GarmendiaFriend
Messages: 93
Registered: May 2014
Member
Hi Franco,

Thanks for letting me know.

I would say that the problem arises in this sense (qualified = false). If you take a look at the minimal example that I submitted you will see that also in the representations.aird the target reference is serialized as:
<target xmi:type="Family" href="sample.basicfamily#//@family"/>

and when I open the aird file with the reflective editor, in the properties view, the target reference appears empty.

In the basicfamily.ecore, if you change the qualified=true, generate a new model and a modelling project, you will see that the problem disappear. Of course, in this case, the target reference is serialized with a prefix as:

<target xmi:type="basicfamily:Family" href="example.basicfamily#//@family"/>


Kind regards,
Anthony
Re: Grayed diagram name when reopening aird [message #1829273 is a reply to message #1829141] Tue, 30 June 2020 07:44 Go to previous messageGo to next message
Antonio Garmendia is currently offline Antonio GarmendiaFriend
Messages: 93
Registered: May 2014
Member
Hi all,

Any progress on this? I would appreciate an answer.

Thanks!

Kind regards,
Anthony
Re: Grayed diagram name when reopening aird [message #1829711 is a reply to message #1829273] Thu, 09 July 2020 11:34 Go to previous messageGo to next message
Antonio Garmendia is currently offline Antonio GarmendiaFriend
Messages: 93
Registered: May 2014
Member
Hi Franco,

Did you solve this problem? I am still stuck on this. Would you like to join forces?

Thanks!

Kind regards,
Anthony
Re: Grayed diagram name when reopening aird [message #1829727 is a reply to message #1829711] Thu, 09 July 2020 14:29 Go to previous messageGo to next message
Franco Bergomi is currently offline Franco BergomiFriend
Messages: 6
Registered: July 2009
Junior Member
Hi Anthony,
I'm sorry that I wasn't able to answer before. I had to switch to another activity and didn't finish the analysis o this issue.
However I tried what you proposed (thank you), but I was not able to open my ".xml" file anymore as a model since it was violating the need (from EMF) to have prefixes everywhere.
I didn't have time enough to create a sample model with the generated editor in order to see if it would be working on Sirius.

I keep believing that Sirius is doing something strange when loading the resource.
Why ?

#1st test
I have a model "A.dtp5g" that complies with an xsd and that can be read/write with the generated model/edit/editor plugins.
I created a second model "B.dtp5g" that has a reference to A.dtp5g (To do that i intentionally added a EReference in one of the metaclasses, since it is not possible in plain xml).
So in "B.dtp5g" i have a href referencing one element (with XPath syntax like //@blabla1@blibli.2)
When i Open B model, EMF immediately loads the A model, and I can see the reference in the property view, change it, and it is then properly saved & loaded.

#2nd test
If i take the same A.dtp5G and create its representation file (.aird);
I create a View (Diagram for instance), that displays elements from A.
When i save the .aird, and read it textually, I see the same reference that I was seeing in B file (of test #1).

BUT
> If i reopen the aird file the diagram name appears "grayed", and the DRepresentationDescriptorQuery#isDangling method returns true.
> If i open the aird file with the ecore reflexive editor, the reference seems not to be resolved; it remains empty in the property view; I can set a value but it won't be saved.
and a NPE is thrown if trying to validate the model (see my previous message).


As soon as I have time, I'll try
> either to set up an example to reproduce & study this issue..
> or look through your example to extend it in order to reproduce & study the issue

regards,
Franco
Re: Grayed diagram name when reopening aird [message #1829730 is a reply to message #1829727] Thu, 09 July 2020 16:19 Go to previous message
Antonio Garmendia is currently offline Antonio GarmendiaFriend
Messages: 93
Registered: May 2014
Member
Hi Franco,

Thanks for the answer. Let see if I can save you some time, because I think that I found a solution. Indeed, it is related to how Sirius load the resources, because Sirius does not know that we are using ExtendedMetadata right? So, I would say that we should do this explicitly.

I just made a new extension point "org.eclipse.emf.ecore.extension_parser" with the type aird and create a class. This class is the same as AirDResourceFactory. The only addition I made was in the method setOptions:

  // TODO Support the XML Metadata
        ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(new EPackageRegistryImpl(EPackage.Registry.INSTANCE));
		extendedMetaData.putPackage(null, basicfamilyPackage.eINSTANCE);
		loadOptions.put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);
		//TODO


This example works for the basicfamily example.

Hope that helps.

Kind regards,
Anthony
Previous Topic:Representations.aird - programmatically add model to Project Dependencies
Next Topic:Can I drag a element from a view and drop it in DDiagramEditor to create a new EObject ?
Goto Forum:
  


Current Time: Tue Apr 23 17:29:57 GMT 2024

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

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

Back to the top