|
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: |
|
0 commit comments