23
23
24
24
import com .sun .jdi .*;
25
25
import com .sun .jdi .event .*;
26
+ import com .sun .jdi .event .Event ;
26
27
import com .sun .jdi .request .ClassPrepareRequest ;
27
28
import com .sun .jdi .request .EventRequestManager ;
28
29
import com .sun .jdi .request .StepRequest ;
30
+ import processing .app .Language ;
29
31
import processing .app .Messages ;
30
- import processing .mode .java .debug .Debugger ;
31
- import processing .mode .java .debug .ClassLoadListener ;
32
- import processing .mode .java .debug .LineBreakpoint ;
33
- import processing .mode .java .debug .LineID ;
32
+ import processing .mode .java .debug .*;
34
33
34
+ import javax .swing .*;
35
+ import java .awt .*;
35
36
import java .io .IOException ;
36
37
37
38
// Developed by Manav Jain as part of GSoC 2018
@@ -43,6 +44,7 @@ public class AndroidDebugger extends Debugger {
43
44
44
45
protected boolean isEnabled ;
45
46
47
+
46
48
private String pkgName = "" ;
47
49
private String sketchClassName = "" ;
48
50
@@ -58,6 +60,19 @@ public boolean isEnabled() {
58
60
59
61
public void toggleDebug () {
60
62
isEnabled = !isEnabled ;
63
+ inspector .setVisible (enabled );
64
+ if (isEnabled ) {
65
+ debugItem .setText (Language .text ("menu.debug.disable" ));
66
+ } else {
67
+ debugItem .setText (Language .text ("menu.debug.enable" ));
68
+ }
69
+
70
+ for (Component item : debugMenu .getMenuComponents ()) {
71
+ if (item instanceof JMenuItem && item != debugItem ) {
72
+ item .setEnabled (isEnabled );
73
+ }
74
+ }
75
+
61
76
}
62
77
63
78
@ Override
@@ -71,6 +86,8 @@ public synchronized void startDebug(AndroidRunner runner, Device device) {
71
86
return ; // do nothing
72
87
}
73
88
89
+ inspector .reset ();
90
+
74
91
runtime = runner ;
75
92
pkgName = runner .build .getPackageName ();
76
93
sketchClassName = runner .build .getSketchClassName ();
@@ -222,10 +239,10 @@ public void run() {
222
239
}
223
240
}
224
241
225
- /*
242
+
226
243
@ Override public synchronized void continueDebug () {
227
244
editor .activateContinue ();
228
- editor.variableInspector() .lock();
245
+ inspector .lock ();
229
246
//editor.clearSelection();
230
247
//clearHighlight();
231
248
editor .clearCurrentLine ();
@@ -237,14 +254,14 @@ public void run() {
237
254
editor .statusBusy ();
238
255
}
239
256
}
240
- */
241
257
242
- /*
258
+
259
+
243
260
@ Override protected void step (int stepDepth ) {
244
261
if (!isStarted ()) {
245
262
startDebug ();
246
263
} else if (isPaused ()) {
247
- editor.variableInspector() .lock();
264
+ inspector .lock ();
248
265
editor .activateStep ();
249
266
250
267
// use global to mark that there is a step request pending
@@ -256,11 +273,11 @@ public void run() {
256
273
editor .statusBusy ();
257
274
}
258
275
}
259
- */
260
276
261
- /*
277
+
278
+
262
279
@ Override public synchronized void stopDebug () {
263
- editor.variableInspector() .lock();
280
+ inspector .lock ();
264
281
if (runtime != null ) {
265
282
266
283
for (LineBreakpoint bp : breakpoints ) {
@@ -277,13 +294,13 @@ public void run() {
277
294
stopTrackingLineChanges ();
278
295
started = false ;
279
296
280
- editor.deactivateDebug();
297
+ // editor.deactivateDebug();
281
298
editor .deactivateContinue ();
282
299
editor .deactivateStep ();
283
300
284
301
editor .statusEmpty ();
285
302
}
286
- */
303
+
287
304
288
305
/**
289
306
* Watch all classes ({@value sketchClassName}) variable
0 commit comments