Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij: Adding 'Interface' to my context menu in the Project Pane

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.

like image 965
digiarnie Avatar asked Aug 02 '10 05:08

digiarnie


People also ask

How do I create an interface in IntelliJ?

On the main menu or from the context menu of the selection, choose Refactor | Extract | Interface. The Extract Interface dialog appears. To extract a new interface, select the Extract Interface option and specify the name for the new interface.

How do I change project structure view in IntelliJ?

To change settings of a module that hosts the file you are currently editing, just press Alt+F1, 7 or open the View menu, select Select In and click Project Structure. IntelliJ IDEA will open the Project Structure dialog and jump to the required module.

How do I get project view in IntelliJ?

To open the tool window again (and restore the associated features), use the main menu: View | Tool Windows | <Window Name> or press Alt+1 . Hide the tool window. This command opens the description of the Project tool window in the IntelliJ IDEA online help.

Where is Project Explorer in IntelliJ?

In IntelliJ IDEA, the Project tool window is usually located on the left. You can open it by pressing ⌘+1 on macOS or Alt+1 on Windows and Linux, or by selecting View | Tool Windows | Project from the main menu.


2 Answers

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.

like image 95
CrazyCoder Avatar answered Sep 20 '22 10:09

CrazyCoder


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

like image 21
Mehraj Malik Avatar answered Sep 21 '22 10:09

Mehraj Malik