i18n: js debugger - extract constants, remove unused

GitOrigin-RevId: 8d48fd99ecb7da740fe9a19c674c12c4ddace14a
This commit is contained in:
Viktor Shatrov
2020-08-20 22:38:37 +03:00
committed by intellij-monorepo-bot
parent c816eb1b52
commit fdd73fd6c0
7 changed files with 31 additions and 13 deletions

View File

@@ -16,6 +16,7 @@
package org.jetbrains.debugger
import com.intellij.openapi.util.UserDataHolderEx
import org.jetbrains.annotations.Nls
import org.jetbrains.concurrency.Promise
import org.jetbrains.concurrency.nullPromise
@@ -45,7 +46,7 @@ interface Vm : UserDataHolderEx {
fun setBreakOnException(catchMode: ExceptionCatchMode): Promise<*> = nullPromise()
val presentableName: String
get() = "Main Thread"
@Nls get() = "Main Thread"
val childVMs: MutableList<Vm>
}

View File

@@ -15,6 +15,8 @@
*/
package org.jetbrains.debugger.sourcemap;
import org.jetbrains.annotations.NonNls;
final class Base64VLQ {
private Base64VLQ() {
}
@@ -60,7 +62,7 @@ final class Base64VLQ {
* A map used to convert integer values in the range 0-63 to their base64
* values.
*/
private static final String BASE64_MAP =
private static final @NonNls String BASE64_MAP =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
"abcdefghijklmnopqrstuvwxyz" +
"0123456789+/";

View File

@@ -10,6 +10,7 @@ import com.intellij.openapi.util.Conditions
import com.intellij.ui.ColoredListCellRenderer
import com.intellij.util.io.connectRetrying
import com.intellij.util.io.socketConnection.ConnectionStatus
import com.intellij.xdebugger.XDebuggerBundle
import io.netty.bootstrap.Bootstrap
import org.jetbrains.concurrency.*
import org.jetbrains.debugger.Vm
@@ -138,7 +139,7 @@ fun <T> chooseDebuggee(targets: Collection<T>, selectedIndex: Int, renderer: (T,
renderer(value, this)
}
})
.setTitle("Choose Page to Debug")
.setTitle(XDebuggerBundle.message("script.debugger.popup.title.choose.page"))
.setCancelOnWindowDeactivation(false)
.setItemChosenCallback { value ->
result.setResult(value)
@@ -163,7 +164,7 @@ fun initRemoteVmConnectionSync(connection: RemoteVmConnection<*>, debugPort: Int
vm = vmPromise.blockingGet(30, TimeUnit.SECONDS)!!
}
catch (e: Exception) {
throw ExecutionException("Cannot connect to VM ($address)", e)
throw ExecutionException(XDebuggerBundle.message("script.debugger.error.cannot.connect", address), e)
}
return vm

View File

@@ -3,9 +3,11 @@ package org.jetbrains.debugger
import com.intellij.icons.AllIcons
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.util.NlsContexts
import com.intellij.ui.ColoredTextContainer
import com.intellij.ui.SimpleTextAttributes
import com.intellij.util.ui.UIUtil
import com.intellij.xdebugger.XDebuggerBundle
import com.intellij.xdebugger.frame.XExecutionStack
import com.intellij.xdebugger.frame.XStackFrame
import com.intellij.xdebugger.frame.XSuspendContext
@@ -136,7 +138,7 @@ abstract class SuspendContextView(protected val debugProcess: MultiVmDebugProces
class RunningThreadExecutionStackView(vm: Vm) : ScriptExecutionStack(vm, vm.presentableName, AllIcons.Debugger.ThreadRunning) {
override fun computeStackFrames(firstFrameIndex: Int, container: XStackFrameContainer?) {
// add dependency to DebuggerBundle?
container?.errorOccurred("Frames not available for unsuspended thread")
container?.errorOccurred(XDebuggerBundle.message("debugger.frames.dialog.message.not.available.for.unsuspended"))
}
override fun getTopFrame(): XStackFrame? = null
@@ -148,7 +150,9 @@ class InactiveAtBreakpointExecutionStackView(vm: Vm) : ScriptExecutionStack(vm,
override fun computeStackFrames(firstFrameIndex: Int, container: XStackFrameContainer?) {}
}
abstract class ScriptExecutionStack(val vm: Vm, displayName: String, icon: javax.swing.Icon): XExecutionStack(displayName, icon) {
abstract class ScriptExecutionStack(val vm: Vm, @NlsContexts.ListItem displayName : String, icon: javax.swing.Icon)
: XExecutionStack(displayName, icon) {
override fun hashCode(): Int {
return vm.hashCode()
}
@@ -165,7 +169,7 @@ class ExecutionStackView(val suspendContext: SuspendContext<*>,
internal val viewSupport: DebuggerViewSupport,
private val topFrameScript: Script?,
private val topFrameSourceInfo: SourceInfo? = null,
displayName: String = "",
@NlsContexts.ListItem displayName: String = "",
isCurrent: Boolean = true)
: ScriptExecutionStack(suspendContext.vm, displayName, getThreadIcon(isCurrent)) {
@@ -232,7 +236,7 @@ private val ASYNC_HEADER_ATTRIBUTES = SimpleTextAttributes(SimpleTextAttributes.
private class AsyncFramesHeader(val asyncFunctionName: String) : XStackFrame(), XDebuggerFramesList.ItemWithCustomBackgroundColor {
override fun customizePresentation(component: ColoredTextContainer) {
component.append("Async call from $asyncFunctionName", ASYNC_HEADER_ATTRIBUTES)
component.append(XDebuggerBundle.message("debugger.frames.label.async.call.from.function", asyncFunctionName), ASYNC_HEADER_ATTRIBUTES)
}
override fun getBackgroundColor(): Color? = null

View File

@@ -24,6 +24,7 @@ import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.util.net.NetUtils;
import com.intellij.xdebugger.XDebugProcess;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.XDebuggerBundle;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -38,7 +39,7 @@ public interface DebuggableRunConfiguration extends RunConfiguration {
return new InetSocketAddress(InetAddress.getLoopbackAddress(), NetUtils.findAvailableSocketPort());
}
catch (IOException e) {
throw new ExecutionException("Cannot find available port", e);
throw new ExecutionException(XDebuggerBundle.message("error.message.cannot.find.available.port"), e);
}
}

View File

@@ -2,8 +2,10 @@
package org.jetbrains.debugger.frame
import com.intellij.icons.AllIcons
import com.intellij.openapi.util.NlsSafe
import com.intellij.ui.ColoredTextContainer
import com.intellij.ui.SimpleTextAttributes
import com.intellij.xdebugger.XDebuggerBundle
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator
import com.intellij.xdebugger.frame.XCompositeNode
import com.intellij.xdebugger.frame.XStackFrame
@@ -57,7 +59,7 @@ class CallFrameView @JvmOverloads constructor(val callFrame: CallFrame,
override fun customizePresentation(component: ColoredTextContainer) {
if (sourceInfo == null) {
val scriptName = if (script == null) "unknown" else script.url.trimParameters().toDecodedForm()
val scriptName = if (script == null) XDebuggerBundle.message("stack.frame.function.unknown") else script.url.trimParameters().toDecodedForm()
val line = callFrame.line
component.append(if (line == -1) scriptName else "$scriptName:$line", SimpleTextAttributes.ERROR_ATTRIBUTES)
return
@@ -70,7 +72,7 @@ class CallFrameView @JvmOverloads constructor(val callFrame: CallFrame,
if (isInLibraryContent || callFrame.isFromAsyncStack) SimpleTextAttributes.GRAYED_ATTRIBUTES
else SimpleTextAttributes.REGULAR_ATTRIBUTES
val functionName = sourceInfo.functionName
@NlsSafe val functionName = sourceInfo.functionName
if (functionName == null || (functionName.isEmpty() && callFrame.hasOnlyGlobalScope)) {
if (fileName.startsWith("index.")) {
sourceInfo.file.parent?.let {
@@ -81,7 +83,7 @@ class CallFrameView @JvmOverloads constructor(val callFrame: CallFrame,
}
else {
if (functionName.isEmpty()) {
component.append("anonymous", if (isInLibraryContent) SimpleTextAttributes.GRAYED_ITALIC_ATTRIBUTES else SimpleTextAttributes.REGULAR_ITALIC_ATTRIBUTES)
component.append(XDebuggerBundle.message("stack.frame.function.name.anonymous"), if (isInLibraryContent) SimpleTextAttributes.GRAYED_ITALIC_ATTRIBUTES else SimpleTextAttributes.REGULAR_ITALIC_ATTRIBUTES)
}
else {
component.append(functionName, textAttributes)

View File

@@ -237,4 +237,11 @@ accessible.name.icon.0.1.2=icon: {0}{1}{2}
accessible.name.icon.conditional=conditional
accessible.name.icon.disabled=disabled
label.host=&Host:
label.port=&Port:
label.port=&Port:
stack.frame.function.name.anonymous=anonymous
stack.frame.function.unknown=unknown
error.message.cannot.find.available.port=Cannot find available port
script.debugger.popup.title.choose.page=Choose Page to Debug
script.debugger.error.cannot.connect=Cannot connect to VM ({0})
debugger.frames.dialog.message.not.available.for.unsuspended=Frames not available for unsuspended thread
debugger.frames.label.async.call.from.function=Async call from {0}