View References in the referring and the referred Concept - Best Practice?

Hi folks,

just looking for some hints how such a requirement could be implemented in a neat way with the MPS editor. Let me explain the situation first:

I have a concept "Site" which consists of Multiple "Pages". However, the Pages could be used in different Sites, thus Pages is a root concept and Site has  a reference to Page, cardinality [1..n]. The editor is straight forward. The Site editor contains a Reference-Node-List to pages

(-%pages% /empty cell <constant>-)

 

Now, on could also open a Page and use "find usage" to see, in which Sites the Page is used. But that is exactly the information, i want to visualize in the Page itself.

One way might be to use a *R/O model access*, calculate the name of the Sites which link to the Page and display their Names. Drawback is, that one can not "click" on the text to get to the Site (i.e. follow a "link" to the Site in order to enhance Navigation.)

I do not want to edit those references in the Page Concept itself - it should just be readable. Nevertheless, i want to have that readable information navigate-able somehow.

 

Is there any known solution to this "navigation" issue? I also thought about using a custom cell provider and insert a reference editor manually - but that might not be the most clever solution.. 

Any suggestions appreciated.. 

Daniel

 

 

5 comments
Comment actions Permalink

Have you tried adding read-only:true / editable : false style attributes?

See here: https://mps-support.jetbrains.com/hc/en-us/community/posts/207213815/comments/207541689

 

You might try Querylist (com.mbeddr.mpsutil.editor.querylist) as well (http://mbeddr.com/platform.html)

0
Comment actions Permalink

Hi Vladimir,

well - Page does not contain a reference to Site... only Site contains one to Page. Therefore, i can not use the standard reference editor in Page : )

Daniel 

0
Comment actions Permalink

Does Querylist help then?

0
Comment actions Permalink

That is a MPS concept? Never heard of that... 

 

 

0
Comment actions Permalink

One solution, motivated by 

https://mps-support.jetbrains.com/hc/en-us/community/posts/205828989-Show-a-list-of-nodes-in-a-read-only-style-in-an-editor

might be:

Add a $Custom Cell$ in Page and provide the following AbstractCellProvider for the Custom Cell:

 

newAbstractCellProvider(){ 
publicEditorCellcreateEditorCell(EditorContextp0){
EditorCell_CollectionenclosingCell = EditorCell_Collection.createIndent2(p0,node);
node.getSuits().forEach({~it=>
node<SuitLink>pal=newnode<SuitLink>();
pal.suit=it;
enclosingCell.addEditorCell(p0.createNodeCell(pal));});

returnenclosingCell;
}
};

 

Whereby the SuitLink is simply a Concept with a Reference to Suit, cardinality [1].

Just tried that - does it s job.. Nevertheless, is that really the most clever way of handling this situation?

 

 

0

Please sign in to leave a comment.