mirror of
https://github.com/processing/processing4.git
synced 2026-01-30 03:41:15 +01:00
move Debugger and VariableInspector into the debug package
This commit is contained in:
@@ -48,6 +48,7 @@ import processing.app.syntax.PdeTextArea;
|
||||
import processing.app.syntax.PdeTextAreaDefaults;
|
||||
import processing.app.ui.*;
|
||||
import processing.app.ui.Toolkit;
|
||||
import processing.mode.java.debug.Debugger;
|
||||
import processing.mode.java.debug.LineBreakpoint;
|
||||
import processing.mode.java.debug.LineHighlight;
|
||||
import processing.mode.java.debug.LineID;
|
||||
@@ -1806,7 +1807,7 @@ public class JavaEditor extends Editor {
|
||||
}
|
||||
|
||||
|
||||
protected void activateRun() {
|
||||
public void activateRun() {
|
||||
debugger.enableMenuItem(false);
|
||||
toolbar.activateRun();
|
||||
}
|
||||
@@ -1824,32 +1825,34 @@ public class JavaEditor extends Editor {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
protected void activateDebug() {
|
||||
activateRun();
|
||||
}
|
||||
|
||||
|
||||
protected void deactivateDebug() {
|
||||
public void deactivateDebug() {
|
||||
deactivateRun();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
protected void activateContinue() {
|
||||
public void activateContinue() {
|
||||
((JavaToolbar) toolbar).activateContinue();
|
||||
}
|
||||
|
||||
|
||||
protected void deactivateContinue() {
|
||||
public void deactivateContinue() {
|
||||
((JavaToolbar) toolbar).deactivateContinue();
|
||||
}
|
||||
|
||||
|
||||
protected void activateStep() {
|
||||
public void activateStep() {
|
||||
((JavaToolbar) toolbar).activateStep();
|
||||
}
|
||||
|
||||
|
||||
protected void deactivateStep() {
|
||||
public void deactivateStep() {
|
||||
((JavaToolbar) toolbar).deactivateStep();
|
||||
}
|
||||
|
||||
@@ -2035,7 +2038,7 @@ public class JavaEditor extends Editor {
|
||||
* Retrieve line of sketch where the cursor currently resides.
|
||||
* @return the current {@link LineID}
|
||||
*/
|
||||
protected LineID getCurrentLineID() {
|
||||
public LineID getCurrentLineID() {
|
||||
String tab = getSketch().getCurrentCode().getFileName();
|
||||
int lineNo = getTextArea().getCaretLine();
|
||||
return new LineID(tab, lineNo);
|
||||
|
||||
@@ -31,6 +31,7 @@ import processing.app.Language;
|
||||
import processing.app.ui.Editor;
|
||||
import processing.app.ui.EditorButton;
|
||||
import processing.app.ui.EditorToolbar;
|
||||
import processing.mode.java.debug.Debugger;
|
||||
|
||||
|
||||
public class JavaToolbar extends EditorToolbar {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package processing.mode.java;
|
||||
package processing.mode.java.debug;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.event.*;
|
||||
@@ -51,7 +51,8 @@ import processing.app.RunnerListenerEdtAdapter;
|
||||
import processing.app.Sketch;
|
||||
import processing.app.SketchCode;
|
||||
import processing.app.ui.Toolkit;
|
||||
import processing.mode.java.debug.*;
|
||||
import processing.mode.java.JavaBuild;
|
||||
import processing.mode.java.JavaEditor;
|
||||
import processing.mode.java.runner.Runner;
|
||||
|
||||
|
||||
@@ -120,7 +121,7 @@ public class Debugger {
|
||||
*
|
||||
* @return The debug menu
|
||||
*/
|
||||
protected JMenu buildMenu() {
|
||||
public JMenu buildMenu() {
|
||||
debugMenu = new JMenu(Language.text("menu.debug"));
|
||||
JMenuItem item;
|
||||
|
||||
@@ -181,7 +182,8 @@ public class Debugger {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Messages.log("Invoked 'Toggle Breakpoint' menu item");
|
||||
// TODO wouldn't getCaretLine() do the same thing with less effort?
|
||||
toggleBreakpoint(editor.getCurrentLineID().lineIdx());
|
||||
//toggleBreakpoint(editor.getCurrentLineID().lineIdx());
|
||||
toggleBreakpoint(editor.getTextArea().getCaretLine());
|
||||
}
|
||||
});
|
||||
debugMenu.add(item);
|
||||
@@ -191,12 +193,12 @@ public class Debugger {
|
||||
}
|
||||
|
||||
|
||||
void enableMenuItem(boolean enabled) {
|
||||
public void enableMenuItem(boolean enabled) {
|
||||
debugItem.setEnabled(enabled);
|
||||
}
|
||||
|
||||
|
||||
boolean isEnabled() {
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@@ -327,7 +329,8 @@ public class Debugger {
|
||||
editor.prepareRun();
|
||||
|
||||
// after prepareRun, since this removes highlights
|
||||
editor.activateDebug();
|
||||
//editor.activateDebug();
|
||||
editor.activateRun();
|
||||
|
||||
try {
|
||||
Sketch sketch = editor.getSketch();
|
||||
@@ -393,7 +396,8 @@ public class Debugger {
|
||||
stopTrackingLineChanges();
|
||||
started = false;
|
||||
|
||||
editor.deactivateDebug();
|
||||
//editor.deactivateDebug();
|
||||
editor.deactivateRun();
|
||||
editor.deactivateContinue();
|
||||
editor.deactivateStep();
|
||||
|
||||
@@ -516,7 +520,7 @@ public class Debugger {
|
||||
}
|
||||
|
||||
|
||||
synchronized void setBreakpoint(LineID line) {
|
||||
synchronized public void setBreakpoint(LineID line) {
|
||||
// do nothing if we are kinda busy
|
||||
if (isStarted() && !isPaused()) {
|
||||
return;
|
||||
@@ -578,7 +582,7 @@ public class Debugger {
|
||||
* Clear breakpoints in a specific tab.
|
||||
* @param tabFilename the tab's file name
|
||||
*/
|
||||
synchronized void clearBreakpoints(String tabFilename) {
|
||||
synchronized public void clearBreakpoints(String tabFilename) {
|
||||
// TODO: handle busy-ness correctly
|
||||
if (isBusy()) {
|
||||
log("busy");
|
||||
@@ -616,7 +620,7 @@ public class Debugger {
|
||||
* Toggle a breakpoint on a line in the current tab.
|
||||
* @param lineIdx the line index (0-based) in the current tab
|
||||
*/
|
||||
synchronized void toggleBreakpoint(int lineIdx) {
|
||||
synchronized public void toggleBreakpoint(int lineIdx) {
|
||||
LineID line = editor.getLineIDInCurrentTab(lineIdx);
|
||||
int index = line.lineIdx();
|
||||
if (hasBreakpoint(line)) {
|
||||
@@ -660,7 +664,7 @@ public class Debugger {
|
||||
* @param tabFilename the tab's file name
|
||||
* @return the list of breakpoints in the given tab
|
||||
*/
|
||||
synchronized List<LineBreakpoint> getBreakpoints(String tabFilename) {
|
||||
synchronized public List<LineBreakpoint> getBreakpoints(String tabFilename) {
|
||||
List<LineBreakpoint> list = new ArrayList<>();
|
||||
for (LineBreakpoint bp : breakpoints) {
|
||||
if (bp.lineID().fileName().equals(tabFilename)) {
|
||||
@@ -763,7 +767,7 @@ public class Debugger {
|
||||
currentThread = be.thread(); // save this thread
|
||||
updateVariableInspector(currentThread); // this is already on the EDT
|
||||
final LineID newCurrentLine = locationToLineID(be.location());
|
||||
javax.swing.SwingUtilities.invokeLater(new Runnable() {
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
editor.setCurrentLine(newCurrentLine);
|
||||
@@ -1508,7 +1512,7 @@ public class Debugger {
|
||||
|
||||
|
||||
/** Start tracking all line changes (due to edits) in the current tab. */
|
||||
protected void startTrackingLineChanges() {
|
||||
public void startTrackingLineChanges() {
|
||||
// TODO: maybe move this to the editor?
|
||||
SketchCode tab = editor.getSketch().getCurrentCode();
|
||||
if (runtimeTabsTracked.contains(tab.getFileName())) {
|
||||
@@ -24,7 +24,6 @@ package processing.mode.java.debug;
|
||||
import java.util.List;
|
||||
|
||||
import processing.app.Messages;
|
||||
import processing.mode.java.Debugger;
|
||||
|
||||
import com.sun.jdi.AbsentInformationException;
|
||||
import com.sun.jdi.Location;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package processing.mode.java;
|
||||
package processing.mode.java.debug;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
@@ -40,7 +40,7 @@ import com.sun.jdi.Value;
|
||||
import processing.app.Language;
|
||||
import processing.app.Messages;
|
||||
import processing.app.Mode;
|
||||
import processing.mode.java.debug.VariableNode;
|
||||
import processing.mode.java.JavaEditor;
|
||||
|
||||
|
||||
public class VariableInspector extends JDialog {
|
||||
Reference in New Issue
Block a user