eclipse RCP - 使 IFolder 在最后一个视图关闭后持续存在
我使用 Java 1.6 创建了一个 IFolder,其中包含一个占位符,用于在 XP 上的 eclipse Helios 上的 RCP 中查看我的视图;
IFolderLayout mainFolder = layout.createFolder("mainfolder,
IPageLayout.LEFT, (float) 100.0, layout.getEditorArea());
mainFolder.addPlaceholder("myview:*");
这按预期工作,有一个灰色区域,该区域在创建时由 myview 和后续视图填充。但是,如果最后一个视图关闭,整个 IFolder 区域就会消失,并且未来的视图将在工作台的错误区域/文件夹中实例化。
我看到一些人早在 06 年就提到了这个问题,但我找不到任何解决方案,而且我不想在最后一个文件夹消失时继续强制重置视角。
http://dev.eclipse.org/newslists/news.eclipse .platform.rcp/msg15873.html http://www.eclipsezone.com/eclipse/forums/t53312.html#91951958
我想我可能必须挂钩关闭视图方法来检查它是否是最后一个视图并重新创建 IFolder。
似乎有一种方法可以防止布局关闭;
layout.getViewLayout("myview").setCloseable (false);
layout.getViewLayout("myview:*").setCloseable (false);
但我似乎无法阻止文件夹崩溃......
I have created an IFolder with a placeholder for my views in RCP on eclipse Helios on XP with Java 1.6 like so;
IFolderLayout mainFolder = layout.createFolder("mainfolder,
IPageLayout.LEFT, (float) 100.0, layout.getEditorArea());
mainFolder.addPlaceholder("myview:*");
And this works as expected with a greyed out area, which is populated by the myview when it is created and with subsequent views. However if the last view is ever closed, the whole IFolder area disappears and future views are instantiated in the wrong area/folder of the workbench.
I see a few people mentioning this problem back in 06, but I can't find any solutions and I don't want to keep force resetting the perspective just when the last folder has gone.
http://dev.eclipse.org/newslists/news.eclipse.platform.rcp/msg15873.html
http://www.eclipsezone.com/eclipse/forums/t53312.html#91951958
I am thinking that I might have to hook the close view method to check to see if it is the last view and re-create the IFolder.
there seems to be a method to prevent the layout from closing;
layout.getViewLayout("myview").setCloseable (false);
layout.getViewLayout("myview:*").setCloseable (false);
but I can't seem to get that to effect the folder from collapsing...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
覆盖 WorkbenchWindowAdvisor 中的 isDurableFolder(...) 方法,使其看起来像这样:
替换 my.perspective 和 >my.mainfolder 包含您的视角和文件夹的 ID。这将为您的文件夹创建一个持久的ViewStack。
仅供参考:默认情况下,
WorkbenchWindowAdvisor#isDurableFolder(...)
返回false
。这会导致PageLayout#createFolder(...)
将 ViewStack 创建为不持久的。方法PageLayout#createPlaceholderFolder(...)
无法设置 ViewStack 持久!Try this:
Overwrite the method isDurableFolder(...) in your WorkbenchWindowAdvisor so that it looks like this:
Replace my.perspective and my.mainfolder with the ID of your Perspective and Folder. This will create a durable ViewStack for your Folder.
FYI: By default the
WorkbenchWindowAdvisor#isDurableFolder(...)
returnsfalse
. This causesPageLayout#createFolder(...)
to create the ViewStack as not durable. The MethodPageLayout#createPlaceholderFolder(...)
is not able to set the ViewStack durable!