Java 类org.eclipse.draw2d.AncestorListener 实例源码

项目:statecharts    文件:XtextDirectEditManager.java   
protected void hookListeners() {
    super.hookListeners();

    // TODO: This gets around the problem of the cell editor not growing big
    // enough when in autosize mode because it doesn't listen to textflow
    // size changes. The superclass should be modified to not assume we want
    // to listen to the editpart's figure.
    ILabelDelegate label = (ILabelDelegate) getEditPart().getAdapter(ILabelDelegate.class);
    if (label != null && getEditPart().getFigure() instanceof WrappingLabel) {

        textFigureListener = new AncestorListener.Stub() {

            public void ancestorMoved(IFigure ancestor) {
                getLocator().relocate(getCellEditor());
            }
        };
        ((IFigure) ((WrappingLabel) getEditPart().getFigure()).getTextFigure().getChildren().get(0))
                .addAncestorListener(textFigureListener);
    }
}