Eclipse 菜单中的显示视图 Window->显示视图

发布于 2024-08-10 10:59:02 字数 255 浏览 2 评论 0原文

“我创建了一个 Eclipse 插件,它在 Eclipse 中创建一个视图。目前它在 Eclipse 菜单中显示为: '窗口->显示视图->其他'。

我想在“窗口 ->”中显示它显示视图”而不是在子菜单“其他”下。

我已经尝试将plugin.xml 文件中视图的“类别”指定为“org.eclipse.ui”,但它仍然在“其他”子菜单中显示视图。

还有其他方法吗?任何建议在这方面都有帮助。

提前致谢, 阿比纳夫”

"I have created an Eclipse plugin which creates a view in Eclipse. Currently it is displayed in the Eclipse menu as :
'Window->Show View->Others'.

I want to show it in 'Window -> Show View' and not under the submenu 'Others'.

I have tried it giving the 'Category' of the view in the plugin.xml file as 'org.eclipse.ui' but it is still showing the view in 'Others' submenu.

Is there any other way to do so? Any suggestions are helpful in this regard.

Thanks in advance,
Abhinav"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

嗼ふ静 2024-08-17 10:59:02

我认为你可以通过定制的视角来做到这一点。

在您的plugin.xml 中,添加“org.eclipse.ui.perspectives”的扩展点,并创建一个实现IPerspectiveFactory 的新类。

这个类有一个方法“createInitialLayout(IPageLayout布局)”,在该布局上您可以调用“layout.addShowViewShortcut(<您的视图的ID>)”

您还可以在那里添加向导等的快捷方式。

希望有帮助,
安德烈亚斯

I think you can do that with a customized perspective.

In your plugin.xml, add an extension point for "org.eclipse.ui.perspectives", and create a new class implementing IPerspectiveFactory.

This class has a method "createInitialLayout( IPageLayout layout )", and on that layout you can call "layout.addShowViewShortcut( < ID of your view > )"

You can also add shortcuts for wizards etc. there.

Hope that helps,
Andreas

生生漫 2024-08-17 10:59:02

您还可以阅读关于 eclipse 的“透视文章”:

在下面的示例中,您可以看到 createInitialLayout 是如何在 TestPerspective 类中实现的。为了清楚起见,该算法已分为定义操作和布局的两部分:defineActionsdefineLayout

public void createInitialLayout(IPageLayout layout) {
    defineActions(layout);
    defineLayout(layout);
}

defineActions中,许多项目和操作集被添加到窗口中。透视图可以将项目添加到 File > 中。新建显示视图透视图>打开窗口的菜单。
您还可以将完整的操作集添加到窗口的菜单或工具栏。在此示例中,有几个 File >添加了新的显示视图 项目。

public void defineActions(IPageLayout layout) {

    // Add "show views".
    layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
    ...
}

You can also read the "Perspective Article" on eclipse:

In the example below you can see how createInitialLayout is implemented in the TestPerspective class. For clarity the algorithm has been split into two parts which define the actions and layout: defineActions and defineLayout.

public void createInitialLayout(IPageLayout layout) {
    defineActions(layout);
    defineLayout(layout);
}

In defineActions a number of items and action sets are added to the window. A perspective may add items to the File > New, Show View, or Perspective > Open menus of the window.
You can also add complete action sets to the menu or toolbar of the window. In this example a few File > New and Show View items are added.

public void defineActions(IPageLayout layout) {

    // Add "show views".
    layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
    ...
}
ゝ偶尔ゞ 2024-08-17 10:59:02

当此类快捷方式应添加到现有透视图时,提供视图、新文件向导或透视图的插件可以声明 org.eclipse.ui.perspectiveExtensions 的扩展名。透视图,例如 org.eclipse.jdt.ui.JavaPerspective、org.eclipse.emf.ecoretools.perspective 或 org.eclipse.ui.resourcePerspective code> 可以扩展以提供新向导、视图、透视快捷方式等。

When shortcuts of such kind shall be added to an existing perspective, the plugin providing views, new file wizards, or perspectives may declare an extension to org.eclipse.ui.perspectiveExtensions. Perspectives such as org.eclipse.jdt.ui.JavaPerspective, org.eclipse.emf.ecoretools.perspective, or org.eclipse.ui.resourcePerspective can be extended to provide new-wizard, view, perspective shortcuts and more.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文