我创建了一个插件,用于查询所选项目名称&路径并在启动时将其显示在视图中。这里是我的我是多么查询所选项目代码:eclipse插件:在选定的项目发生变化时获取通知
IStructuredSelection selection = (IStructuredSelection) window.getSelectionService().getSelection();
Object firstElement = selection.getFirstElement();
if (firstElement != null) {
if (firstElement instanceof IAdaptable) {
IProject project = (IProject) ((IAdaptable) firstElement).getAdapter(IProject.class);
IPath path = project.getFullPath();
IPath location = project.getLocation();
}
}
如果项目被改变(用户选择的任何其他项目),或者如果所选择的项目被关闭,我怎么能拿的通知?