IntelliJ IDEA Ultimate: how to build UML diagram for the whole project? - intellij-idea

I'm getting started with IDEA and new project. I want to see the whole project's class diagram. I searched, and it says on SO that I have to
click Diagrams > Show Diagram (Ctrl+Alt+Shift+U). You will see your package in diagram editor.
but I only see one box for the whole module. But I want to see all classes, relationship between them etc. How do I do this?
I'm using the latest version of IDEA Ultimate: 2017.3

When invoked on the whole Project - it builds the diagram for the modules, not for classes. To have the Java class diagram invoke show diagram action on a specific package or if you want to see all the packages and classes in project invoke it on a module's source root. To expand a package (show it's content), select it and invoke "Expand" (E default shortcut) action.

Related

Intellij : Adding 'JUnit' to context menu when creating new file

Currently in Intellij if I try to create a new file via "New > whatever", I don't see any option to choose a JUnit file. I dug deeper and found out the "Edit File Templates...".
While you can add a variety of files from there to the context menu, there is no ability to choose JUnit.
If you browse over to "Code" tab you can see various JUnit templates. However I have no idea if these are just code generation templates instead of file generation templates. And besides, there is no option to port them to the "Files" tab.
The closest SO thread describing this issue is this and it failed to match my needs.
Mind you I am relatively new to Intellij and I come from eclipse.
P.S: I am aware you can generate tests from existing classes. I am currently trying to implement TDD so that does not answer my needs.
While I don't have an answer for this exact question, I think there's an easier way to handle the underlying requirements (easily creating tests):
Navigate to the class you want to test and press ALT+ENTER. In the context menu, pick "Create Test":
After you choose it, you'll get a dialog with several options including the framework to use (e.g., JUnit 5, JUnit 5, TestNG), the methods you want to generate test stubs for, etc:

Old project don't show current windows in Intellij IDEA

When i open "test" project then "Loop" project gone from window. But I want see my all project in one windows.
From the docs:
The first thing you'll notice when launching IntelliJ IDEA is that it has no workspace concept. This means that you can work with only one project at a time.
It may well be the case that you don't need to switch projects in IntelliJ, since you could create an IntelliJ project which contains multiple modules. However, if you are dealing with distinct projects here then it is possible to switch between currently open projects in IntelliJ using keystrokes or a menu. From the docs:
To switch between the currently opened projects, do one of the following
On the main menu, choose Window | Next Project Window/Previous Project Window.
Press โŒ˜ or โ‡งโŒ˜.
On the main menu, point to Window, and then select the name of the desired project.
For what I know, you can't get multiple projects into one window with JetStorm IDEs.
You can make them in multiple windows with different projects. Or, you can just make a project and add the projects in it.
IntelliJ can indeed only open one project at a time - but you can easily open (and alt-tab) between projects.
If you have 2 projects that are dependent or closely related, you can look at a form of project modularisation.
A popular framework is maven, based on the project object model (pom.xml) specification.
https://maven.apache.org/guides/introduction/introduction-to-the-pom.html
When you have a multi-module maven project in intellij, you can view all modules in the project view (tree based configuration).

IntelliJ file new move Java Class on top

When I do a file new in my IntelliJ idea. I see a menu like this one
I want to see classes from Java and Scala on the top. I don't want to uninstall plugins for ruby etc. But these should not be on the top. I mostly code in java and scala and therefore want these classes to be one top.
When I want to create a new Java class, I activate the "Project" view. Then I select the package to which the new class shall belong to. Then press Alt+Insert. This popup menu is shown:
Please ensure that the directory you're creating a class in is under a module source root. You can navigate to it in Project View, right-click on it or any its parent and choose Mark As... | Source Root

No coverage in 'all classes in scope' in Intellij

In Intellij IDEA 14.1.5 Community edition, I imported maven to get coverage from jacoco.exec file. Steps followed
right click on imported module.
select Analyze-->Show Converage Data.
provided valid jacoc.exec file and click 'show selected'
Instead of coverage i'm getting error as no coverage in 'all classes in scope'
can anybody suggest what is wrong?
I had the same thing happen to me.
I was able to fix this by going to "Edit Configurations", to the "Code Coverage" tab.
I'm not sure what caused it, but the wrong package namespace was listed there. I updated the entry there and my subsequent test run with code coverage succeeded.
It happens if your test class and class to test are in different package structures.
My test class was in:
com.tools.api
Class to be tested was in:
com.tools.ws
Once I've corrected the pattern as com.tools.* in the code coverage tab, I was able to see coverage results.
I had the same problem and found solution here.
In the Code Coverage tab, define the following options:
Specify the scope to measure code coverage for. Do one of the following:
To specify a class, click the Add Class button.
To specify a package, click the Add Package button.
I was able to fix this issue by:
Open Edit Configurations menu
Click on Modify Options > Coverage settings > Specify classes and packages
In the new box that appears, click on the plus to add a package
Select a high level package from the project

How to build project-wide UML diagram in IntelliJ IDEA?

Trying to reverse-engineer existing project and it would be of great help to see how classes collaborate/depend on each other. Is there a way to build project-wide UML diagram (or class diagram of any kind) in IntelliJ IDEA using build-in functionallity or using some free plugin?
Right click on your package no matter which. Click Diagrams > Show Diagram (Ctrl+Alt+Shift+U). You will see your package in diagram editor.
Now:
You can expand (E) or collapse (C) all nodes.
You can show dependencies
You can show many attributes of nodes (constructors, methods, properties...)
You can drag&drop other packages from project explorer.
So, play with it a bit and i think you will achieve what you need.
This is how it could looks like: