Используйте IntelliJ для генерации диаграммы классов
Как мне получить IntelliJ 10.5 (на Mac), чтобы создать диаграмму классов, показывающую все классы в моем проекте? Я уверен, что я пропускаю что-то очевидное, но я могу получить только функцию «Показать диаграмму», чтобы показывать один класс за раз. (Я также понял, как добавить дополнительные классы, но опять же, только по одному.)
Zack 20 янв. 2012, в 15:27
Поделиться
Поделиться:
intellij-idea
class-diagram
4 ответа
Лучший ответ
Использовать Diagrams | Show Diagram из контекстного меню пакета. Вызов его в корне проекта будет отображать диаграмму зависимостей модулей. Если вам нужно несколько пакетов, вы можете перетащить их на уже открытую диаграмму для первого пакета и нажать e , чтобы развернуть его. Также проверьте это видео для другого подхода. Примечание. Эта функция доступна в Ultimate Edition, а не в бесплатном выпуске Community Edition.
CrazyCoder 20 янв. 2012, в 15:45
Поделиться
Означает ли это, что для версии сообщества нет доступных плагинов для создания диаграммы классов, сейчас и в будущем?
Bruce Sun 20 сен. 2016, в 03:50
@BruceSun не в данный момент
CrazyCoder 21 сен. 2016, в 00:09
@CrazyCoder Как вы используете это, чтобы просмотреть UML-диаграмму для класса и его ребер, .. я думаю, найти мои узлы, отдел 3 . или все . сейчас это довольно бесполезно. он показывает только иерархию классов, а не то, какой объект он использует, и что эти объекты в свою очередь используют. Этот плагин UML не является полезным.
momomo 21 дек. 2016, в 21:03
Ссылка вниз 🙁 не могли бы вы исправить это, пожалуйста?
Pipo 03 авг. 2018, в 17:10
Показать ещё 2 комментария
IntelliJ IDEA 14 и 15

