Model explorer gives a tree representation of the element model .
To be clear about the use of vocabulary, we suppose that :
We will explain the following cases:
installation required:
for example in case of eclipse 2020-06 we choose : http://download.eclipse.org/modeling/mdt/papyrus/updates/releases/2020-06 .
First create a plug-in that will contain the configuration of your model explorer.
Choose as Customization root.
In this part we need to reference our emf Facet model on the plug-in .xml .
Choose the created file ".custom" .
Our profile representation :
« stereotypeB » references « stereotypeC ».
In the explorer model we represent the « stereotypeC » classes as children of « stereotypeB ».
We have to customize the « stereotypeB » representation to be able to display new children .
As we extend the metaClass , we choose Class.
You have to chose Extended Facet and select « CustomizedEobject » Then we name it «CustomizationOfStereotypeB » .
We are going to restrict the modification only to the classes to which we apply the stereotypeB.
Create an EMF Facet operation named « isAstereotypeB ».
Validation with « OK ».
The Request does not exist ,so we create a Java class.
Validation with « OK ».
Result :
Then, you have to write this code :
The generated class contains the signature of the operation. You just have to fill in it.
Fill in the field « Conformance Typed Element » with our EMF facet operation.
Now we will specify the display of « C classes » as Child. In order to do this, we will add a reference facet.
A dialog box pop up:
Fill in :
Put type as a UML class choose « UML metaModel » then the « Class metaclasse ».
Choose a Java request by following the wizardVous.
As a result ,You must obtain:
Also,we have to write the Java request
We have to choose the customization we have created.
Click on « Customize Model Explorer ».
Select « simpleexample ».
Put it on the « Loaded Customizations » list.
Now we can see that « stereotypeC » child of « stereotypeB ».
Now we want no longer to see « stereotypeC » under packages, Hence filtering.
In this framework, it’s impossible to filter directly, so the solution is to create a new « Ereference » and to hide the reference that displays the elements.
With Papyrus we display all the composite relationships.
To display the Roles click on « toggle advanced » in model explorer. The role displaying the classes is « packagedElement ».
To hide the display of the « packagedElements » role,we have to create an « EClass Customization » on Package (see the section « creating an "EClassCustomization" »)
Here the "conformance Typed Element" field will not be filled, because we are customizing all the package representations.
We will create an operation « hide packageableElement ».
In the class below we don't display « PackagedElement ».
We select the EMF Facet operation.
Put « visibleReferences » to the « Override » field.
In application, this configuration must be priority over SimpleUML ,so we must put it before:
result --> no longer classes
Now we have to add a « Reference » where we only see the « stereotypeA » and « sterotypeB ».
We want to see « stereotypeA » and « StereotypeB » as children of the package, For this we create a "FacetReference".
As we return a list:
The code must be written is as follows:
Once change applied we have the wanted result: