File tree Expand file tree Collapse file tree
app/src/main/java/com/itsaky/androidide/actions/debug Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,15 +23,15 @@ abstract class AbstractDebuggerAction(
2323 override var enabled = true
2424 override var icon: Drawable ? = null
2525
26- protected val debugClient: IDEDebugClientImpl
27- get() = IDEDebugClientImpl .requireInstance ()
26+ protected val debugClient: IDEDebugClientImpl ?
27+ get() = IDEDebugClientImpl .getInstance ()
2828
29- protected open fun checkEnabled (data : ActionData ): Boolean = debugClient.isVmConnected()
29+ protected open fun checkEnabled (data : ActionData ): Boolean = debugClient? .isVmConnected() == true
3030
3131 override fun prepare (data : ActionData ) {
3232 super .prepare(data)
3333
3434 icon = ContextCompat .getDrawable(data.requireContext(), iconRes)
3535 enabled = checkEnabled(data)
3636 }
37- }
37+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ abstract class AbstractStepAction(
88 @DrawableRes iconRes : Int
99): AbstractDebuggerAction(iconRes) {
1010
11- override fun checkEnabled (data : ActionData ): Boolean =
12- debugClient.connectionState >= DebuggerConnectionState .AWAITING_BREAKPOINT
13- }
11+ override fun checkEnabled (data : ActionData ): Boolean {
12+ val client = debugClient ? : return false
13+ return client.connectionState >= DebuggerConnectionState .AWAITING_BREAKPOINT
14+ }
15+ }
Original file line number Diff line number Diff line change @@ -17,6 +17,6 @@ class KillVmAction(
1717 override var tooltipTag = TooltipTag .DEBUGGER_ACTION_KILL
1818
1919 override suspend fun execAction (data : ActionData ) {
20- debugClient.killVm()
20+ debugClient? .killVm()
2121 }
22- }
22+ }
Original file line number Diff line number Diff line change @@ -17,6 +17,6 @@ class StepIntoAction(
1717 override var tooltipTag = TooltipTag .DEBUGGER_ACTION_STEP_INTO
1818
1919 override suspend fun execAction (data : ActionData ) {
20- debugClient.stepInto()
20+ debugClient? .stepInto()
2121 }
22- }
22+ }
Original file line number Diff line number Diff line change @@ -17,6 +17,6 @@ class StepOutAction(
1717 override var tooltipTag = TooltipTag .DEBUGGER_ACTION_STEP_OUT
1818
1919 override suspend fun execAction (data : ActionData ) {
20- debugClient.stepOut()
20+ debugClient? .stepOut()
2121 }
22- }
22+ }
Original file line number Diff line number Diff line change @@ -17,6 +17,6 @@ class StepOverAction(
1717 override var tooltipTag = TooltipTag .DEBUGGER_ACTION_STEP_OVER
1818
1919 override suspend fun execAction (data : ActionData ) {
20- debugClient.stepOver()
20+ debugClient? .stepOver()
2121 }
22- }
22+ }
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class SuspendResumeVmAction(
2222 override fun prepare (data : ActionData ) {
2323 super .prepare(data)
2424 val context = data.requireContext()
25- val isSuspended = debugClient.isVmSuspended()
25+ val isSuspended = debugClient? .isVmSuspended() == true
2626 if (isSuspended) {
2727 label = context.getString(R .string.debugger_resume)
2828 icon = ContextCompat .getDrawable(context, R .drawable.ic_run)
@@ -33,10 +33,11 @@ class SuspendResumeVmAction(
3333 }
3434
3535 override suspend fun execAction (data : ActionData ) {
36- if (debugClient.isVmSuspended()) {
37- debugClient.resumeVm()
36+ val client = debugClient ? : return
37+ if (client.isVmSuspended()) {
38+ client.resumeVm()
3839 } else {
39- debugClient .suspendVm()
40+ client .suspendVm()
4041 }
4142 }
42- }
43+ }
You can’t perform that action at this time.
0 commit comments