- Показать всплывающее окно диаграммы Щелкните правой кнопкой мыши по типу/классу/пакету > Диаграммы > Показать всплывающее окно диаграммы.
или Ctrl + Alt + U - Показать диаграмму (открывает новую вкладку) Щелкните правой кнопкой мыши по типу/классу/пакету > Диаграммы > Показать диаграмму.
или Ctrl + Alt + Shift + U
По умолчанию вы видите только имена классов/интерфейсов. Если вы хотите увидеть более подробную информацию, перейдите в Файл > Настройки. > Инструменты > Диаграммы и проверьте, что вы хотите (например: Поля, Методы и т.д.)
P.S.: Вам нужен IntelliJ IDEA Ultimate, потому что эта функция не поддерживается в Community Edition. Если вы перейдете в меню «Файл» > «Настройки. » > «Плагины», вы увидите, что в Community Edition отсутствует плагин поддержки UML.
ROMANIA_engineer 14 нояб. 2014, в 10:03
Поделиться
Привет, ребята, я использую Intellij 15.0.2, и я хочу просмотреть диаграмму классов моего проекта, однако я не вижу выбора Диаграммы / Показать диаграмму, когда я щелкаю правой кнопкой мыши в пакете или классе. Может кто-нибудь мне помочь?
Ectoras 13 янв. 2016, в 16:02
@Ectoras, я полагаю, что вы используете Community Edition, а не Ultimate. Это не доступно для Community Edition (см. PS: добавлено в посте). Я тестировал его в IntelliJ IDEA 15.0.2 Ultimate, и он работал.
Как сгенерировать java код из uml диаграмм?
В Intellij IDEA есть плагин UML Support (но только в Ultimate Edition).
Используйте Ctrl + Alt + U для активации контекстного меню.
Подробное описание функционала: Working with Diagrams
Отслеживать
ответ дан 3 фев 2016 в 13:08
Pavel Parshin Pavel Parshin
9,239 1 1 золотой знак 27 27 серебряных знаков 48 48 бронзовых знаков
Я как раз с помощью этого инструмента и создал диаграмму классов, но к сожалению не могу в документации найти, как сгенерить из нее код.
3 фев 2016 в 14:04
Сейчас нет под рукой IntelliJ Idea, но вроде бы можно правой кнопкой нажать на диаграмме или рядом с ней, в контекстном меню выбрать создание или обновление кода
3 фев 2016 в 14:19
А для AndroidStudio что-то такое есть.
3 фев 2016 в 14:56
@ЮрийСПб посмотрите stackoverflow.com/questions/17123384/…
3 фев 2016 в 15:06
@PavelParshin, то что там советуют уже, похоже, не работает( Ща пробую отсюда решение
3 фев 2016 в 15:09
Понадобится программа Enterprise Architector (ЕА):
- Сохраните диаграмму классов в формате XML.
- Откройте программу ЕА.
- Выполните команду import xml (в зависимости от версии, может меняться: вкладка Publish\import xml ).
- Сформируется диаграмма; если с диаграммой всё нормально, то п. 5. Если нет, то корректируете и переходите в п. 5.
- Во вкладке Code\edit code\generate surrent with option .
Отслеживать
4,306 14 14 золотых знаков 42 42 серебряных знака 93 93 бронзовых знака
ответ дан 22 июл 2018 в 12:47
179 11 11 бронзовых знаков
- java
- intellij-idea
- uml
-
Важное на Мете
Похожие
Подписаться на ленту
Лента вопроса
Для подписки на ленту скопируйте и вставьте эту ссылку в вашу программу для чтения RSS.
Дизайн сайта / логотип © 2024 Stack Exchange Inc; пользовательские материалы лицензированы в соответствии с CC BY-SA . rev 2024.1.3.2953
Нажимая «Принять все файлы cookie» вы соглашаетесь, что Stack Exchange может хранить файлы cookie на вашем устройстве и раскрывать информацию в соответствии с нашей Политикой в отношении файлов cookie.
UML class diagrams
This functionality relies on the Diagrams plugin, which is bundled and enabled in IntelliJ IDEA by default. If the relevant features aren’t available, make sure that you didn’t disable the plugin.
- Press Control+Alt+S to open the IDE settings and then select Plugins .
- Open the Installed tab, find the Diagrams plugin, and select the checkbox next to the plugin name.
IntelliJ IDEA lets you generate a diagram on a package in your project. Such diagrams always reflect the structure of actual classes and methods in your application.
View diagram on a package
- In the Project tool window, right-click a package for which you want to create a diagram and select Diagrams | Show Diagram Control+Alt+Shift+U ).
- In the list that opens, select Java Class Diagram . IntelliJ IDEA generates a UML diagram for classes and their dependencies.
You can view your VCS local changes as a diagram. Select VCS | Uncommitted Changes| Show Local Changes as UML Control+Alt+Shift+D .
Analyze class diagram
You can press Control+F12 on the element to view a list of diagram elements and navigate between them.
To see the list of methods, fields, and other code elements, select the appropriate icon on the diagram toolbar located on top of the diagram editor.

The lists are displayed based on the selected visibility level, which you can change. For example, to view protected methods, click on the diagram toolbar and select protected from the list. IntelliJ IDEA displays members with visibility not less than protected, such as public, package local, and protected ones. The protected methods are displayed with modifier icons next to them.

You can click the icon to see class dependencies. IntelliJ IDEA follows the UML conventions in showing relationships between the classes.

When you click through classes in the graph, IntelliJ IDEA greys out classes that do not reside in the same package. This might be helpful, when you generate a diagram on a package that contains inner packages.

