GraphicalEditPart editPart,
IUIObjectInfo object) {
m_editPart = editPart;
m_object = object;
// add/remove device figure
final EditPart rootEditPart = viewer.getRootEditPart();
final IEditPartListener listener = new IEditPartListener() {
public void childAdded(EditPart child, int index) {
Layer deviceLayer = child.getViewer().getLayer(IEditPartViewer.PRIMARY_LAYER_SUB_1);
deviceLayer.add(m_deviceFigure);
// refresh now, when EditPart is added
refresh();
}
public void removingChild(EditPart child, int index) {
FigureUtils.removeFigure(m_deviceFigure);
rootEditPart.removeEditPartListener(this);
}
};
rootEditPart.addEditPartListener(listener);
// update EditPart figure and selection policy
object.addBroadcastListener(new ObjectEventListener() {
@Override
public void refreshed2() throws Exception {
refresh();