Intellij:添加“接口”到项目窗格中的上下文菜单

发布于 2024-09-12 22:50:07 字数 587 浏览 5 评论 0原文

目前在 IntelliJ 中,如果我右键单击“项目”窗格中的包,我可以看到以下内容:

new > Java class
new > File
new > Package

我想在“新”上下文菜单中添加一些新菜单项,例如 Interface 和 Enum。有谁知道该怎么做?

我一直在设置>中进行操作菜单和工具栏没有任何运气。

编辑:有趣的是,如果我右键单击一个包并选择新建> >编辑文件模板...,我可以看到界面的模板,在描述中它实际上说:

This is a built-in template used by IDEA each time you create a new Java interface, by selecting New | Interface from the popup menu in one of the project views.

除非我需要查看 Project 之外的其他窗格,否则我可以'似乎找不到任何上下文菜单可以让我选择 New >接口如上述描述所建议。

Currently in IntelliJ, if I right-click a package in the Project pane, I can see things such as:

new > Java class
new > File
new > Package

I want to add some new menu items in the 'new' context menu such as Interface and Enum. Does anyone know how to do this?

I've been playing around in the Settings > Menus and Toolbars without any luck.

Edit: The funny thing is if I right click a package and choose New > Edit File Templates..., I can see the template for an Interface and in the description it actually says:

This is a built-in template used by IDEA each time you create a new Java interface, by selecting New | Interface from the popup menu in one of the project views.

Unless I need to look at a different pane other than Project, I can't seem to find any context menu that lets me choose New > Interface as suggested by the above description.

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

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

发布评论

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

评论(6

蹲墙角沉默 2024-09-19 22:50:07

新 | Java 类,出现创建新类对话框,在此对话框中您可以选择以下选项之一种类

  • 接口
  • 枚举
  • 注释

(使用 IDEA 9.0.3 测试)

如果您想要界面直接在新建列表中,那么您必须在设置 | 中添加新模板文件模板,将其命名为 Java Interface 之类的名称,并将 Interface 模板的内容复制到此模板中。

New | Java Class, Create New Class dialog appears, in this dialog you can choose Kind between one of the following:

  • Class
  • Interface
  • Enum
  • Annotation

(tested with IDEA 9.0.3)

If you want Interface directly in the New list, then you have to add new template in Settings | File Templates, name it something like Java Interface and copy the contents of the Interface template into this one.

佞臣 2024-09-19 22:50:07

您还可以创建快捷方式以节省一些时间。

Alt+Ctr+S -> 键盘映射 ->在搜索框中输入“创建新的”并选择Java 类,然后指定任何快捷键,例如Ctrl+N

输入图片此处描述

Also you can create a shortcut to save some secs.

Alt+Ctr+S -> Keymap -> in search box type 'create new' and select Java class and then assign any shortcut like Ctrl+N.

enter image description here

莫相离 2024-09-19 22:50:07

它位于“新建 Java 类”菜单下。

It's under the New Java Class menu.

荒岛晴空 2024-09-19 22:50:07

是的,它在班级菜单中可用:新建--> Java类-->界面 。

Yes its available in Class menu : New--> Java class --> Interface .

噩梦成真你也成魔 2024-09-19 22:50:07

创建一个包,然后从该选择界面中选择创建新类并给出名称。
在此处输入图片描述

;您需要导入参考文件。

create a package and then select create new class from that select interface and give a name.
enter image description here

then; you need to import the references files.

有木有妳兜一样 2024-09-19 22:50:07

它位于 New Java Class 菜单下。new->java Class-{此处从下拉列表中选择 Interface 选项。

It's under the New Java Class menu.new->java Class-{here select Interface option from dropdown.

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