我怎么知道View移动了?

时间:2010-11-10 06:56:42

标签: swt rcp jface workbench

有没有像听众一样知道视图被移动了?

1 个答案:

答案 0 :(得分:3)

如果您尝试使用该视图

public void createPartControl(Composite parent){
    parent.getParent().addControlListener(new ControlAdapter(){
        public void controlMoved(ControlEvent e) {}
    });
}

如果是内置视图

WorkbenchPartReference ref = (WorkbenchPartReference) UIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().findViewReference("viewID");
    Control control = ref.getPane().getControl();
    control.addControlListener(new ControlAdapter(){
        @Override
        public void controlMoved(ControlEvent e) {

        }
    });