Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mdt-papyrus.dev] View and Digram compatibility

Hi,

 

I want to detect if a view is allowed in a certain Diagram so I don’t get a red “invalid View” node.

 

I have detached elements :

-          the view with its semantic element

-          the view without diagram container

-          the semantic element without container

And of course the targeted Diagram

 

I tried :

IGraphicalEditPart createGraphicEditPart = EditPartService.getInstance().createGraphicEditPart(view);

EditPart createEditPart = EditPartService.getInstance().createEditPart(targetEditPart, view);              

Node createNode = ViewService.getInstance().createNode(targetDiagram, view.getElement(), "", null);

 

I also didn’t find any generic access to *IdRegistry

There is a promising class : org.eclipse.papyrus.infra.gmfdiag.common.providers.IGraphicalTypeRegistry with public boolean isKnownNodeType(String type);

But it seems to be used only in sysml diagrams.

 

When Gmf  is looking for providers :

org.eclipse.gmf.runtime.common.core.service. Service. safeProvides(…)

org.eclipse.gmf.tooling.runtime.providers.DefaultEditPartProvider.provides(…)

L 102 if (!expectedModelId.equals(diagramStructure.getModelID(view))) {

ð  checks here that the view has the correct diagram for the provider

 

One solution is to take the semantic element drop it to the targetDiagram, check the result and undo the drop.

But I want to (if possible) make this test without the model becoming dirty.

 

Any ideas?

 

Regards,

Benoit Maggi


Back to the top