| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,8 +53,8 @@ public class Base { | |||
| 53 | 53 | // static private boolean RELEASE = false; | |
| 54 | 54 | ||
| 55 | 55 | /** True if heavy debugging error/log messages are enabled */ | |
| 56 | - // static public boolean DEBUG = false; | ||
| 57 | - static public boolean DEBUG = true; | ||
| 56 | + static public boolean DEBUG = false; | ||
| 57 | + // static public boolean DEBUG = true; | ||
| 58 | 58 | ||
| 59 | 59 | static HashMap<Integer, String> platformNames = | |
| 60 | 60 | new HashMap<Integer, String>(); | |
@@ -2235,7 +2235,7 @@ static public File getContentFile(String name) { | |||
| 2235 | 2235 | // Path may have URL encoding, so remove it | |
| 2236 | 2236 | String decodedPath = PApplet.urlDecode(path); | |
| 2237 | 2237 | ||
| 2238 | - if (decodedPath.contains("/app/bin")) { | ||
| 2238 | + if (decodedPath.contains("/app/bin")) { // This means we're in Eclipse | ||
| 2239 | 2239 | if (Base.isMacOS()) { | |
| 2240 | 2240 | processingRoot = | |
| 2241 | 2241 | new File(path, "../../build/macosx/work/Processing.app/Contents/Java"); | |
@@ -2252,11 +2252,9 @@ static public File getContentFile(String name) { | |||
| 2252 | 2252 | // This works for Windows, Linux, and Apple's Java 6 on OS X. | |
| 2253 | 2253 | processingRoot = jarFolder.getParentFile(); | |
| 2254 | 2254 | } else if (Base.isMacOS()) { | |
| 2255 | - // This works for Java 7 on OS X. The 'lib' folder is not part of the | ||
| 2256 | - // classpath on OS X, and adding it creates more problems than it's | ||
| 2257 | - // worth. | ||
| 2255 | + // This works for Java 8 on OS X. We don't have things inside a 'lib' | ||
| 2256 | + // folder on OS X. Adding it caused more problems than it was worth. | ||
| 2258 | 2257 | processingRoot = jarFolder; | |
| 2259 | - | ||
| 2260 | 2258 | } | |
| 2261 | 2259 | if (processingRoot == null || !processingRoot.exists()) { | |
| 2262 | 2260 | // Try working directory instead (user.dir, different from user.home) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -304,7 +304,28 @@ protected ArrayList<ToolContribution> getCoreTools() { | |||
| 304 | 304 | * solution where the listeners are handled properly. | |
| 305 | 305 | */ | |
| 306 | 306 | protected JEditTextArea createTextArea() { | |
| 307 | - return new JEditTextArea(new PdeTextAreaDefaults(mode)); | ||
| 307 | + return new JEditTextArea(new PdeTextAreaDefaults(mode)) { | ||
| 308 | + // this is a kludge that needs to be removed [fry 150120] | ||
| 309 | + public void processKeyEvent(KeyEvent evt) { | ||
| 310 | + // this had to be added in Processing 007X, because the menu key | ||
| 311 | + // events weren't making it up to the frame. | ||
| 312 | + super.processKeyEvent(evt); | ||
| 313 | + | ||
| 314 | + if (inputHandler != null) { | ||
| 315 | + switch (evt.getID()) { | ||
| 316 | + case KeyEvent.KEY_TYPED: | ||
| 317 | + inputHandler.keyTyped(evt); | ||
| 318 | + break; | ||
| 319 | + case KeyEvent.KEY_PRESSED: | ||
| 320 | + inputHandler.keyPressed(evt); | ||
| 321 | + break; | ||
| 322 | + case KeyEvent.KEY_RELEASED: | ||
| 323 | + inputHandler.keyReleased(evt); | ||
| 324 | + break; | ||
| 325 | + } | ||
| 326 | + } | ||
| 327 | + } | ||
| 328 | + }; | ||
| 308 | 329 | } | |
| 309 | 330 | ||
| 310 | 331 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -725,8 +725,8 @@ static private Font createFont(String filename, int size) throws IOException, Fo | |||
| 725 | 725 | if (!fontFile.exists()) { | |
| 726 | 726 | // if we're debugging from Eclipse, grab it from the work folder (user.dir is /app) | |
| 727 | 727 | //fontFile = new File(System.getProperty("user.dir"), "../build/shared/lib/fonts/" + filename); | |
| 728 | - // if we're debugging Java Mode from Eclipse, user.dir is the work folder | ||
| 729 | - fontFile = new File(System.getProperty("user.dir"), "../../build/shared/lib/fonts/" + filename); | ||
| 728 | + // if we're debugging the new Java Mode from Eclipse, paths are different | ||
| 729 | + fontFile = new File(System.getProperty("user.dir"), "../../shared/lib/fonts/" + filename); | ||
| 730 | 730 | } | |
| 731 | 731 | BufferedInputStream input = new BufferedInputStream(new FileInputStream(fontFile)); | |
| 732 | 732 | Font font = Font.createFont(Font.TRUETYPE_FONT, input); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1962,8 +1962,9 @@ public void processKeyEvent(KeyEvent evt) { | |||
| 1962 | 1962 | break; | |
| 1963 | 1963 | } | |
| 1964 | 1964 | } | |
| 1965 | - */ | ||
| 1965 | + */ | ||
| 1966 | 1966 | ||
| 1967 | + | ||
| 1967 | 1968 | // protected members | |
| 1968 | 1969 | protected static String CENTER = "center"; | |
| 1969 | 1970 | protected static String RIGHT = "right"; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,6 +81,7 @@ | |||
| 81 | 81 | import processing.app.syntax.PdeTextAreaDefaults; | |
| 82 | 82 | import processing.core.PApplet; | |
| 83 | 83 | import processing.mode.java.JavaEditor; | |
| 84 | + import processing.mode.java.PdeKeyListener; | ||
| 84 | 85 | import processing.mode.java.pdex.ErrorBar; | |
| 85 | 86 | import processing.mode.java.pdex.ErrorCheckerService; | |
| 86 | 87 | import processing.mode.java.pdex.ErrorMessageSimplifier; | |
@@ -1297,11 +1298,44 @@ public void toggleVariableInspector() { | |||
| 1297 | 1298 | * @return the customized text area object | |
| 1298 | 1299 | */ | |
| 1299 | 1300 | @Override | |
| 1301 | + // protected JEditTextArea createTextArea() { | ||
| 1302 | + // //System.out.println("overriding creation of text area"); | ||
| 1303 | + // return new TextArea(new PdeTextAreaDefaults(mode), this); | ||
| 1304 | + // } | ||
| 1300 | 1305 | protected JEditTextArea createTextArea() { | |
| 1301 | - //System.out.println("overriding creation of text area"); | ||
| 1302 | - return new TextArea(new PdeTextAreaDefaults(mode), this); | ||
| 1306 | + return new TextArea(new PdeTextAreaDefaults(mode), this) { | ||
| 1307 | + // Forwards key events directly to the input handler. This is slightly | ||
| 1308 | + // faster than using a KeyListener because some Swing overhead is avoided. | ||
| 1309 | + PdeKeyListener editorListener = new PdeKeyListener(DebugEditor.this, this); | ||
| 1310 | + | ||
| 1311 | + // Moved out of JEditTextArea for 3.0a6 to remove dependency on Java Mode | ||
| 1312 | + public void processKeyEvent(KeyEvent evt) { | ||
| 1313 | + // this had to be added in Processing 007X, because the menu key | ||
| 1314 | + // events weren't making it up to the frame. | ||
| 1315 | + super.processKeyEvent(evt); | ||
| 1316 | + | ||
| 1317 | + if (inputHandler != null) { | ||
| 1318 | + switch (evt.getID()) { | ||
| 1319 | + case KeyEvent.KEY_TYPED: | ||
| 1320 | + if ((editorListener == null) || !editorListener.keyTyped(evt)) { | ||
| 1321 | + inputHandler.keyTyped(evt); | ||
| 1322 | + } | ||
| 1323 | + break; | ||
| 1324 | + case KeyEvent.KEY_PRESSED: | ||
| 1325 | + if ((editorListener == null) || !editorListener.keyPressed(evt)) { | ||
| 1326 | + inputHandler.keyPressed(evt); | ||
| 1327 | + } | ||
| 1328 | + break; | ||
| 1329 | + case KeyEvent.KEY_RELEASED: | ||
| 1330 | + inputHandler.keyReleased(evt); | ||
| 1331 | + break; | ||
| 1332 | + } | ||
| 1333 | + } | ||
| 1334 | + } | ||
| 1335 | + }; | ||
| 1303 | 1336 | } | |
| 1304 | 1337 | ||
| 1338 | + | ||
| 1305 | 1339 | /** | |
| 1306 | 1340 | * Set the line to highlight as currently suspended at. Will override the | |
| 1307 | 1341 | * breakpoint color, if set. Switches to the appropriate tab and scroll to | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,20 +58,22 @@ public class XQPreprocessor { | |||
| 58 | 58 | ||
| 59 | 59 | private String[] coreImports, defaultImports; | |
| 60 | 60 | ||
| 61 | + | ||
| 61 | 62 | public XQPreprocessor() { | |
| 62 | 63 | PdePreprocessor p = new PdePreprocessor(null); | |
| 63 | 64 | defaultImports = p.getDefaultImports(); | |
| 64 | 65 | coreImports = p.getCoreImports(); | |
| 65 | 66 | } | |
| 66 | 67 | ||
| 68 | + | ||
| 67 | 69 | /** | |
| 68 | 70 | * The main method that performs preprocessing. Converts code into compilable java. | |
| 69 | 71 | * @param source - String | |
| 70 | 72 | * @param programImports - List of import statements | |
| 71 | 73 | * @return String - Compile ready java code | |
| 72 | 74 | */ | |
| 73 | 75 | public String doYourThing(String source, | |
| 74 | - ArrayList<ImportStatement> programImports) { | ||
| 76 | + ArrayList<ImportStatement> programImports) { | ||
| 75 | 77 | this.extraImports = programImports; | |
| 76 | 78 | //source = prepareImports() + source; | |
| 77 | 79 | Document doc = new Document(source); | |
@@ -118,9 +120,9 @@ public String doYourThing(String source, | |||
| 118 | 120 | return doc.get(); | |
| 119 | 121 | } | |
| 120 | 122 | ||
| 123 | + | ||
| 121 | 124 | /** | |
| 122 | 125 | * Returns all import statements as lines of code | |
| 123 | - * | ||
| 124 | 126 | * @return String - All import statements combined. Each import in a separate line. | |
| 125 | 127 | */ | |
| 126 | 128 | public String prepareImports() { | |
@@ -143,11 +145,13 @@ public String prepareImports() { | |||
| 143 | 145 | return totalImports; | |
| 144 | 146 | } | |
| 145 | 147 | ||
| 148 | + | ||
| 146 | 149 | public String prepareImports(ArrayList<ImportStatement> programImports) { | |
| 147 | 150 | this.extraImports = programImports; | |
| 148 | 151 | return prepareImports(); | |
| 149 | 152 | } | |
| 150 | 153 | ||
| 154 | + | ||
| 151 | 155 | /** | |
| 152 | 156 | * Visitor implementation that does all the substitution dirty work. <br> | |
| 153 | 157 | * <LI>Any function not specified as being protected or private will be made | |
@@ -190,6 +194,7 @@ public boolean visit(MethodDeclaration node) { | |||
| 190 | 194 | ||
| 191 | 195 | return true; | |
| 192 | 196 | } | |
| 197 | + | ||
| 193 | 198 | ||
| 194 | 199 | public boolean visit(NumberLiteral node) { | |
| 195 | 200 | if (!node.getToken().endsWith("f") | |
@@ -206,6 +211,7 @@ public boolean visit(NumberLiteral node) { | |||
| 206 | 211 | return true; | |
| 207 | 212 | } | |
| 208 | 213 | ||
| 214 | + | ||
| 209 | 215 | // public boolean visit(FieldDeclaration node) { | |
| 210 | 216 | // if (node.getType().toString().equals("color")){ | |
| 211 | 217 | // System.err.println("color type detected!"); | |
@@ -231,13 +237,9 @@ public boolean visit(NumberLiteral node) { | |||
| 231 | 237 | */ | |
| 232 | 238 | public boolean visit(SimpleType node) { | |
| 233 | 239 | if (node.toString().equals("color")) { | |
| 234 | - System.err | ||
| 235 | - .println("color type detected! \nThis shouldn't be happening! Please report this as an issue."); | ||
| 240 | + System.err.println("color type detected! \nThis shouldn't be happening! Please report this as an issue."); | ||
| 236 | 241 | } | |
| 237 | 242 | return true; | |
| 238 | - | ||
| 239 | 243 | } | |
| 240 | - | ||
| 241 | 244 | } | |
| 242 | - | ||
| 243 | 245 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -78,11 +78,15 @@ X https://github.com/processing/processing/pull/3048 | |||
| 78 | 78 | ||
| 79 | 79 | ||
| 80 | 80 | integration of pdex | |
| 81 | + X changed JLS4 to JLS8 (but make sure it doesn't introduce anything too weird) | ||
| 82 | + X change build scripts, get things running | ||
| 81 | 83 | _ remove public 'ta' object in DebugEditor, also dmode | |
| 82 | 84 | _ rename TextArea and TextAreaPainter to JavaTextArea | |
| 83 | - | ||
| 84 | - @SuppressWarnings({ "unused", "unchecked", "cast" }) | ||
| 85 | - change JLS4 to JLS8 (but make sure it doesn't introduce anything too weird) | ||
| 85 | + _ DebugEditor.createTextArea() is copy & pasted from JavaEditor | ||
| 86 | + _ this whole setup is really gross at the moment | ||
| 87 | + _ auto-insert after antlr @SuppressWarnings({ "unused", "unchecked", "cast" }) | ||
| 88 | + _ crashed on startup w/ JavaScript mode as default b/c PdeKeyListener not found | ||
| 89 | + _ because it's in the other package, can no longer rely on it | ||
| 86 | 90 | ||
| 87 | 91 | ||
| 88 | 92 | _ make examples pull/build automatic during dist | |
| Back | FazBrowse Home | New Git URL |
0 commit comments