Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » change visulization when selecting Object in diagram
change visulization when selecting Object in diagram [message #894440] Mon, 09 July 2012 09:11 Go to next message
Jason Lin is currently offline Jason LinFriend
Messages: 12
Registered: July 2012
Junior Member
My requirement:
(1) Model: A main EObject(Procedure) which is related with other EObjects (three Tables);
(2) Assume there is an main EObject(Procedure) in the digram.
(3) When I select this main EOjbect, the related objects display.
When I change selection to others, then only display the main EObject.

Code snippet of AddProcedureFeature:
                        Table dataTable = procedure.getDataTable();
			Table argTable = procedure.getArgTable();
			Table resultTable = procedure.getResultTable();
			AddContext addTableContext = new AddContext(new AreaContext(),dataTable);
			//Trigger the Graphiti framework to find a feature that is capable of adding a table instead of adding it by ourselves
			PictogramElement dataTableArea = addGraphicalRepresentation(addTableContext, dataTable);
			//gaService.setLocationAndSize(dataTableArea, 0, 0, 60, 60);
			PictogramElement argTableArea = addGraphicalRepresentation(addTableContext, argTable);
			PictogramElement resultTableArea = addGraphicalRepresentation(addTableContext,resultTable);
			//Set location in the container
			gaService.setLocationAndSize(dataTableArea.getGraphicsAlgorithm(), 20, 20, 60, 60);
			gaService.setLocationAndSize(argTableArea.getGraphicsAlgorithm(), 20, 200, 60, 60);

I first want to extend AbstractCustomFeature to meet my requirement. When select the Function, the method canExcute(ICustomContext context) will be invoked but IMO just because of components creatation such as contextButtonPad.

My Problem is that: Even if I can change the visualization when select, I can't change it back when selection changes to others.
Thus, I think my solution direction is incorrect.

Could anybody tell me which point should I begin?

Thanks in advance.


[Updated on: Mon, 09 July 2012 09:53]

Report message to a moderator

Re: change visulization when Object diagram [message #894936 is a reply to message #894440] Wed, 11 July 2012 07:45 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1894
Registered: July 2009
Location: Walldorf, Germany
Senior Member

there's a hook method in the tool behavior provider that allows to change
the appearance of a shape when it is selected (getSelectionInfoForShape),
but it will only allow to modify the shape itself.

You might try to add your additional shapes there and trigger an editor
refresh. But that's kind of off-specification for that method and I'm not
sure if it will work.

Previous Topic:First Editor
Next Topic:Custom editor and toolbar items
Goto Forum:

Current Time: Sat Jun 23 02:57:18 GMT 2018

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

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

Back to the top