[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: To highlight an element on editor

Hi,

good that it worked for you. This is an additional information:

If you want to select things programmatically you should not use the XXXEditPart.setSelected(int type) method. There is a "correct" way of doing that.

You should get the viewer of your diagram (ParentEditPart.getViewer()) and use those methods:

setSelection(), setSelected(), appendSelection()

those use EditPart Objects as atributes and that way the viewer handles everything else for you if your edit Policies work correctly.

To get the name of your atribute you need to access the implementation. you can get that by calling:

getModel().getElement() on your edit parts. you may need to cast the return valies. In the XXXEditPartImpl there should be getName() method that returns you the name of the EditPart


I don't really know what you mean by "finding the addFeedBack() method". I think you want to set them highlighted. The appendSelection() on your viewer might also solve this problem for you. If not maybe you can describe that a little bit more and I will try explaining it if I can.


Best,
Artur
TSchwalb wrote:

Hi Artur,
thanks for your fast reply. That worked quite well. I was able to get all elements and also was able to call the setSelected() on them - so all got highlighted using the published functions.

Now I was trying to highlight them without getting them selected at the same time. The Problem is now that I cannot find or call the addFeeback() method. All other methods or Listeners seem to be no Problem. May you can help.

Also I was trying to highlight only specific elements of XXXEditPart, depending on their name. The name (type String) is a label in the element (node) which is refering to an attribute of the class of the element. Do you know how I can access this name?

Thank you in advance!

Tobias