mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] Clean up ShortenSelectionAction
#KTIJ-28116 GitOrigin-RevId: e3b5ad32473fe3134ba15b2c32ef44582fdabfca
This commit is contained in:
committed by
intellij-monorepo-bot
parent
53f4384783
commit
2f289ccda6
+2
-5
@@ -8,7 +8,6 @@ import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.command.WriteCommandAction
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import org.jetbrains.kotlin.analysis.api.analyze
|
||||
import org.jetbrains.kotlin.idea.base.analysis.api.utils.shortenReferencesInRange
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
@@ -23,10 +22,8 @@ internal class ShortenSelectionAction : AnAction() {
|
||||
val editor = CommonDataKeys.EDITOR.getData(dataContext) ?: return
|
||||
val file = PsiDocumentManager.getInstance(project).getPsiFile(editor.document) as? KtFile ?: return
|
||||
val selection = TextRange(editor.selectionModel.selectionStart, editor.selectionModel.selectionEnd)
|
||||
WriteCommandAction.runWriteCommandAction(project, templateText, null, {
|
||||
analyze(file) {
|
||||
shortenReferencesInRange(file, selection)
|
||||
}
|
||||
WriteCommandAction.runWriteCommandAction(project, templateText, /* groupID = */ null, {
|
||||
shortenReferencesInRange(file, selection)
|
||||
}, file)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user