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 05:11 Go to next message
Jason Lin is currently offline Jason Lin
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);
			addTableContext.setTargetContainer(containerShape);
			
		
			//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.

Jason

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

Report message to a moderator

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

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.

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


Current Time: Wed Jul 23 04:03:42 EDT 2014

Powered by FUDForum. Page generated in 0.13162 seconds