| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5d17214 commit c28ef4f
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,6 +29,8 @@ | |||
| 29 | 29 | import java.util.logging.Level; | |
| 30 | 30 | import java.util.logging.Logger; | |
| 31 | 31 | ||
| 32 | + import javax.swing.ImageIcon; | ||
| 33 | + | ||
| 32 | 34 | import processing.app.*; | |
| 33 | 35 | import processing.mode.java.runner.Runner; | |
| 34 | 36 | import processing.mode.java.tweak.SketchParser; | |
@@ -46,6 +48,17 @@ public JavaMode(Base base, File folder) { | |||
| 46 | 48 | ||
| 47 | 49 | initLogger(); | |
| 48 | 50 | loadPreferences(); | |
| 51 | + loadIcons(); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * Needed by code completion panel. See {@link processing.mode.java.pdex.CompletionPanel} | ||
| 56 | + */ | ||
| 57 | + private void loadIcons(){ | ||
| 58 | + classIcon = loadIcon("theme/icon_class_obj.png"); | ||
| 59 | + methodIcon = loadIcon("theme/icon_methpub_obj.png"); | ||
| 60 | + fieldIcon = loadIcon("theme/icon_field_protected_obj.png"); | ||
| 61 | + localVarIcon = loadIcon("theme/icon_field_default_obj.png"); | ||
| 49 | 62 | } | |
| 50 | 63 | ||
| 51 | 64 | ||
@@ -316,6 +329,11 @@ void initLogger() { | |||
| 316 | 329 | static public final String prefImportSuggestEnabled = "pdex.importSuggestEnabled"; | |
| 317 | 330 | ||
| 318 | 331 | static volatile public boolean enableTweak = false; | |
| 332 | + | ||
| 333 | + static public ImageIcon classIcon; | ||
| 334 | + static public ImageIcon fieldIcon; | ||
| 335 | + static public ImageIcon methodIcon; | ||
| 336 | + static public ImageIcon localVarIcon; | ||
| 319 | 337 | ||
| 320 | 338 | ||
| 321 | 339 | public void loadPreferences() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,6 +54,7 @@ | |||
| 54 | 54 | import processing.app.Mode; | |
| 55 | 55 | import processing.app.syntax.JEditTextArea; | |
| 56 | 56 | import processing.mode.java.JavaEditor; | |
| 57 | + import processing.mode.java.JavaMode; | ||
| 57 | 58 | ||
| 58 | 59 | ||
| 59 | 60 | /** | |
@@ -93,9 +94,6 @@ public class CompletionPanel { | |||
| 93 | 94 | ||
| 94 | 95 | public static final int MOUSE_COMPLETION = 10, KEYBOARD_COMPLETION = 20; | |
| 95 | 96 | ||
| 96 | - ImageIcon classIcon, fieldIcon, methodIcon, localVarIcon; | ||
| 97 | - | ||
| 98 | - | ||
| 99 | 97 | /** | |
| 100 | 98 | * Triggers the completion popup | |
| 101 | 99 | * @param textarea | |
@@ -129,11 +127,6 @@ public CompletionPanel(final JEditTextArea textarea, int position, String subWor | |||
| 129 | 127 | + location.y); | |
| 130 | 128 | //log("Suggestion shown: " + System.currentTimeMillis()); | |
| 131 | 129 | ||
| 132 | - Mode mode = editor.getMode(); | ||
| 133 | - classIcon = mode.loadIcon("theme/icon_class_obj.png"); | ||
| 134 | - methodIcon = mode.loadIcon("theme/icon_methpub_obj.png"); | ||
| 135 | - fieldIcon = mode.loadIcon("theme/icon_field_protected_obj.png"); | ||
| 136 | - localVarIcon = mode.loadIcon("theme/icon_field_default_obj.png"); | ||
| 137 | 130 | } | |
| 138 | 131 | ||
| 139 | 132 | private void styleScrollPane() { | |
@@ -210,7 +203,7 @@ private int calcHeight(int itemCount) { | |||
| 210 | 203 | int maxHeight = 250; | |
| 211 | 204 | FontMetrics fm = textarea.getGraphics().getFontMetrics(); | |
| 212 | 205 | float itemHeight = Math.max((fm.getHeight() + (fm.getDescent()) * 0.5f), | |
| 213 | - classIcon.getIconHeight() * 1.2f); | ||
| 206 | + JavaMode.classIcon.getIconHeight() * 1.2f); | ||
| 214 | 207 | ||
| 215 | 208 | if (horizontalScrollBarVisible) | |
| 216 | 209 | itemCount++; | |
@@ -244,7 +237,7 @@ private int calcWidth() { | |||
| 244 | 237 | int w = Math.min((int) min, maxWidth); | |
| 245 | 238 | if(w == maxWidth) | |
| 246 | 239 | horizontalScrollBarVisible = true; | |
| 247 | - w += classIcon.getIconWidth(); // add icon width too! | ||
| 240 | + w += JavaMode.classIcon.getIconWidth(); // add icon width too! | ||
| 248 | 241 | w += fm.stringWidth(" "); // a bit of offset | |
| 249 | 242 | //log("popup width " + w); | |
| 250 | 243 | return w; // popup menu width | |
@@ -556,19 +549,19 @@ public Component getListCellRendererComponent(JList<?> list, Object value, | |||
| 556 | 549 | CompletionCandidate cc = (CompletionCandidate) value; | |
| 557 | 550 | switch (cc.getType()) { | |
| 558 | 551 | case CompletionCandidate.LOCAL_VAR: | |
| 559 | - label.setIcon(localVarIcon); | ||
| 552 | + label.setIcon(JavaMode.localVarIcon); | ||
| 560 | 553 | break; | |
| 561 | 554 | case CompletionCandidate.LOCAL_FIELD: | |
| 562 | 555 | case CompletionCandidate.PREDEF_FIELD: | |
| 563 | - label.setIcon(fieldIcon); | ||
| 556 | + label.setIcon(JavaMode.fieldIcon); | ||
| 564 | 557 | break; | |
| 565 | 558 | case CompletionCandidate.LOCAL_METHOD: | |
| 566 | 559 | case CompletionCandidate.PREDEF_METHOD: | |
| 567 | - label.setIcon(methodIcon); | ||
| 560 | + label.setIcon(JavaMode.methodIcon); | ||
| 568 | 561 | break; | |
| 569 | 562 | case CompletionCandidate.LOCAL_CLASS: | |
| 570 | 563 | case CompletionCandidate.PREDEF_CLASS: | |
| 571 | - label.setIcon(classIcon); | ||
| 564 | + label.setIcon(JavaMode.classIcon); | ||
| 572 | 565 | break; | |
| 573 | 566 | ||
| 574 | 567 | default: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -87,12 +87,12 @@ public static String getSimplifiedErrorMessage(Problem problem) { | |||
| 87 | 87 | return null; | |
| 88 | 88 | IProblem iprob = problem.getIProblem(); | |
| 89 | 89 | String args[] = iprob.getArguments(); | |
| 90 | - Base.log("Simplifying message: " + problem.getMessage() + " ID: " | ||
| 91 | - + getIDName(iprob.getID())); | ||
| 92 | - Base.log("Arg count: " + args.length); | ||
| 93 | - for (int i = 0; i < args.length; i++) { | ||
| 94 | - Base.log("Arg " + args[i]); | ||
| 95 | - } | ||
| 90 | + // Base.log("Simplifying message: " + problem.getMessage() + " ID: " | ||
| 91 | + // + getIDName(iprob.getID())); | ||
| 92 | + // Base.log("Arg count: " + args.length); | ||
| 93 | + // for (int i = 0; i < args.length; i++) { | ||
| 94 | + // Base.log("Arg " + args[i]); | ||
| 95 | + // } | ||
| 96 | 96 | ||
| 97 | 97 | String result = null; | |
| 98 | 98 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments