Skip to content

Commit 9778d78

Browse files
committed
Merge branch 'stage' into feat/ADFA-4333
2 parents bbb15c5 + d7691c5 commit 9778d78

7 files changed

Lines changed: 23 additions & 20 deletions

File tree

‎app/src/main/java/com/itsaky/androidide/actions/debug/AbstractDebuggerAction.kt‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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+
}

‎app/src/main/java/com/itsaky/androidide/actions/debug/AbstractStepAction.kt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff 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+
}

‎app/src/main/java/com/itsaky/androidide/actions/debug/KillVmAction.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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+
}

‎app/src/main/java/com/itsaky/androidide/actions/debug/StepIntoAction.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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+
}

‎app/src/main/java/com/itsaky/androidide/actions/debug/StepOutAction.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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+
}

‎app/src/main/java/com/itsaky/androidide/actions/debug/StepOverAction.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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+
}

‎app/src/main/java/com/itsaky/androidide/actions/debug/SuspendResumeVmAction.kt‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff 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+
}

0 commit comments

Comments
 (0)