To save the diagram as a file, right-click the diagram editor and from the context menu, select Export Diagram | Export to File and then the file extension in which you want to save the diagram.
Manage class diagram
When working with diagrams, use the context menu in the diagram editor to perform different tasks. You can view members of the class, add new, delete the existing ones, see implementations, check parent classes, perform basic refactoring, add notes, and so on.
You can select the icon on the diagram toolbar to draw relationship links between elements in your graph. To delete the existing links, select the ones you don’t need and press Delete . IntelliJ IDEA will update the source code accordingly.
View the diagram structure
- Generate a diagram.
- Click Structure in the left toolbar. IntelliJ IDEA opens the Structure tool window that displays a map of your diagram with a small preview of the selected block and its neighbors.
Use the context menu to zoom in and out, move canvas, change layout, and export part of the diagram into an image. 
Add an existing class to a diagram
- Press Space .
- In the search field that opens, start typing a name of the class you want to add. Then, select the desired class from the suggestion list. If you want to add a class that is out of the project scope, select the Include non-project items checkbox. Alternatively, select one or more elements in the Project tool window and drag them to the diagram.
Delete a node element from the diagram
- In the diagram editor, select a node element you want to delete.
- Right-click the element and from the context menu, select Delete Delete . Alternatively, select Refactor | Safe Delete Alt+Delete . In this case, IntelliJ IDEA checks for usages before applying the changes.
You can quickly search for usages by pressing Alt+F7 on a code element.
Add new members to a class
You can perform some forward engineering while in the diagram editor.
- In the diagram editor, right-click anywhere and from the context menu, select Content | New . Then select a code element you want to create.
- Depending on your selection, IntelliJ IDEA opens the appropriate dialog where you specify the necessary information for creating the new element.
IntelliJ IDEA adds the item to your diagram as well as to your project tree .
View implementations and parent classes
You can view implementations and parent classes in your diagram. If IntelliJ IDEA finds more than one parent class or implementation, it displays a list of appropriate items. Select the one you need to see the connections between the parent and its children.
- In the diagram editor, select an item for which you want to see implementations or parent classes.
- Right-click the items and from the context menu, select the Show Implementations Control+Alt+B or Show Parents Control+Alt+P respectively.
- In the popup that opens, select items you need and press Enter . To extend your selection up or down while in the popup, press Shift+Up or Shift+Down respectively.
Configure diagram settings
You can configure the diagram settings so that you have certain options available by default when you create a diagram.
- Press Control+Alt+S to open the IDE settings and then select Tools | Diagrams .
- In the right-hand pane, select the options that you want to see by default and click OK to apply your changes.
Analyze graph
The Analyze Graph action group lets you analyze the graph in various ways such as perform auto clusterization, measure the node centrality, search cycles, filter path between two nodes, and so on.
Filter paths between two nodes
Most of the time, generated diagrams are big and complicated. Typically, you want to concentrate only on the specific part of the diagram. IntelliJ IDEA lets you filter paths between two diagram elements.

- In the diagram editor, select two nodes on which you want to focus and right-click one of them to open the context menu.
- From the context menu, select Analyze Graph | Focus On Paths Between Two Nodes . If you want to focus not only on just two nodes, but on how the selected node is connected with its neighbors, select the Focus on Node Neighborhood option from the context menu.
- In the dialog that opens, select additional options if needed and click Find . IntelliJ IDEA displays connections associated only with the selected nodes.
Measure diagram centrality
You can use this action to identify the important nodes in the graph.
- In the diagram editor, right-click anywhere in the editor to open the context menu.
- From the context menu, select Analyze Graph | Measure Centrality .
- In the dialog that opens, select additional options if needed and click Measure .
The node «importance» is expressed via fractional value from 0.0 to 1.0 measurement, and the brightest node selection should be explored first. 
Press Control+Z to cancel the actions.
Диаграмма классов в IntelliJ IDEA
Сделал проект в IntelliJ IDEA Community Edition, для пояснительной записки нужно запилить диаграмму классов. Встроенных средств не оказалось, рисовать самому будет долго, какой плагин посоветуете, может кто пользовался, желательно с примером полученных диаграмм
Голосование за лучший ответ
Doxygen — вполне справится
ТёмкаПрофи (676) 7 лет назад
слишком много действий, чтобы сделать диаграмму, может потом мне эта программа пригодится, но пока пойду другим путем.
Николай Просветленный (35606) Различные диаграммы в том числе и uml — это лишь приложение — основная цель у doxygena — построить документацию из исходников по комментариям в стили doxygen — потому если использовать его сразу же -это оправданно, жаль что документацию по ГОСТ не делает
ну дык. в проекте раскрой все папки и сделай скрин-шот.
вручную давно бы уже нарисовал.
ТёмкаПрофи (676) 7 лет назад
ага, что-то вроде этого делать вручную (у меня проект больше и больше связей чем на картинке).