Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Change Message font to bold (using EdgeImpl)
Change Message font to bold (using EdgeImpl) [message #1466836] Sun, 09 November 2014 15:08 Go to next message
Vinicius Pereira is currently offline Vinicius PereiraFriend
Messages: 50
Registered: March 2014
Member
Hi everyone,

I have access to the CSSEdgeImpl of a Message (Sequence Diagram), but I cannot change the Edge color (like Connector or Shape, which I can).

Because of this Edge color "problem", I want to get the "name" of the message and put it in bold.

How can I access the "bold" attribute and change it?

index.php/fa/19816/0/


And this is the code showing how I access the CSSEdge/Connector/ShapeImpl:
IEditorPart editorPart = window.getActivePage().getActiveEditor();
		
		if (editorPart instanceof PapyrusMultiDiagramEditor) {
			PapyrusMultiDiagramEditor papyrusEditor = (PapyrusMultiDiagramEditor) editorPart;
			
			// Get the services registry from the editor
			ServicesRegistry papyrusEditorRegistry = (ServicesRegistry) papyrusEditor.getAdapter(ServicesRegistry.class);
			
			// variable with the element found in Papyrus' Editor
			EObject elementFound = UMLElement.findUmlElementInPapyrus(papyrusEditorRegistry, umlElementID);
			
			try {
				// Get access to the editor
				IMultiDiagramEditor editor = papyrusEditor;
				ServicesRegistry editorRegistry = editor.getServicesRegistry();
				
				// Show the UML element in editor
				OpenElementService openElement = editorRegistry.getService(OpenElementService.class);
				openElement.openSemanticElement(elementFound);
				
			} catch (ServiceException | PartInitException e) {
				e.printStackTrace();
			}
			
                       // code to change color...
		}
Re: Change Message font to bold (using EdgeImpl) [message #1470616 is a reply to message #1466836] Wed, 12 November 2014 13:33 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 926
Registered: February 2011
Senior Member
Hi Vinicius,

We should really use "Connectors" everywhere, instead of "Edges". That's probably something to fix in a consistent way for the next version of Papyrus.

Edges can be customized by adding a new child style (e.g. myEdge.getStyles().add(NotationFactory.eINSTANCE.createLineStyle()), but I'm not sure the diagram will properly use them (They may). If they don't, this also needs to be fixed.

We're currently (for Papyrus 1.1) in the process of unifying diagram implementations. One of the goals is to allow a proper and consistent customizability of all diagram elements, so this kind of thing is definitely in the scope

The LineStyle can be used to set the LineColor and LineWidth, whereas the FontStyle can be used for Font Color, Bold, and some other properties.

Regards,
Camille


Camille Letavernier
Re: Change Message font to bold (using EdgeImpl) [message #1470942 is a reply to message #1470616] Wed, 12 November 2014 19:06 Go to previous message
Vinicius Pereira is currently offline Vinicius PereiraFriend
Messages: 50
Registered: March 2014
Member
Hi Camille,

thanks for reply me.
Previous Topic:OCL Inheritance
Next Topic:[Reopened] Import package from user model fails
Goto Forum:
  


Current Time: Sat Jul 11 09:18:14 GMT 2020

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

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

Back to the top