I am currently building an editor with Eclipse GEF. It is possible to add new parts via the editor and rename them.
However I have a little problem with the moving of the elements. When dragging them with the mouse they are not moved when I release the mouse and the element doesn’t collide with another one.
The positions of the elements are stored in an EMap (the model is made with EMF). Changes in the view are saved with the put method of the map.
While going through it with the debugger I noticed that the command is executed, but the view is not refreshed yet.
I added an adapter to the model, but its notifyChanged is not called from the system.
public class ViewAdapter implements Adapter {
@Override
public void notifyChanged(Notification notification) {
refreshVisuals();
}
}
The ViewAdapter is registered in the activate method of the EditPart.
What could it be?
As you are working with a map the normal
Adapterinterface won’t work, because it only listens to adds or removals of map entries.If you want to listen on changes of map elements, you should use an
EContentAdapterinstead:It is important that you call the super method so the notifications of the map entries are forwared to the map itself.