Skip to content

Commit 112e9a8

Browse files
committed
well, time for the 'ole git push that destroys everything, leaving devastation as i leave for the day.
1 parent 77ad1b8 commit 112e9a8

File tree

7 files changed

+83
-23
lines changed

7 files changed

+83
-23
lines changed

app/src/processing/app/Base.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public class Base {
5353
// static private boolean RELEASE = false;
5454

5555
/** 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;
5858

5959
static HashMap<Integer, String> platformNames =
6060
new HashMap<Integer, String>();
@@ -2235,7 +2235,7 @@ static public File getContentFile(String name) {
22352235
// Path may have URL encoding, so remove it
22362236
String decodedPath = PApplet.urlDecode(path);
22372237

2238-
if (decodedPath.contains("/app/bin")) {
2238+
if (decodedPath.contains("/app/bin")) { // This means we're in Eclipse
22392239
if (Base.isMacOS()) {
22402240
processingRoot =
22412241
new File(path, "../../build/macosx/work/Processing.app/Contents/Java");
@@ -2252,11 +2252,9 @@ static public File getContentFile(String name) {
22522252
// This works for Windows, Linux, and Apple's Java 6 on OS X.
22532253
processingRoot = jarFolder.getParentFile();
22542254
} 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.
22582257
processingRoot = jarFolder;
2259-
22602258
}
22612259
if (processingRoot == null || !processingRoot.exists()) {
22622260
// Try working directory instead (user.dir, different from user.home)

app/src/processing/app/Editor.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,28 @@ protected ArrayList<ToolContribution> getCoreTools() {
304304
* solution where the listeners are handled properly.
305305
*/
306306
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+
};
308329
}
309330

310331

app/src/processing/app/Toolkit.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,8 @@ static private Font createFont(String filename, int size) throws IOException, Fo
725725
if (!fontFile.exists()) {
726726
// if we're debugging from Eclipse, grab it from the work folder (user.dir is /app)
727727
//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);
730730
}
731731
BufferedInputStream input = new BufferedInputStream(new FileInputStream(fontFile));
732732
Font font = Font.createFont(Font.TRUETYPE_FONT, input);

app/src/processing/app/syntax/JEditTextArea.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,8 +1962,9 @@ public void processKeyEvent(KeyEvent evt) {
19621962
break;
19631963
}
19641964
}
1965-
*/
1965+
*/
19661966

1967+
19671968
// protected members
19681969
protected static String CENTER = "center";
19691970
protected static String RIGHT = "right";

java/src/processing/mode/java/debug/DebugEditor.java

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
import processing.app.syntax.PdeTextAreaDefaults;
8282
import processing.core.PApplet;
8383
import processing.mode.java.JavaEditor;
84+
import processing.mode.java.PdeKeyListener;
8485
import processing.mode.java.pdex.ErrorBar;
8586
import processing.mode.java.pdex.ErrorCheckerService;
8687
import processing.mode.java.pdex.ErrorMessageSimplifier;
@@ -1297,11 +1298,44 @@ public void toggleVariableInspector() {
12971298
* @return the customized text area object
12981299
*/
12991300
@Override
1301+
// protected JEditTextArea createTextArea() {
1302+
// //System.out.println("overriding creation of text area");
1303+
// return new TextArea(new PdeTextAreaDefaults(mode), this);
1304+
// }
13001305
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+
};
13031336
}
13041337

1338+
13051339
/**
13061340
* Set the line to highlight as currently suspended at. Will override the
13071341
* breakpoint color, if set. Switches to the appropriate tab and scroll to

java/src/processing/mode/java/pdex/XQPreprocessor.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,22 @@ public class XQPreprocessor {
5858

5959
private String[] coreImports, defaultImports;
6060

61+
6162
public XQPreprocessor() {
6263
PdePreprocessor p = new PdePreprocessor(null);
6364
defaultImports = p.getDefaultImports();
6465
coreImports = p.getCoreImports();
6566
}
6667

68+
6769
/**
6870
* The main method that performs preprocessing. Converts code into compilable java.
6971
* @param source - String
7072
* @param programImports - List of import statements
7173
* @return String - Compile ready java code
7274
*/
7375
public String doYourThing(String source,
74-
ArrayList<ImportStatement> programImports) {
76+
ArrayList<ImportStatement> programImports) {
7577
this.extraImports = programImports;
7678
//source = prepareImports() + source;
7779
Document doc = new Document(source);
@@ -118,9 +120,9 @@ public String doYourThing(String source,
118120
return doc.get();
119121
}
120122

123+
121124
/**
122125
* Returns all import statements as lines of code
123-
*
124126
* @return String - All import statements combined. Each import in a separate line.
125127
*/
126128
public String prepareImports() {
@@ -143,11 +145,13 @@ public String prepareImports() {
143145
return totalImports;
144146
}
145147

148+
146149
public String prepareImports(ArrayList<ImportStatement> programImports) {
147150
this.extraImports = programImports;
148151
return prepareImports();
149152
}
150153

154+
151155
/**
152156
* Visitor implementation that does all the substitution dirty work. <br>
153157
* <LI>Any function not specified as being protected or private will be made
@@ -190,6 +194,7 @@ public boolean visit(MethodDeclaration node) {
190194

191195
return true;
192196
}
197+
193198

194199
public boolean visit(NumberLiteral node) {
195200
if (!node.getToken().endsWith("f")
@@ -206,6 +211,7 @@ public boolean visit(NumberLiteral node) {
206211
return true;
207212
}
208213

214+
209215
// public boolean visit(FieldDeclaration node) {
210216
// if (node.getType().toString().equals("color")){
211217
// System.err.println("color type detected!");
@@ -231,13 +237,9 @@ public boolean visit(NumberLiteral node) {
231237
*/
232238
public boolean visit(SimpleType node) {
233239
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.");
236241
}
237242
return true;
238-
239243
}
240-
241244
}
242-
243245
}

todo.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,15 @@ X https://github.com/processing/processing/pull/3048
7878

7979

8080
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
8183
_ remove public 'ta' object in DebugEditor, also dmode
8284
_ 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
8690

8791

8892
_ make examples pull/build automatic during dist

0 commit comments

Comments
 (0)