well, time for the 'ole git push that destroys everything, leaving devastation as i leave for the day.

This commit is contained in:
Ben Fry
2015-01-20 19:05:51 -05:00
parent bf93a7ec57
commit f56436a19d
7 changed files with 83 additions and 23 deletions

View File

@@ -81,6 +81,7 @@ import processing.app.syntax.JEditTextArea;
import processing.app.syntax.PdeTextAreaDefaults;
import processing.core.PApplet;
import processing.mode.java.JavaEditor;
import processing.mode.java.PdeKeyListener;
import processing.mode.java.pdex.ErrorBar;
import processing.mode.java.pdex.ErrorCheckerService;
import processing.mode.java.pdex.ErrorMessageSimplifier;
@@ -1297,11 +1298,44 @@ public class DebugEditor extends JavaEditor implements ActionListener {
* @return the customized text area object
*/
@Override
// protected JEditTextArea createTextArea() {
// //System.out.println("overriding creation of text area");
// return new TextArea(new PdeTextAreaDefaults(mode), this);
// }
protected JEditTextArea createTextArea() {
//System.out.println("overriding creation of text area");
return new TextArea(new PdeTextAreaDefaults(mode), this);
return new TextArea(new PdeTextAreaDefaults(mode), this) {
// Forwards key events directly to the input handler. This is slightly
// faster than using a KeyListener because some Swing overhead is avoided.
PdeKeyListener editorListener = new PdeKeyListener(DebugEditor.this, this);
// Moved out of JEditTextArea for 3.0a6 to remove dependency on Java Mode
public void processKeyEvent(KeyEvent evt) {
// this had to be added in Processing 007X, because the menu key
// events weren't making it up to the frame.
super.processKeyEvent(evt);
if (inputHandler != null) {
switch (evt.getID()) {
case KeyEvent.KEY_TYPED:
if ((editorListener == null) || !editorListener.keyTyped(evt)) {
inputHandler.keyTyped(evt);
}
break;
case KeyEvent.KEY_PRESSED:
if ((editorListener == null) || !editorListener.keyPressed(evt)) {
inputHandler.keyPressed(evt);
}
break;
case KeyEvent.KEY_RELEASED:
inputHandler.keyReleased(evt);
break;
}
}
}
};
}
/**
* Set the line to highlight as currently suspended at. Will override the
* breakpoint color, if set. Switches to the appropriate tab and scroll to

View File

@@ -58,12 +58,14 @@ public class XQPreprocessor {
private String[] coreImports, defaultImports;
public XQPreprocessor() {
PdePreprocessor p = new PdePreprocessor(null);
defaultImports = p.getDefaultImports();
coreImports = p.getCoreImports();
}
/**
* The main method that performs preprocessing. Converts code into compilable java.
* @param source - String
@@ -71,7 +73,7 @@ public class XQPreprocessor {
* @return String - Compile ready java code
*/
public String doYourThing(String source,
ArrayList<ImportStatement> programImports) {
ArrayList<ImportStatement> programImports) {
this.extraImports = programImports;
//source = prepareImports() + source;
Document doc = new Document(source);
@@ -118,9 +120,9 @@ public class XQPreprocessor {
return doc.get();
}
/**
* Returns all import statements as lines of code
*
* @return String - All import statements combined. Each import in a separate line.
*/
public String prepareImports() {
@@ -143,11 +145,13 @@ public class XQPreprocessor {
return totalImports;
}
public String prepareImports(ArrayList<ImportStatement> programImports) {
this.extraImports = programImports;
return prepareImports();
}
/**
* Visitor implementation that does all the substitution dirty work. <br>
* <LI>Any function not specified as being protected or private will be made
@@ -190,6 +194,7 @@ public class XQPreprocessor {
return true;
}
public boolean visit(NumberLiteral node) {
if (!node.getToken().endsWith("f")
@@ -206,6 +211,7 @@ public class XQPreprocessor {
return true;
}
// public boolean visit(FieldDeclaration node) {
// if (node.getType().toString().equals("color")){
// System.err.println("color type detected!");
@@ -231,13 +237,9 @@ public class XQPreprocessor {
*/
public boolean visit(SimpleType node) {
if (node.toString().equals("color")) {
System.err
.println("color type detected! \nThis shouldn't be happening! Please report this as an issue.");
System.err.println("color type detected! \nThis shouldn't be happening! Please report this as an issue.");
}
return true;
}
}
}