mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[debugger] IJ-CR-155516 IJPL-175036 IDEA-367772 Proper formatting; wording
GitOrigin-RevId: d9f748115b6ff336860ce7eadcc74b81a1a142a4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
babc92c71d
commit
fe7864ddc5
@@ -1874,9 +1874,9 @@ group.NewGroup1.text=New Group (1)
|
||||
action.NewModuleInGroup.text=Module
|
||||
action.ShelvedChanges.ShowHideDeleted.text=Show/Hide Applied Shelved Changes
|
||||
action.XDebugger.MuteBreakpoints.text=Mute Breakpoints
|
||||
action.XDebugger.RemoveAllButThisBreakpoint.text=Remove All But This Breakpoint
|
||||
action.XDebugger.RemoveAllButThisBreakpoint.text=Remove other breakpoints
|
||||
action.XDebugger.RemoveAllButThisBreakpoint.description=Removes all breakpoints except on lines with carets
|
||||
action.XDebugger.DisableAllButThisBreakpoint.text=Disable All But This Breakpoint
|
||||
action.XDebugger.DisableAllButThisBreakpoint.text=Disable other breakpoints
|
||||
action.XDebugger.DisableAllButThisBreakpoint.description=Disables all breakpoints except on lines with carets
|
||||
action.ShelvedChanges.Restore.text=Restore Applied Shelved Change
|
||||
group.VcsToolbarActions.text=VCS Actions
|
||||
|
||||
+47
-47
@@ -12,60 +12,60 @@ import com.intellij.xdebugger.breakpoints.XBreakpoint
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointManager
|
||||
|
||||
abstract class AllButThisBreakpointAction : AnAction() {
|
||||
override fun update(e: AnActionEvent) {
|
||||
if (!Registry.`is`("debugger.remove.disable.actions", false)) {
|
||||
e.presentation.isEnabledAndVisible = false
|
||||
return
|
||||
override fun update(e: AnActionEvent) {
|
||||
if (!Registry.`is`("debugger.remove.disable.actions", false)) {
|
||||
e.presentation.isEnabledAndVisible = false
|
||||
return
|
||||
}
|
||||
|
||||
val project = e.project ?: return
|
||||
val (currentFile, caretLines) = getCurrentLines(e) ?: run {
|
||||
e.presentation.isEnabledAndVisible = false
|
||||
return
|
||||
}
|
||||
|
||||
val breakpointManager = XDebuggerManager.getInstance(project).breakpointManager
|
||||
val breakpoints = breakpointManager.allBreakpoints
|
||||
|
||||
e.presentation.isEnabledAndVisible = breakpoints.any { it.matches(currentFile, caretLines) }
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val project = e.project ?: return
|
||||
val (currentFile, caretLines) = getCurrentLines(e) ?: return
|
||||
|
||||
val breakpointManager = XDebuggerManager.getInstance(project).breakpointManager
|
||||
val breakpoints = breakpointManager.allBreakpoints
|
||||
|
||||
for (breakpoint in breakpoints) {
|
||||
if (!breakpoint.matches(currentFile, caretLines)) {
|
||||
performAction(breakpointManager, breakpoint)
|
||||
}
|
||||
|
||||
val project = e.project ?: return
|
||||
val (currentFile, caretLines) = getCurrentLines(e) ?: run {
|
||||
e.presentation.isEnabledAndVisible = false
|
||||
return
|
||||
}
|
||||
|
||||
val breakpointManager = XDebuggerManager.getInstance(project).breakpointManager
|
||||
val breakpoints = breakpointManager.allBreakpoints
|
||||
|
||||
e.presentation.isEnabledAndVisible = breakpoints.any { it.matches(currentFile, caretLines) }
|
||||
}
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val project = e.project ?: return
|
||||
val (currentFile, caretLines) = getCurrentLines(e) ?: return
|
||||
protected abstract fun performAction(breakpointManager: XBreakpointManager, breakpoint: XBreakpoint<*>)
|
||||
|
||||
val breakpointManager = XDebuggerManager.getInstance(project).breakpointManager
|
||||
val breakpoints = breakpointManager.allBreakpoints
|
||||
private fun getCurrentLines(e: AnActionEvent): Pair<VirtualFile, List<Int>>? {
|
||||
val editor = e.getData(CommonDataKeys.EDITOR) ?: return null
|
||||
val caretLines = e.getData(EditorGutterComponentEx.LOGICAL_LINE_AT_CURSOR)?.let(::listOf)
|
||||
?: editor.caretModel.allCarets.map { it.logicalPosition.line }
|
||||
val currentFile = editor.virtualFile
|
||||
|
||||
for (breakpoint in breakpoints) {
|
||||
if (!breakpoint.matches(currentFile, caretLines)) {
|
||||
performAction(breakpointManager, breakpoint)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (caretLines.isEmpty()) return null
|
||||
|
||||
protected abstract fun performAction(breakpointManager: XBreakpointManager, breakpoint: XBreakpoint<*>)
|
||||
return currentFile to caretLines
|
||||
}
|
||||
|
||||
private fun getCurrentLines(e: AnActionEvent): Pair<VirtualFile, List<Int>>? {
|
||||
val editor = e.getData(CommonDataKeys.EDITOR) ?: return null
|
||||
val caretLines = e.getData(EditorGutterComponentEx.LOGICAL_LINE_AT_CURSOR)?.let(::listOf)
|
||||
?: editor.caretModel.allCarets.map { it.logicalPosition.line }
|
||||
val currentFile = editor.virtualFile
|
||||
private fun XBreakpoint<*>.matches(currentFile: VirtualFile, caretLines: List<Int>): Boolean {
|
||||
val sourcePosition = this.sourcePosition
|
||||
val breakpointFile = sourcePosition?.file
|
||||
val breakpointLine = sourcePosition?.line
|
||||
|
||||
if (caretLines.isEmpty()) return null
|
||||
return breakpointFile == currentFile && caretLines.contains(breakpointLine)
|
||||
}
|
||||
|
||||
return currentFile to caretLines
|
||||
}
|
||||
|
||||
private fun XBreakpoint<*>.matches(currentFile: VirtualFile, caretLines: List<Int>): Boolean {
|
||||
val sourcePosition = this.sourcePosition
|
||||
val breakpointFile = sourcePosition?.file
|
||||
val breakpointLine = sourcePosition?.line
|
||||
|
||||
return breakpointFile == currentFile && caretLines.contains(breakpointLine)
|
||||
}
|
||||
|
||||
override fun getActionUpdateThread(): ActionUpdateThread {
|
||||
return ActionUpdateThread.BGT
|
||||
}
|
||||
override fun getActionUpdateThread(): ActionUpdateThread {
|
||||
return ActionUpdateThread.BGT
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@ import com.intellij.xdebugger.breakpoints.XBreakpoint
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointManager
|
||||
|
||||
class DisableAllButThisBreakpointAction : AllButThisBreakpointAction() {
|
||||
override fun performAction(breakpointManager: XBreakpointManager, breakpoint: XBreakpoint<*>) {
|
||||
breakpoint.isEnabled = false
|
||||
}
|
||||
override fun performAction(breakpointManager: XBreakpointManager, breakpoint: XBreakpoint<*>) {
|
||||
breakpoint.isEnabled = false
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -4,7 +4,7 @@ import com.intellij.xdebugger.breakpoints.XBreakpoint
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointManager
|
||||
|
||||
class RemoveAllButThisBreakpointAction : AllButThisBreakpointAction() {
|
||||
override fun performAction(breakpointManager: XBreakpointManager, breakpoint: XBreakpoint<*>) {
|
||||
breakpointManager.removeBreakpoint(breakpoint)
|
||||
}
|
||||
override fun performAction(breakpointManager: XBreakpointManager, breakpoint: XBreakpoint<*>) {
|
||||
breakpointManager.removeBreakpoint(breakpoint)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user