diff --git a/idea/idea-analysis/resources/org/jetbrains/kotlin/idea/KotlinBundle.properties b/idea/idea-analysis/resources/org/jetbrains/kotlin/idea/KotlinBundle.properties index f9ccad0b6a6..235b910b807 100644 --- a/idea/idea-analysis/resources/org/jetbrains/kotlin/idea/KotlinBundle.properties +++ b/idea/idea-analysis/resources/org/jetbrains/kotlin/idea/KotlinBundle.properties @@ -242,13 +242,6 @@ kotlin.compiler.js.option.output.postfix.browse.title=Choose file to append to g kotlin.compiler.js.option.output.copy.files=&Copy library runtime files kotlin.compiler.js.option.output.copy.dir=O&utput directory for library &runtime files: -# Coroutine Debugger -debugger.session.tab.coroutine.title=Coroutines -debugger.session.tab.coroutine.message.failure=Failed to retrieve coroutine status -debugger.session.tab.coroutine.message.resume=Application resumed -debugger.session.tab.coroutine.message.error=Coroutine dump failed, see log -debugger.session.tab.xcoroutine.title=Coroutines - # Android Lint android.klint.inspections.group.name=Android Lint for Kotlin diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/resources/org/jetbrains/kotlin/idea/debugger/coroutine/KotlinDebuggerCoroutinesBundle.properties b/idea/jvm-debugger/jvm-debugger-coroutine/resources/org/jetbrains/kotlin/idea/debugger/coroutine/KotlinDebuggerCoroutinesBundle.properties new file mode 100644 index 00000000000..6479b95d0ac --- /dev/null +++ b/idea/jvm-debugger/jvm-debugger-coroutine/resources/org/jetbrains/kotlin/idea/debugger/coroutine/KotlinDebuggerCoroutinesBundle.properties @@ -0,0 +1,25 @@ +coroutine.dump.panel.title=Coroutine dump +coroutine.dump.filter.field=Filter: + +coroutine.dump.filter.action=Filter +coroutine.dump.filter.description=Show only coroutines containing a specific string + +coroutine.dump.merge.action=Merge Identical Stacktrace +coroutine.dump.merge.description=Group coroutines with identical stacktrace + +coroutine.dump.copy.action=Copy to Clipboard +coroutine.dump.copy.description=Copy whole coroutine dump to clipboard +coroutine.dump.failed=Coroutine dump failed, see the log +coroutine.dump.copy.analyze=Analyze coroutine dump + +coroutine.dump.full.title=Full coroutine dump +coroutine.dump.full.copied=Full coroutine dump was successfully copied to clipboard + +coroutine.dump.creation.trace=Coroutine creation stack trace +coroutine.dump.creation.frame=Creation stack frame of {0} + +coroutine.dump.threads.loading=Loading… + +coroutine.view.title=Coroutines +coroutine.view.default.group=Default group +coroutine.view.fetching.error=An error occurred on fetching information \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/KotlinDebuggerCoroutinesBundle.kt b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/KotlinDebuggerCoroutinesBundle.kt new file mode 100644 index 00000000000..5864e515451 --- /dev/null +++ b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/KotlinDebuggerCoroutinesBundle.kt @@ -0,0 +1,24 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.debugger.coroutine + +import com.intellij.CommonBundle +import org.jetbrains.annotations.NonNls +import org.jetbrains.annotations.PropertyKey +import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase +import java.util.* + +object KotlinDebuggerCoroutinesBundle : KotlinBundleBase() { + @NonNls + private const val BUNDLE = "org.jetbrains.kotlin.idea.debugger.coroutine.KotlinDebuggerCoroutinesBundle" + + override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE) + + @JvmStatic + fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String { + return CommonBundle.message(bundle, key, *params) + } +} \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/VersionedImplementationProvider.kt b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/VersionedImplementationProvider.kt index 0f350516450..992197b8b3e 100644 --- a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/VersionedImplementationProvider.kt +++ b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/VersionedImplementationProvider.kt @@ -15,7 +15,7 @@ class VersionedImplementationProvider { if (value != null) { label.text = value } else if (index >= 0) { - label.text = "Loading..." + label.text = KotlinDebuggerCoroutinesBundle.message("coroutine.dump.threads.loading") } } } \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/VersionedImplementationProvider.kt.191 b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/VersionedImplementationProvider.kt.191 index 2a07e978238..753e860b568 100644 --- a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/VersionedImplementationProvider.kt.191 +++ b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/VersionedImplementationProvider.kt.191 @@ -15,7 +15,7 @@ class VersionedImplementationProvider { if (value != null) { label.text = value } else if (index >= 0) { - label.text = "Loading..." + label.text = KotlinDebuggerCoroutinesBundle.message("coroutine.dump.threads.loading") } } } \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/command/CoroutineDumpAction.kt b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/command/CoroutineDumpAction.kt index 3ea4b1ff922..a0ef9ba2fc7 100644 --- a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/command/CoroutineDumpAction.kt +++ b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/command/CoroutineDumpAction.kt @@ -23,7 +23,7 @@ import com.intellij.openapi.util.Disposer import com.intellij.psi.search.GlobalSearchScope import com.intellij.util.text.DateFormatUtil import com.intellij.xdebugger.impl.XDebuggerManagerImpl -import org.jetbrains.kotlin.idea.KotlinBundle +import org.jetbrains.kotlin.idea.debugger.coroutine.KotlinDebuggerCoroutinesBundle import org.jetbrains.kotlin.idea.debugger.coroutine.view.CoroutineDumpPanel import org.jetbrains.kotlin.idea.debugger.coroutine.coroutineDebuggerEnabled import org.jetbrains.kotlin.idea.debugger.coroutine.data.CoroutineInfoData @@ -43,7 +43,7 @@ class CoroutineDumpAction : AnAction(), AnAction.TransparentUpdate { val states = CoroutineDebugProbesProxy(context.suspendContext ?: return) .dumpCoroutines() if (states.isOk()) { - val message = KotlinBundle.message("debugger.session.tab.coroutine.message.error") + val message = KotlinDebuggerCoroutinesBundle.message("coroutine.dump.failed") XDebuggerManagerImpl.NOTIFICATION_GROUP.createNotification(message,MessageType.ERROR).notify(project) } else { val f = fun() { @@ -72,7 +72,7 @@ class CoroutineDumpAction : AnAction(), AnAction.TransparentUpdate { val content = ui.createContent(id, panel, id, null, null).apply { putUserData(RunnerContentUi.LIGHTWEIGHT_CONTENT_MARKER, true) isCloseable = true - description = "Coroutine Dump" + description = KotlinDebuggerCoroutinesBundle.message("coroutine.dump.panel.title") } ui.addContent(content) ui.selectAndFocus(content, true, true) diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/TreeNodeDescriptorImpl.kt b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/TreeNodeDescriptorImpl.kt index e37882c87c1..ef30942648a 100644 --- a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/TreeNodeDescriptorImpl.kt +++ b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/TreeNodeDescriptorImpl.kt @@ -17,6 +17,7 @@ import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl import com.intellij.debugger.ui.tree.render.DescriptorLabelListener import com.intellij.icons.AllIcons import com.sun.jdi.ObjectReference +import org.jetbrains.kotlin.idea.debugger.coroutine.KotlinDebuggerCoroutinesBundle import javax.swing.Icon @Deprecated("moved to XCoroutineView") @@ -49,7 +50,7 @@ class CoroutineDescriptorImpl(val infoData: CoroutineInfoData) : NodeDescriptorI @Deprecated("moved to XCoroutineView") class CreationFramesDescriptor(val frames: List) : - MessageDescriptor("Coroutine creation stack trace", INFORMATION) { + MessageDescriptor(KotlinDebuggerCoroutinesBundle.message("coroutine.dump.creation.trace"), INFORMATION) { override fun isExpandable() = true } diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/CoroutineDumpPanel.kt b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/CoroutineDumpPanel.kt index eac6ecd2d10..36cf25cfbd7 100644 --- a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/CoroutineDumpPanel.kt +++ b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/CoroutineDumpPanel.kt @@ -32,6 +32,7 @@ import com.intellij.ui.components.JBList import com.intellij.unscramble.AnalyzeStacktraceUtil import com.intellij.util.PlatformIcons import com.intellij.util.ui.EmptyIcon +import org.jetbrains.kotlin.idea.debugger.coroutine.KotlinDebuggerCoroutinesBundle import org.jetbrains.kotlin.idea.debugger.coroutine.data.CoroutineInfoData import java.awt.BorderLayout import java.awt.Color @@ -61,7 +62,7 @@ class CoroutineDumpPanel(project: Project, consoleView: ConsoleView, toolbarActi }) filterPanel.apply { - add(JLabel("Filter:"), BorderLayout.WEST) + add(JLabel(KotlinDebuggerCoroutinesBundle.message("coroutine.dump.filter.field")), BorderLayout.WEST) add(filterField) isVisible = false } @@ -215,8 +216,8 @@ class CoroutineDumpPanel(project: Project, consoleView: ConsoleView, toolbarActi } private inner class FilterAction : ToggleAction( - "Filter", - "Show only coroutines containing a specific string", + KotlinDebuggerCoroutinesBundle.message("coroutine.dump.filter.action"), + KotlinDebuggerCoroutinesBundle.message("coroutine.dump.filter.description"), AllIcons.General.Filter ), DumbAware { @@ -235,8 +236,8 @@ class CoroutineDumpPanel(project: Project, consoleView: ConsoleView, toolbarActi } private inner class MergeStackTracesAction : ToggleAction( - "Merge Identical Stacktrace", - "Group coroutines with identical stacktrace", + KotlinDebuggerCoroutinesBundle.message("coroutine.dump.merge.action"), + KotlinDebuggerCoroutinesBundle.message("coroutine.dump.merge.description"), AllIcons.Actions.Collapseall ), DumbAware { @@ -251,23 +252,30 @@ class CoroutineDumpPanel(project: Project, consoleView: ConsoleView, toolbarActi } private class CopyToClipboardAction(private val myCoroutinesDump: List, private val myProject: Project) : - DumbAwareAction("Copy to Clipboard", "Copy whole coroutine dump to clipboard", PlatformIcons.COPY_ICON) { + DumbAwareAction( + KotlinDebuggerCoroutinesBundle.message("coroutine.dump.copy.action"), + KotlinDebuggerCoroutinesBundle.message("coroutine.dump.copy.description"), + PlatformIcons.COPY_ICON + ) { override fun actionPerformed(e: AnActionEvent) { val buf = StringBuilder() - buf.append("Full coroutine dump").append("\n\n") + buf.append(KotlinDebuggerCoroutinesBundle.message("coroutine.dump.full.title")).append("\n\n") for (state in myCoroutinesDump) { buf.append(state.stringStackTrace).append("\n\n") } CopyPasteManager.getInstance().setContents(StringSelection(buf.toString())) group.createNotification( - "Full coroutine dump was successfully copied to clipboard", + KotlinDebuggerCoroutinesBundle.message("coroutine.dump.full.copied"), MessageType.INFO ).notify(myProject) } - private val group = NotificationGroup.toolWindowGroup("Analyze coroutine dump", ToolWindowId.RUN, false) + private val group = NotificationGroup.toolWindowGroup( + KotlinDebuggerCoroutinesBundle.message("coroutine.dump.copy.analyze"), + ToolWindowId.RUN, false + ) } private class MyToFileExporter( diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/SimpleColoredTextIcon.kt b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/SimpleColoredTextIcon.kt index 00a01d6c3a9..20f6e95ca54 100644 --- a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/SimpleColoredTextIcon.kt +++ b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/SimpleColoredTextIcon.kt @@ -24,6 +24,7 @@ import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants import com.intellij.xdebugger.ui.DebuggerColors import com.sun.jdi.Location import com.sun.jdi.ReferenceType +import org.jetbrains.kotlin.idea.debugger.coroutine.KotlinDebuggerCoroutinesBundle import org.jetbrains.kotlin.idea.debugger.coroutine.data.CoroutineInfoData import org.jetbrains.kotlin.idea.debugger.coroutine.util.logger import java.awt.Color @@ -177,7 +178,10 @@ class SimpleColoredTextIconPresentationRenderer { } fun renderCreationNode(infoData: CoroutineInfoData) = - SimpleColoredTextIcon(AllIcons.Debugger.ThreadSuspended, true, "Creation stack frame of ${infoData.name}") + SimpleColoredTextIcon( + AllIcons.Debugger.ThreadSuspended, true, + KotlinDebuggerCoroutinesBundle.message("coroutine.dump.creation.frame", infoData.name) + ) fun renderErrorNode(error: String) = SimpleColoredTextIcon(AllIcons.Actions.Lightning,false, error) diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/XCoroutineView.kt b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/XCoroutineView.kt index 3f194c8b43f..e6b5c30f808 100644 --- a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/XCoroutineView.kt +++ b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/XCoroutineView.kt @@ -40,9 +40,9 @@ import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeState import com.intellij.xdebugger.impl.ui.tree.nodes.XValueContainerNode import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl import com.sun.jdi.request.EventRequest -import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.debugger.coroutine.CoroutineDebuggerContentInfo import org.jetbrains.kotlin.idea.debugger.coroutine.CoroutineDebuggerContentInfo.Companion.XCOROUTINE_POPUP_ACTION_GROUP +import org.jetbrains.kotlin.idea.debugger.coroutine.KotlinDebuggerCoroutinesBundle import org.jetbrains.kotlin.idea.debugger.coroutine.VersionedImplementationProvider import org.jetbrains.kotlin.idea.debugger.coroutine.data.* import org.jetbrains.kotlin.idea.debugger.coroutine.proxy.ApplicationThreadExecutor @@ -150,7 +150,7 @@ class XCoroutineView(val project: Project, val session: XDebugSession) : CreateContentParams( CoroutineDebuggerContentInfo.XCOROUTINE_THREADS_CONTENT, mainPanel, - KotlinBundle.message("debugger.session.tab.xcoroutine.title"), + KotlinDebuggerCoroutinesBundle.message("coroutine.view.title"), null, panel.tree ) @@ -158,7 +158,10 @@ class XCoroutineView(val project: Project, val session: XDebugSession) : inner class EmptyNode : XValueContainerNode(panel.tree, null, true, object : XValueContainer() {}) inner class XCoroutinesRootNode(suspendContext: XSuspendContext) : - XValueContainerNode(panel.tree, null, false, CoroutineGroupContainer(suspendContext, "Default group")) + XValueContainerNode( + panel.tree, null, false, + CoroutineGroupContainer(suspendContext, KotlinDebuggerCoroutinesBundle.message("coroutine.view.default.group")) + ) inner class CoroutineGroupContainer(val suspendContext: XSuspendContext, val groupName: String) : XValueContainer() { override fun computeChildren(node: XCompositeNode) { @@ -191,7 +194,8 @@ class XCoroutineView(val project: Project, val session: XDebugSession) : } node.addChildren(children, true) } else { - node.addChildren(XValueChildrenList.singleton(ErrorNode("Error occurs while fetching information")), true) + val errorNode = ErrorNode(KotlinDebuggerCoroutinesBundle.message("coroutine.view.fetching.error")) + node.addChildren(XValueChildrenList.singleton(errorNode), true) } } }