Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Decorate ModelExplorer-Element in Diagram
Decorate ModelExplorer-Element in Diagram [message #1796394] Fri, 12 October 2018 10:14 Go to next message
Fudo Miwa is currently offline Fudo MiwaFriend
Messages: 1
Registered: October 2018
Junior Member
Hello^^,

i am beginner in Eclipse and Papyrus developement, i would really appreciate if someone can point me in the right direction.

What I want to do is browse the ModelExplorer for specific elements and then decorate their corresponding diagram part.
For example I want to decorate the BDD-Element of a Block with name "Block_System". Below is my current code and "Decorate corresponding Element in BDD" marks the spot where I am stuck.


IViewDescriptor modelExplorerViewDesc = PlatformUI.getWorkbench().getViewRegistry().find("org.eclipse.papyrus.views.modelexplorer.modelexplorer");
IViewPart modelExplorerViewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(modelExplorerViewDesc.getId());
ModelExplorerPageBookView modelExplorerPageBookView = (ModelExplorerPageBookView) modelExplorerViewPart;
		
ServicesRegistry registry = (ServicesRegistry) modelExplorerPageBookView.getAdapter(ServicesRegistry.class);
		
ModelSet papyrusModelSet = registry.getService(ModelSet.class);

UmlModel umlModel = (UmlModel) papyrusModelSet.getModel(UmlModel.MODEL_ID);
 
EObject modelRoot = umlModel.lookupRoot();
	
Resource umlResource = modelRoot.eResource();
for (EObject currentObject : umlResource.getContents()) {

	if (currentObject instanceof Block) {
		Block block = (Block) currentObject;
		
		if (block.getBase_Class().getName().equals("BLOCK_System")) {
			//Decorate corresponding Element in BDD
		}
	}
}


Best regards,
Fudo
Re: Decorate ModelExplorer-Element in Diagram [message #1799680 is a reply to message #1796394] Wed, 12 December 2018 10:23 Go to previous message
Nicolas FAUVERGUE is currently offline Nicolas FAUVERGUEFriend
Messages: 47
Registered: February 2014
Member
Hi,

You can use the Papyrus 'DecorationService' class, and more specifically the 'addDecoration' method to decorate an UML element in the model explorer and/or in the graphical editor.

(Sorry for the late answer)

HTH,
Nicolas
Previous Topic:oxygen extend paletteDefinition
Next Topic:Display additional meta properties on association end.
Goto Forum:
  


Current Time: Thu Mar 28 11:49:09 GMT 2024

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

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

Back to the top