我想在 ViewPart 被隐藏(隐藏 == 它开始不可见)并且它被打开(打开 == 它开始可见)时触发方法。像这样的东西:
void onHide(){removeAllListeners();}
void onShow(){refreshView();}
我尝试使用:
getSite().getPage().addSelectionListener(new ISelectionListener() {
@Override
public void selectionChanged(final IWorkbenchPart workbenchPart, final ISelection selection) {
System.out.println("TEST");
}});
但只有当ViewPart不可见时才起作用,可见时不会触发
最佳答案
这与更改选择无关。使用IPartListener2
.
关于java - ViewPart 中的 onShow 和 onHide 监听器 - Java Eclipse RCP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35709148/