| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1861,23 +1861,13 @@ public void switchToTab(String tabFileName) { | |||
| 1861 | 1861 | * | |
| 1862 | 1862 | * @return the debugger controller object | |
| 1863 | 1863 | */ | |
| 1864 | - public Debugger dbg() { | ||
| 1864 | + public Debugger getDebugger() { | ||
| 1865 | 1865 | return dbg; | |
| 1866 | 1866 | } | |
| 1867 | 1867 | ||
| 1868 | 1868 | ||
| 1869 | - /** | ||
| 1870 | - * Access the mode. | ||
| 1871 | - * | ||
| 1872 | - * @return the mode object | ||
| 1873 | - */ | ||
| 1874 | - public JavaMode mode() { | ||
| 1875 | - return jmode; | ||
| 1876 | - } | ||
| 1877 | - | ||
| 1878 | 1869 | /** | |
| 1879 | 1870 | * Access the custom text area object. | |
| 1880 | - * | ||
| 1881 | 1871 | * @return the text area object | |
| 1882 | 1872 | */ | |
| 1883 | 1873 | public JavaTextArea textArea() { | |
@@ -2223,8 +2213,8 @@ protected void setCode(SketchCode code) { | |||
| 2223 | 2213 | } | |
| 2224 | 2214 | } | |
| 2225 | 2215 | } | |
| 2226 | - if (dbg() != null && dbg().isStarted()) { | ||
| 2227 | - dbg().startTrackingLineChanges(); | ||
| 2216 | + if (getDebugger() != null && getDebugger().isStarted()) { | ||
| 2217 | + getDebugger().startTrackingLineChanges(); | ||
| 2228 | 2218 | } | |
| 2229 | 2219 | } | |
| 2230 | 2220 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,12 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | 21 | package processing.mode.java.debug; | |
| 22 | 22 | ||
| 23 | - import java.awt.Color; | ||
| 24 | - import java.awt.Component; | ||
| 25 | - import java.awt.EventQueue; | ||
| 26 | - import java.awt.Font; | ||
| 27 | - import java.awt.Graphics; | ||
| 28 | - import java.awt.Image; | ||
| 23 | + import java.awt.*; | ||
| 29 | 24 | import java.awt.event.ComponentEvent; | |
| 30 | 25 | import java.awt.event.ComponentListener; | |
| 31 | 26 | import java.awt.image.BufferedImage; | |
@@ -36,44 +31,21 @@ | |||
| 36 | 31 | import java.util.logging.Level; | |
| 37 | 32 | import java.util.logging.Logger; | |
| 38 | 33 | ||
| 39 | - import javax.swing.DefaultCellEditor; | ||
| 40 | - import javax.swing.GrayFilter; | ||
| 41 | - import javax.swing.Icon; | ||
| 42 | - import javax.swing.ImageIcon; | ||
| 43 | - import javax.swing.JFrame; | ||
| 44 | - import javax.swing.JScrollPane; | ||
| 45 | - import javax.swing.JTable; | ||
| 46 | - import javax.swing.JTextField; | ||
| 47 | - import javax.swing.UIDefaults; | ||
| 48 | - import javax.swing.UIManager; | ||
| 34 | + import javax.swing.*; | ||
| 49 | 35 | import javax.swing.event.TreeExpansionEvent; | |
| 50 | 36 | import javax.swing.event.TreeExpansionListener; | |
| 51 | 37 | import javax.swing.table.TableColumn; | |
| 52 | - import javax.swing.tree.DefaultMutableTreeNode; | ||
| 53 | - import javax.swing.tree.DefaultTreeModel; | ||
| 54 | - import javax.swing.tree.ExpandVetoException; | ||
| 55 | - import javax.swing.tree.MutableTreeNode; | ||
| 56 | - import javax.swing.tree.TreeNode; | ||
| 57 | - import javax.swing.tree.TreePath; | ||
| 58 | - | ||
| 59 | - import org.netbeans.swing.outline.DefaultOutlineCellRenderer; | ||
| 60 | - import org.netbeans.swing.outline.DefaultOutlineModel; | ||
| 61 | - import org.netbeans.swing.outline.ExtTreeWillExpandListener; | ||
| 62 | - import org.netbeans.swing.outline.Outline; | ||
| 63 | - import org.netbeans.swing.outline.OutlineModel; | ||
| 64 | - import org.netbeans.swing.outline.RenderDataProvider; | ||
| 65 | - import org.netbeans.swing.outline.RowModel; | ||
| 38 | + import javax.swing.tree.*; | ||
| 39 | + | ||
| 40 | + import org.netbeans.swing.outline.*; | ||
| 66 | 41 | ||
| 67 | 42 | import com.sun.jdi.Value; | |
| 68 | 43 | ||
| 44 | + import processing.app.Mode; | ||
| 69 | 45 | import processing.mode.java.Debugger; | |
| 70 | 46 | import processing.mode.java.JavaEditor; | |
| 71 | - import processing.mode.java.JavaMode; | ||
| 72 | 47 | ||
| 73 | 48 | ||
| 74 | - /** | ||
| 75 | - * Variable Inspector window. | ||
| 76 | - */ | ||
| 77 | 49 | public class VariableInspector extends JFrame { | |
| 78 | 50 | /// the root node (invisible) | |
| 79 | 51 | protected DefaultMutableTreeNode rootNode; | |
@@ -84,7 +56,9 @@ public class VariableInspector extends JFrame { | |||
| 84 | 56 | /// data model for the tree column | |
| 85 | 57 | protected DefaultTreeModel treeModel; | |
| 86 | 58 | ||
| 87 | - /// data model for the whole Outline (tree and other columns) | ||
| 59 | + private JScrollPane scrollPane; | ||
| 60 | + | ||
| 61 | + protected Outline tree; | ||
| 88 | 62 | protected OutlineModel model; | |
| 89 | 63 | ||
| 90 | 64 | protected List<DefaultMutableTreeNode> callStack; | |
@@ -112,36 +86,11 @@ public class VariableInspector extends JFrame { | |||
| 112 | 86 | ||
| 113 | 87 | public VariableInspector(JavaEditor je) { | |
| 114 | 88 | editor = je; | |
| 115 | - dbg = editor.dbg(); | ||
| 89 | + dbg = editor.getDebugger(); | ||
| 116 | 90 | ||
| 117 | 91 | setUndecorated(true); | |
| 118 | 92 | ||
| 119 | - editor.addComponentListener(new ComponentListener() { | ||
| 120 | - | ||
| 121 | - @Override | ||
| 122 | - public void componentShown(ComponentEvent e) { } | ||
| 123 | - | ||
| 124 | - @Override | ||
| 125 | - public void componentResized(ComponentEvent e) { | ||
| 126 | - updateBounds(e); | ||
| 127 | - } | ||
| 128 | - | ||
| 129 | - @Override | ||
| 130 | - public void componentMoved(ComponentEvent e) { | ||
| 131 | - updateBounds(e); | ||
| 132 | - } | ||
| 133 | - | ||
| 134 | - @Override | ||
| 135 | - public void componentHidden(ComponentEvent e) { } | ||
| 136 | - | ||
| 137 | - private void updateBounds(ComponentEvent e) { | ||
| 138 | - // System.out.println(e); | ||
| 139 | - setBounds(editor.getX() + editor.getWidth(), | ||
| 140 | - editor.getY() + VERTICAL_OFFSET, | ||
| 141 | - getPreferredSize().width, | ||
| 142 | - editor.getHeight() - VERTICAL_OFFSET*2); | ||
| 143 | - } | ||
| 144 | - }); | ||
| 93 | + editor.addComponentListener(new EditorFollower()); | ||
| 145 | 94 | ||
| 146 | 95 | initComponents(); | |
| 147 | 96 | ||
@@ -175,6 +124,35 @@ private void updateBounds(ComponentEvent e) { | |||
| 175 | 124 | ||
| 176 | 125 | // this.setTitle(editor.getSketch().getName()); | |
| 177 | 126 | } | |
| 127 | + | ||
| 128 | + | ||
| 129 | + /** Keeps the debug window adjacent the editor at all times. */ | ||
| 130 | + class EditorFollower implements ComponentListener { | ||
| 131 | + | ||
| 132 | + @Override | ||
| 133 | + public void componentShown(ComponentEvent e) { } | ||
| 134 | + | ||
| 135 | + @Override | ||
| 136 | + public void componentHidden(ComponentEvent e) { } | ||
| 137 | + | ||
| 138 | + @Override | ||
| 139 | + public void componentResized(ComponentEvent e) { | ||
| 140 | + updateBounds(e); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + @Override | ||
| 144 | + public void componentMoved(ComponentEvent e) { | ||
| 145 | + updateBounds(e); | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + private void updateBounds(ComponentEvent e) { | ||
| 149 | + // System.out.println(e); | ||
| 150 | + setBounds(editor.getX() + editor.getWidth(), | ||
| 151 | + editor.getY() + VERTICAL_OFFSET, | ||
| 152 | + getPreferredSize().width, | ||
| 153 | + editor.getHeight() - VERTICAL_OFFSET*2); | ||
| 154 | + } | ||
| 155 | + } | ||
| 178 | 156 | ||
| 179 | 157 | ||
| 180 | 158 | // @Override | |
@@ -320,7 +298,7 @@ public OutlineRenderer() { | |||
| 320 | 298 | * null if the file wasn't found. | |
| 321 | 299 | */ | |
| 322 | 300 | protected ImageIcon[][] loadIcons(String fileName) { | |
| 323 | - JavaMode mode = editor.mode(); | ||
| 301 | + Mode mode = editor.getMode(); | ||
| 324 | 302 | File file = mode.getContentFile(fileName); | |
| 325 | 303 | if (!file.exists()) { | |
| 326 | 304 | Logger.getLogger(OutlineRenderer.class.getName()).log(Level.SEVERE, "icon file not found: {0}", file.getAbsolutePath()); | |
@@ -451,7 +429,7 @@ public Icon getIcon(Object o) { | |||
| 451 | 429 | } | |
| 452 | 430 | ||
| 453 | 431 | ||
| 454 | - // TODO: could probably extend the simpler javax.swing.table.DefaultTableCellRenderer here | ||
| 432 | + // TODO: could probably extend the simpler DefaultTableCellRenderer here | ||
| 455 | 433 | /** | |
| 456 | 434 | * Renderer for the value column. Uses an italic font for null values and | |
| 457 | 435 | * Object values ("instance of ..."). Uses a gray color when tree is not | |
@@ -582,35 +560,24 @@ public void treeExpansionVetoed(TreeExpansionEvent tee, ExpandVetoException eve) | |||
| 582 | 560 | } | |
| 583 | 561 | ||
| 584 | 562 | ||
| 585 | - /** | ||
| 586 | - * This method is called from within the constructor to initialize the form. | ||
| 587 | - * WARNING: Do NOT modify this code. The content of this method is always | ||
| 588 | - * regenerated by the Form Editor. | ||
| 589 | - */ | ||
| 590 | - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | ||
| 591 | - private void initComponents() { | ||
| 592 | - scrollPane = new JScrollPane(); | ||
| 593 | - tree = new Outline(); | ||
| 594 | - | ||
| 595 | - scrollPane.setViewportView(tree); | ||
| 596 | - | ||
| 597 | - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | ||
| 598 | - getContentPane().setLayout(layout); | ||
| 599 | - layout.setHorizontalGroup( | ||
| 600 | - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
| 601 | - .addGap(0, 400, Short.MAX_VALUE) | ||
| 602 | - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
| 603 | - .addComponent(scrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)) | ||
| 604 | - ); | ||
| 605 | - layout.setVerticalGroup( | ||
| 606 | - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
| 607 | - .addGap(0, 300, Short.MAX_VALUE) | ||
| 608 | - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
| 609 | - .addComponent(scrollPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)) | ||
| 610 | - ); | ||
| 611 | - | ||
| 612 | - pack(); | ||
| 613 | - }// </editor-fold>//GEN-END:initComponents | ||
| 563 | + private void initComponents() { | ||
| 564 | + scrollPane = new JScrollPane(); | ||
| 565 | + tree = new Outline(); | ||
| 566 | + | ||
| 567 | + scrollPane.setViewportView(tree); | ||
| 568 | + | ||
| 569 | + GroupLayout layout = new GroupLayout(getContentPane()); | ||
| 570 | + getContentPane().setLayout(layout); | ||
| 571 | + layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) | ||
| 572 | + .addGap(0, 400, Short.MAX_VALUE) | ||
| 573 | + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) | ||
| 574 | + .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE))); | ||
| 575 | + layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) | ||
| 576 | + .addGap(0, 300, Short.MAX_VALUE) | ||
| 577 | + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) | ||
| 578 | + .addComponent(scrollPane, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE))); | ||
| 579 | + pack(); | ||
| 580 | + } | ||
| 614 | 581 | ||
| 615 | 582 | ||
| 616 | 583 | protected static void run(final VariableInspector vi) { | |
@@ -621,10 +588,6 @@ public void run() { | |||
| 621 | 588 | } | |
| 622 | 589 | }); | |
| 623 | 590 | } | |
| 624 | - // Variables declaration - do not modify//GEN-BEGIN:variables | ||
| 625 | - private javax.swing.JScrollPane scrollPane; | ||
| 626 | - protected org.netbeans.swing.outline.Outline tree; | ||
| 627 | - // End of variables declaration//GEN-END:variables | ||
| 628 | 591 | ||
| 629 | 592 | ||
| 630 | 593 | public DefaultMutableTreeNode getRootNode() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -429,7 +429,7 @@ protected void loadJavaDoc() { | |||
| 429 | 429 | ||
| 430 | 430 | @Override | |
| 431 | 431 | public void run() { | |
| 432 | - JavadocHelper.loadJavaDoc(jdocMap, editor.mode().getReferenceFolder()); | ||
| 432 | + JavadocHelper.loadJavaDoc(jdocMap, editor.getMode().getReferenceFolder()); | ||
| 433 | 433 | } | |
| 434 | 434 | }); | |
| 435 | 435 | t.start(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments