|Adding a custom property in the properties view [message #625755]
||Wed, 22 September 2010 10:19
| Cedric Moonen
Registered: August 2009
I am currently designing a graphical editor with GMF. In this editor, the user is able to drop blocks on the diagram. Such a block has several input and output ports. The user can then link an output port to an input port using a connector. The final purpose of the editor is to be able to generate code based on this diagram (this is very similar as what is done in simulink). However, the order of the blocks is important, so I would like the user to be able to change the order of the blocks (which are contained in an ordered list) through the properties view. I already posted this question in the GMF forum (here: http://www.eclipse.org/forums/index.php?t=msg&goto=62530 9&S=9cd0d69d2c850db81e2678095c6bf32c#msg_625309) but this is maybe more related to the EMF editor.
Basically, one solution I am thinking about would be to add a property in the properties view of the block that allows to change the index of the block in the list. Getting and setting this custom property would work this way: getting the property simply returns the index of the block in the list and setting the property simply inserts the block at the specific location in the list.
I guess this would be a valid solution, no ? However, I am a bit stuck at how I need to implement it. In the BlockItemProvider, there's a method getPropertyDescriptors which I guess I need to modify in order to add my custom property. However, I have no clue how to create this custom property. Any idea how I might do this ?
Powered by FUDForum
. Page generated in 0.01722 seconds