|
23 | 23 | import java.awt.GraphicsDevice; |
24 | 24 | import java.awt.GraphicsEnvironment; |
25 | 25 | import java.awt.Rectangle; |
26 | | -import java.awt.event.ActionEvent; |
27 | 26 | import java.awt.event.ComponentAdapter; |
28 | 27 | import java.awt.event.ComponentEvent; |
29 | 28 | import java.awt.event.InputEvent; |
|
89 | 88 |
|
90 | 89 | import static processing.mode.java.pdex.ASTUtils.*; |
91 | 90 |
|
| 91 | + |
92 | 92 | public class PDEX { |
93 | 93 |
|
94 | 94 | private static final boolean SHOW_DEBUG_TREE = false; |
@@ -188,7 +188,6 @@ public void documentChanged(Document newDoc) { |
188 | 188 |
|
189 | 189 |
|
190 | 190 | private class InspectMode { |
191 | | - |
192 | 191 | boolean inspectModeEnabled; |
193 | 192 |
|
194 | 193 | boolean isMouse1Down; |
@@ -279,16 +278,17 @@ public void keyReleased(KeyEvent e) { |
279 | 278 | inspectModeEnabled = inspectModeEnabled && isHotkeyDown; |
280 | 279 | } |
281 | 280 | }); |
282 | | - |
283 | 281 | } |
284 | 282 |
|
| 283 | + |
285 | 284 | void handleInspect() { |
286 | 285 | int off = editor.getSelectionStart(); |
287 | 286 | int tabIndex = editor.getSketch().getCurrentCodeIndex(); |
288 | 287 |
|
289 | 288 | pps.whenDoneBlocking(ps -> handleInspect(ps, tabIndex, off)); |
290 | 289 | } |
291 | 290 |
|
| 291 | + |
292 | 292 | // Thread: EDT |
293 | 293 | void handleInspect(MouseEvent evt) { |
294 | 294 | int off = editor.getJavaTextArea().xyToOffset(evt.getX(), evt.getY()); |
@@ -352,13 +352,10 @@ private void handleInspect(PreprocessedSketch ps, int tabIndex, int offset) { |
352 | 352 | void dispose() { |
353 | 353 | // Nothing to do |
354 | 354 | } |
355 | | - |
356 | 355 | } |
357 | 356 |
|
358 | 357 |
|
359 | | - |
360 | | - private static class ShowUsage { |
361 | | - |
| 358 | + static private class ShowUsage { |
362 | 359 | final JDialog window; |
363 | 360 | final JTree tree; |
364 | 361 |
|
@@ -595,12 +592,10 @@ void dispose() { |
595 | 592 | window.dispose(); |
596 | 593 | } |
597 | 594 | } |
598 | | - |
599 | 595 | } |
600 | 596 |
|
601 | 597 |
|
602 | | - private static class ShowUsageTreeNode { |
603 | | - |
| 598 | + static private class ShowUsageTreeNode { |
604 | 599 | final int tabIndex; |
605 | 600 | final int startTabOffset; |
606 | 601 | final int stopTabOffset; |
@@ -902,7 +897,6 @@ void rename(PreprocessedSketch ps, IBinding binding, String newName) { |
902 | 897 | int offsetDiff = precedingIntervals * intervalLengthDiff; |
903 | 898 |
|
904 | 899 | editor.getTextArea().setCaretPosition(currentOffset + offsetDiff); |
905 | | - |
906 | 900 | } |
907 | 901 |
|
908 | 902 |
|
@@ -911,16 +905,12 @@ void dispose() { |
911 | 905 | window.dispose(); |
912 | 906 | } |
913 | 907 | } |
914 | | - |
915 | 908 | } |
916 | 909 |
|
917 | 910 |
|
918 | | - |
919 | | - private static class DebugTree { |
920 | | - |
| 911 | + static private class DebugTree { |
921 | 912 | final JDialog window; |
922 | 913 | final JTree tree; |
923 | | - |
924 | 914 | final Consumer<PreprocessedSketch> updateListener; |
925 | 915 |
|
926 | 916 |
|
@@ -1030,13 +1020,10 @@ public void postVisit(ASTNode node) { |
1030 | 1020 | } |
1031 | 1021 | }); |
1032 | 1022 | } |
1033 | | - |
1034 | 1023 | } |
1035 | 1024 |
|
1036 | 1025 |
|
1037 | | - |
1038 | | - private static class ErrorChecker { |
1039 | | - |
| 1026 | + static private class ErrorChecker { |
1040 | 1027 | // Delay delivering error check result after last sketch change #2677 |
1041 | 1028 | private final static long DELAY_BEFORE_UPDATE = 650; |
1042 | 1029 |
|
@@ -1181,6 +1168,7 @@ static private boolean isUndefinedTypeProblem(IProblem iproblem) { |
1181 | 1168 | id == IProblem.UnresolvedVariable; |
1182 | 1169 | } |
1183 | 1170 |
|
| 1171 | + |
1184 | 1172 | static private boolean isMissingBraceProblem(IProblem iproblem) { |
1185 | 1173 | switch (iproblem.getID()) { |
1186 | 1174 | case IProblem.ParsingErrorInsertToComplete: { |
@@ -1197,7 +1185,7 @@ static private boolean isMissingBraceProblem(IProblem iproblem) { |
1197 | 1185 | } |
1198 | 1186 |
|
1199 | 1187 |
|
1200 | | - public static String[] getImportSuggestions(ClassPath cp, String className) { |
| 1188 | + static public String[] getImportSuggestions(ClassPath cp, String className) { |
1201 | 1189 | RegExpResourceFilter regf = new RegExpResourceFilter( |
1202 | 1190 | Pattern.compile(".*"), |
1203 | 1191 | Pattern.compile("(.*\\$)?" + className + "\\.class", |
@@ -1224,6 +1212,5 @@ public static String[] getImportSuggestions(ClassPath cp, String className) { |
1224 | 1212 | }) |
1225 | 1213 | .toArray(String[]::new); |
1226 | 1214 | } |
1227 | | - |
1228 | 1215 | } |
1229 | 1216 | } |