Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite09da40

Browse files
committed
feat(git): show class usage relationships in structure diagram#438
Generate and display class usage links in the structure diagram to improve code navigation and understanding.
1 parentdf63c35 commite09da40

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

‎exts/ext-diagram/src/241/main/kotlin/cc/unitmesh/diagram/editor/mermaid/MermaidPreviewFileEditor.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class MermaidPreviewFileEditor(private val project: Project, private val file: V
137137
return
138138
}
139139

140-
mergingUpdateQueue.queue(object:Update("update") {
140+
mergingUpdateQueue.queue(object:Update("AUTODEV.UML.UPDATE") {
141141
overridefunrun() {
142142
ApplicationManager.getApplication().invokeLater {
143143
myPanel!!.draw()

‎exts/ext-git/src/main/kotlin/cc/unitmesh/git/actions/vcs/PrepushReviewAction.kt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,18 @@ class PrepushReviewAction : AnAction() {
6565
setOKButtonText("Accept")
6666
setSize(1200,800)
6767
init()
68+
69+
editor.selectNotify()
6870
}
6971

7072
overridefundoOKAction() {
7173
super.doOKAction()
7274
}
7375

7476
overridefuncreateCenterPanel():JComponent {
75-
editor.selectNotify()
7677
return editor.component
7778
}
78-
79-
}.show()
79+
}.showAndGet()
8080
}
8181
}
8282

‎exts/ext-git/src/main/kotlin/cc/unitmesh/git/actions/vcs/StructureDiagramBuilder.kt‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import com.intellij.openapi.application.runReadAction
99
importcom.intellij.openapi.fileTypes.FileTypeManager
1010
importcom.intellij.openapi.project.Project
1111
importcom.intellij.openapi.vcs.changes.Change
12+
importcom.intellij.profiler.ultimate.util.deduplicate
1213
importcom.intellij.psi.PsiElement
1314
importcom.intellij.psi.PsiFileFactory
15+
importcom.intellij.psi.PsiNameIdentifierOwner
1416
importcom.intellij.psi.PsiNamedElement
1517

1618
/**
@@ -113,6 +115,28 @@ class StructureDiagramBuilder(val project: Project, val changes: List<Change>) {
113115
}
114116
}
115117
}
118+
119+
/// generate usages
120+
val items= (beforeStructure+ afterStructure).distinct().map { classContext->
121+
val mapNotNull:List<String>= classContext.usages.mapNotNull { usage->
122+
if (usage.element.containingFile!isPsiNamedElement) {
123+
return@mapNotNullnull
124+
}
125+
126+
val element= usage.element.containingFileasPsiNamedElement
127+
val className= classContext.name?:return@mapNotNullnull
128+
val sanitizedClassName= sanitizeClassName(className)
129+
val name= element.name?.substringBeforeLast(".")
130+
val usageClassName= sanitizeClassName(name?:"unknown")
131+
return@mapNotNull"$sanitizedClassName -->$usageClassName"
132+
}
133+
134+
mapNotNull
135+
}.flatten().distinct()
136+
137+
items.forEach {
138+
builder.appendLine(it)
139+
}
116140
}
117141

118142
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp