Feature request: New Java Class - select base class / interfaces

It would be very handy if the New Java Class asked for more than just a class name. I would like to see it ask for the base class and interfaces automattically creating the required constructors and stub implementing any interface methods.

Comment actions Permalink

This is one of the few things I really missed from Eclipse. Definitelly its wizard is more, more powerful that the simple idea popup.

Comment actions Permalink

I love the Idea because the dev team is very customer oriented and puts focus on performance and usability.
Related to usability they tend to measure it (and I congratulate them for that), besides other criteria, through the number of keystrokes to get a job done, and do their best to minimize this.

So, let's take the example of creating a simple class with:
[0] open wizard/dialog
[1] class name: MyClazz
[2] final
[3] Create constructor from superclass
[4] generated javadoc templates
[5] containing main method
[6] finish

So let's count the keystrokes in my favorite IDEs:
[0] CTRL+SHIFT+N, C  (2)
[1] Type class name   (7)
[2] Alt+L  (1)
[3] Alt+C (1)
[5] Alt+V (1)
[6]  (1)

Total=13 (and there is no delay with auto-complete/suggestions)

[0] Alt+INSERT, ENTER  (2)
[1] Type class name   (7)
[6] Press OK (1)
Escape to activate editor (1)
[2] type f + DOWNARROW + ENTER (3)
Shift+ENTER (insert line under current line)  (1)
[5] Type p s v m tab  (5)
press DOWN ARROW twice (2)
[3] Alt+Insert + ENTER (2)
CTRL+ALT+ENTER (insert a line before current one)  (1)
[4.1] press / * (twice) + ENTER (4)
Alt+UP ARROW (GO TO above constructor) (1)
CTRL+ALT+ENTER (insert a line before current one)  (1)
[4.2] press / * (twice) + ENTER (4)

Total=38 (+ some delays with autocomplete)

So in my opinion (I strive to use only shortcuts)
- Eclipse wins in terms of # of keystrokes
- An enhanced new class dialog (wizard) in Idea will be more familiar to those switching from Eclipse to Idea
- One shot for whole bunch of options for class generation through Wizard/Dialog
- Eclipse wizard is even more powerful in terms of:
 - chose a different package (browsing), with the possibility of creating a new one
 - choose a different src folder (browsing)
 - selecting a superclass
 - selecting a couple of interfaces
 - much better visual clues in terms of suggestions/errors/warnings
 - enclosing type
- using default both in Idea and Eclipse means the same # of keustrokes except when chosing another java type (Interface, enum ...) where Eclipse wins again (-2 keystroke) in Idea dialog the user need to press Tab to activate Kind combo and then type the 1st char of the type name.  

I must admit that I favor IDEA over Eclipse because of its productivity, performance, frameworks support, editor support, customer support and more, but there are areas in which Eclipse wins and this is one of them - new java type generation. The other - IMO - are: missing a shortcut to create the java doc, poor support in debug related to breakpoint expression, IDE layout (IMHO Eclipse definitelly wins in this area).

I really don't want to start a IDE war. It is my humble opinion as a java developer who is working both with Eclipse (~ 8 years) and IDEA (I switch from Eclipse to ~1 year ago), and I tend to use the right IDE to get the job done.   

See also the attached screenshots.


Comment actions Permalink

Thanks for writing that up. That is exactly why having it be a wizard instead of doing it all through code works so well. You select a few items as you create the class and the code is witten for you. I realize you can get to the same result in the editor of IntelliJ but it takes so much longer to do and requires so much more typing that I just get annoyed every time I have to do it instead of enjoying the product like I should.

I switch back and forth between Eclipse and IntelliJ every few weeks depending on the project I am working on. I also use Xcode, Visual Studio and AppCode so once you find a feature in an IDE that you really like you want all of them to have it.

Comment actions Permalink

You are right Kevin

- Feature-rich wizards don't make a feature-reach editor based IDE (like IDEA surely is) less powerful, on the contrary.
- The developers who are intending to switch to IDEA definitelly  will appreciate powerful wizards
- The Wizards are first things new IDE adopters are interacting with, so they will problably switch back to the other IDE's if they found them no so feature rich
- A new IntelliJ adopter is not so acustomed with new shortcuts (I know they can configure a key shortcuts schema to Eclipse) and live templates and the editor as a whole, and he has to get his job done as soon as possible, and IMHO this is one of the features (wizards) that force the new adopters to switch back
- I think, looking at the new class dialog it doesn't provide support for extensions but I am probably wrong. Lets suppose an Idea plugins developer want to contribute - create unit tests, create main method and java doc - to the new type dialog. Is this possible with the current new type dialog?
- Even What's new (http://www.jetbrains.com/idea/whatsnew/index.html) and features  & screenshots (http://www.jetbrains.com/idea/features/code_generation.html) idea sites will look more appealing, and this means marketing :))).


Comment actions Permalink

Thank you for the tip.
Now I understand what those arrows next to Name textfield stands for, to provide info about how to choose another type.
IMO this is another case Idea developers break the consistency. Where should a develepor look to get further useful information, hovering a input text, a label, or... who knows? In this particular case I wonder why this additional label providing info about functionality of the other widget. I see a couple of methods idea providing such of useful info/functionality in order to increase the productivity, but they tend to forget about the consistency and UI guidelines. See the discussion in youtrack about the strange behaviour of the commit button in VCS commit dialog, or the inconsitency of the Refresh shortcuts in some contexts.
So, why doesn't Idea  provide consistenty sometimes?
Back to Eclipse:
1. they provide light bulb associated with widget LEFT-TOP (checkbox, textfield, table cells you name it) - always the same.
2. as for dialogs, wizard it is also consistent through a help icon and help panel attached to dialog/wizard - always the same.
3. common functionalities (refresh, expand, collapse, next... ) looks and behaves the same no matter where they are and what they operate upon. I never seen the Refresh button in eclipse having another icon and/or shortcut.
4. plugins developed by Eclipse community comply with these consistency rules. Moreover, there is a Eclipse wiki regarding UI guidelines (http://www.eclipse.org/articles/Article-UI-Guidelines/Contents.html).
Please don't get me wrong. I really appreciate the Idea Dev Team effort/work to make a best-of-breed IDE, but sometimes they forget about the consistency.

Also this feature request about a more powerful new type support is mostly required in order to address the issue new IDEA IntelliJ developers come across with (I went through this and I know what I am talking about :)))).

Best regards

Comment actions Permalink

Moreover Kevin, if you file a new feature request in youtrack I will definitelly  vote it.


Comment actions Permalink

Idea dialog the user need to press Tab to activate Kind combo and then type the 1st char of the type name.  

Actually, you can use arrow down/up to select class-type while focus is in classname field.

Comment actions Permalink

Thanks for your feedback. Oh, and there's a tooltip on those arrow symbols ;-)

Comment actions Permalink

How would this save time compared to performing necessary steps after class creation directly in editor?

Comment actions Permalink

We believe that the most productive interface for editing code is the code editor, not a dialog box. The code editor in IntelliJ IDEA already contains all the necessary facilities for entering the base classes/interfaces of a class.


Please sign in to leave a comment.