Merge remote-tracking branch 'remotes/upstream/master'

This commit is contained in:
Sean McKenna
2014-07-28 21:23:20 -04:00
25 changed files with 443 additions and 151 deletions
+5
View File
@@ -1232,6 +1232,11 @@ public abstract class Editor extends JFrame implements RunnerListener {
public void showReference(String filename) {
File file = new File(mode.getReferenceFolder(), filename);
try {
file = file.getCanonicalFile();
} catch (IOException e) {
e.printStackTrace();
}
// Prepend with file:// and also encode spaces & other characters
Base.openURL(file.toURI().toString());
}
+98 -3
View File
@@ -26,6 +26,9 @@ package processing.app;
import processing.core.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.io.*;
import javax.swing.*;
@@ -286,7 +289,8 @@ public class Sketch {
}
renamingCode = false;
editor.status.edit("Name for new file:", "");
// editor.status.edit("Name for new file:", "");
promptForTabName("Name for new file:", "");
}
@@ -326,8 +330,99 @@ public class Sketch {
"New name for sketch:" : "New name for file:";
String oldName = (current.isExtension(mode.getDefaultExtension())) ?
current.getPrettyName() : current.getFileName();
editor.status.edit(prompt, oldName);
// editor.status.edit(prompt, oldName);
promptForTabName(prompt, oldName);
}
/**
* Displays a dialog for renaming or creating a new tab
* @param prompt - msg to display
* @param oldName
*/
protected void promptForTabName(String prompt, String oldName) {
final JTextField txtTabName = new JTextField();
txtTabName.addKeyListener(new KeyAdapter() {
// Forget ESC, the JDialog should handle it.
// Use keyTyped to catch when the feller is actually
// added to the text field. With keyTyped, as opposed to
// keyPressed, the keyCode will be zero, even if it's
// enter or backspace or whatever, so the keychar should
// be used instead. Grr.
public void keyTyped(KeyEvent event) {
//System.out.println("got event " + event);
char ch = event.getKeyChar();
if ((ch == '_') || (ch == '.') || // allow.pde and .java
(('A' <= ch) && (ch <= 'Z')) || (('a' <= ch) && (ch <= 'z'))) {
// These events are allowed straight through.
} else if (ch == ' ') {
String t = txtTabName.getText();
int start = txtTabName.getSelectionStart();
int end = txtTabName.getSelectionEnd();
txtTabName.setText(t.substring(0, start) + "_" + t.substring(end));
txtTabName.setCaretPosition(start + 1);
event.consume();
} else if ((ch >= '0') && (ch <= '9')) {
// getCaretPosition == 0 means that it's the first char
// and the field is empty.
// getSelectionStart means that it *will be* the first
// char, because the selection is about to be replaced
// with whatever is typed.
if ((txtTabName.getCaretPosition() == 0)
|| (txtTabName.getSelectionStart() == 0)) {
// number not allowed as first digit
//System.out.println("bad number bad");
event.consume();
}
} else if (ch == KeyEvent.VK_ENTER) {
// Slightly ugly hack that ensures OK button of the dialog
// consumes the Enter key event. Since the text field is the
// default component in the dialog(see below), OK button doesn't
// consume Enter key event, by default.
Container parent = txtTabName.getParent();
while (!(parent instanceof JOptionPane)) {
parent = parent.getParent();
}
JOptionPane pane = (JOptionPane) parent;
final JPanel pnlBottom = (JPanel) pane.getComponent(pane
.getComponentCount() - 1);
for (int i = 0; i < pnlBottom.getComponents().length; i++) {
Component component = pnlBottom.getComponents()[i];
if (component instanceof JButton) {
final JButton okButton = ((JButton) component);
if (okButton.getText().equalsIgnoreCase("OK")) {
ActionListener[] actionListeners = okButton
.getActionListeners();
if (actionListeners.length > 0) {
actionListeners[0].actionPerformed(null);
event.consume();
}
}
}
}
}
else {
event.consume();
}
}
});
int userReply = JOptionPane.showOptionDialog(editor, new Object[] {
prompt, txtTabName },
"Tab Name",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.PLAIN_MESSAGE,
null, new Object[] {
Preferences.PROMPT_OK,
Preferences.PROMPT_CANCEL },
txtTabName);
if (userReply == JOptionPane.OK_OPTION) {
String answer = txtTabName.getText();
nameCode(answer);
}
}
/**
@@ -382,7 +477,7 @@ public class Sketch {
if (current == code[0]) { // If this is the main tab, disallow
Base.showWarning("Problem with rename",
"The first tab cannot be a ." + newExtension + " file.\n" +
"(It may be time for your to graduate to a\n" +
"(It may be time for you to graduate to a\n" +
"\"real\" programming environment, hotshot.)");
return;
}
@@ -194,6 +194,9 @@ public class PdeKeyListener {
textarea.setSelectedText(spaces(tabSize));
event.consume();
return true;
} else if (!Preferences.getBoolean("editor.tabs.expand")) {
textarea.setSelectedText("\t");
event.consume();
}
break;
+22
View File
@@ -1,3 +1,25 @@
PROCESSING 3.0a2 (REV 0229) - ?? August 2014
[ fixes ]
+ The Examples and Reference weren't included in 3.0a1. Oops.
https://github.com/processing/processing/issues/2652
[ changes ]
+ Neglected to mention with the previous release that the video library has
been removed from the default download. This decreases the size of the
Processing download by about 20%. In addition, it was only the video
library for the platform being downloaded, and with the return of cross-
platform application export, that could cause sadness. To use the video
library, use the "Add Library..." menu and select it from the list.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PROCESSING 3.0a1 (REV 0228) - 26 July 2014
Kicking off the 3.0 release process. The focus for Processing 3 is improving
+122 -1
View File
@@ -518,7 +518,7 @@ public class PShapeSVG extends PShape {
c == 'S' || c == 's' ||
c == 'Q' || c == 'q' || // quadratic beziers
c == 'T' || c == 't' ||
// c == 'A' || c == 'a' || // elliptical arc
c == 'A' || c == 'a' || // elliptical arc
c == 'Z' || c == 'z' || // closepath
c == ',') {
separate = true;
@@ -816,6 +816,40 @@ public class PShapeSVG extends PShape {
}
break;
// A - elliptical arc to (absolute)
case 'A': {
float rx = PApplet.parseFloat(pathTokens[i + 1]);
float ry = PApplet.parseFloat(pathTokens[i + 2]);
float angle = PApplet.parseFloat(pathTokens[i + 3]);
boolean fa = PApplet.parseFloat(pathTokens[i + 4]) != 0;
boolean fs = PApplet.parseFloat(pathTokens[i + 5]) != 0;
float endX = PApplet.parseFloat(pathTokens[i + 6]);
float endY = PApplet.parseFloat(pathTokens[i + 7]);
parsePathArcto(cx, cy, rx, ry, angle, fa, fs, endX, endY);
cx = endX;
cy = endY;
i += 8;
prevCurve = true;
}
break;
// a - elliptical arc to (relative)
case 'a': {
float rx = PApplet.parseFloat(pathTokens[i + 1]);
float ry = PApplet.parseFloat(pathTokens[i + 2]);
float angle = PApplet.parseFloat(pathTokens[i + 3]);
boolean fa = PApplet.parseFloat(pathTokens[i + 4]) != 0;
boolean fs = PApplet.parseFloat(pathTokens[i + 5]) != 0;
float endX = cx + PApplet.parseFloat(pathTokens[i + 6]);
float endY = cy + PApplet.parseFloat(pathTokens[i + 7]);
parsePathArcto(cx, cy, rx, ry, angle, fa, fs, endX, endY);
cx = endX;
cy = endY;
i += 8;
prevCurve = true;
}
break;
case 'Z':
case 'z':
// since closing the path, the 'current' point needs
@@ -924,6 +958,93 @@ public class PShapeSVG extends PShape {
}
// Approximates elliptical arc by several bezier segments.
// Meets SVG standard requirements from:
// http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
// http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
// Based on arc to bezier curve equations from:
// http://www.spaceroots.org/documents/ellipse/node22.html
private void parsePathArcto(float x1, float y1,
float rx, float ry,
float angle,
boolean fa, boolean fs,
float x2, float y2) {
if (x1 == x2 && y1 == y2) return;
if (rx == 0 || ry == 0) { parsePathLineto(x2, y2); return; }
rx = PApplet.abs(rx); ry = PApplet.abs(ry);
float phi = PApplet.radians(((angle % 360) + 360) % 360);
float cosPhi = PApplet.cos(phi), sinPhi = PApplet.sin(phi);
float x1r = ( cosPhi * (x1 - x2) + sinPhi * (y1 - y2)) / 2;
float y1r = (-sinPhi * (x1 - x2) + cosPhi * (y1 - y2)) / 2;
float cxr, cyr;
{
float A = (x1r*x1r) / (rx*rx) + (y1r*y1r) / (ry*ry);
if (A > 1) {
// No solution, scale ellipse up according to SVG standard
float sqrtA = PApplet.sqrt(A);
rx *= sqrtA; cxr = 0;
ry *= sqrtA; cyr = 0;
} else {
float k = ((fa == fs) ? -1f : 1f) *
PApplet.sqrt((rx*rx * ry*ry) / ((rx*rx * y1r*y1r) + (ry*ry * x1r*x1r)) - 1f);
cxr = k * rx * y1r / ry;
cyr = -k * ry * x1r / rx;
}
}
float cx = cosPhi * cxr - sinPhi * cyr + (x1 + x2) / 2;
float cy = sinPhi * cxr + cosPhi * cyr + (y1 + y2) / 2;
float phi1, phiDelta;
{
float sx = ( x1r - cxr) / rx, sy = ( y1r - cyr) / ry;
float tx = (-x1r - cxr) / rx, ty = (-y1r - cyr) / ry;
phi1 = PApplet.atan2(sy, sx);
phiDelta = (((PApplet.atan2(ty, tx) - phi1) % TWO_PI) + TWO_PI) % TWO_PI;
if (!fs) phiDelta -= TWO_PI;
}
// One segment can not cover more that PI, less than PI/2 is
// recommended to avoid visible inaccuracies caused by rounding errors
int segmentCount = PApplet.ceil(PApplet.abs(phiDelta) / TWO_PI * 4);
float inc = phiDelta / segmentCount;
float a = PApplet.sin(inc) *
(PApplet.sqrt(4 + 3 * PApplet.sq(PApplet.tan(inc / 2))) - 1) / 3;
float sinPhi1 = PApplet.sin(phi1), cosPhi1 = PApplet.cos(phi1);
float p1x = x1;
float p1y = y1;
float relq1x = a * (-rx * cosPhi * sinPhi1 - ry * sinPhi * cosPhi1);
float relq1y = a * (-rx * sinPhi * sinPhi1 + ry * cosPhi * cosPhi1);
for (int i = 0; i < segmentCount; i++) {
float eta = phi1 + (i + 1) * inc;
float sinEta = PApplet.sin(eta), cosEta = PApplet.cos(eta);
float p2x = cx + rx * cosPhi * cosEta - ry * sinPhi * sinEta;
float p2y = cy + rx * sinPhi * cosEta + ry * cosPhi * sinEta;
float relq2x = a * (-rx * cosPhi * sinEta - ry * sinPhi * cosEta);
float relq2y = a * (-rx * sinPhi * sinEta + ry * cosPhi * cosEta);
if (i == segmentCount - 1) { p2x = x2; p2y = y2; }
parsePathCode(BEZIER_VERTEX);
parsePathVertex(p1x + relq1x, p1y + relq1y);
parsePathVertex(p2x - relq2x, p2y - relq2y);
parsePathVertex(p2x, p2y);
p1x = p2x; relq1x = relq2x;
p1y = p2y; relq1y = relq2y;
}
}
/**
* Parse the specified SVG matrix into a PMatrix2D. Note that PMatrix2D
* is rotated relative to the SVG definition, so parameters are rearranged
+8 -2
View File
@@ -1,6 +1,14 @@
0229 core (3.0a2)
pulls
X implement A and a (elliptical arcs)
X https://github.com/processing/processing/issues/169
X http://code.google.com/p/processing/issues/detail?id=130
X https://github.com/processing/processing/pull/2659
X done with an approximation, if re-saving this will destroy data (docs)
applet removal
_ remove Applet as base class
_ performance issues on OS X (might be threading due to Applet)
@@ -418,8 +426,6 @@ _ for PShape, need to be able to set the origin (flash people)
CORE / PShapeSVG
_ implement A and a (elliptical arcs)
_ http://code.google.com/p/processing/issues/detail?id=130
_ implement support for SVG gradients from Inkscape
_ http://code.google.com/p/processing/issues/detail?id=1142
_ need to handle <!ENTITY tags in XML for SVG documents
@@ -12,7 +12,7 @@
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="processing-experimental"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/processing-experimental/build.xml}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,clean"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+97 -80
View File
@@ -1,25 +1,55 @@
<?xml version="1.0"?>
<project name="PDE X" default="build">
<property file="build.properties" />
<property file="build.properties" />
<!-- Figure out the platform. Needed for quick install path. -->
<condition property="platform" value="macosx">
<os family="mac" />
</condition>
<condition property="platform" value="windows">
<os family="windows" />
</condition>
<condition property="platform" value="linux">
<and>
<os family="unix" />
<not>
<os family="mac" />
</not>
</and>
</condition>
<!-- Figure out the platform-specific output directory. -->
<condition property="target.path" value="../build/macosx/work/Processing.app/Contents/Java">
<os family="mac" />
</condition>
<condition property="target.path" value="../build/linux/work">
<os family="unix" />
</condition>
<condition property="target.path" value="../build/windows/work">
<os family="windows" />
</condition>
<target name="clean" description="Clean the build directories">
<delete dir="bin" />
<delete file="mode/${lib.name}.jar" />
<echo message="Platform is ${platform}." />
</target>
<target name="clean" description="Clean the build directories">
<delete dir="bin" />
<delete file="mode/${lib.name}.jar" />
<echo message="Platform is ${platform}." />
</target>
<target name="compile" description="Compile sources">
<condition property="core-built">
<available file="${core.library.location}/core.jar" />
</condition>
<fail unless="core-built" message="Please build the core library first and make sure it sits in ../core/library/core.jar" />
<mkdir dir="bin" />
<target name="compile" description="Compile sources">
<condition property="core-built">
<available file="${core.library.location}/core.jar" />
</condition>
<fail unless="core-built" message="Please build the core library first and make sure it sits in ../core/library/core.jar" />
<mkdir dir="bin" />
<javac source="1.6"
<javac source="1.6"
target="1.6"
destdir="bin"
encoding="UTF-8"
@@ -27,82 +57,69 @@
includeAntRuntime="false"
compiler="org.eclipse.jdt.core.JDTCompilerAdapter"
classpath="${core.library.location}/core.jar; ${env.JAVA_HOME}/lib/tools.jar; ${app.library.location}/lib/ant.jar; ${app.library.location}/lib/ant-launcher.jar; ${app.library.location}/lib/antlr.jar; ${app.library.location}/lib/apple.jar; ${app.library.location}/lib/jdt-core.jar; ${app.library.location}/lib/jna.jar; ${app.library.location}/lib/org-netbeans-swing-outline.jar; ${app.library.location}/pde.jar; mode/com.ibm.icu_4.4.2.v20110823.jar; mode/jdi.jar; mode/jdimodel.jar; mode/org.eclipse.core.contenttype_3.4.200.v20120523-2004.jar; mode/org.eclipse.core.jobs_3.5.300.v20120622-204750.jar; mode/org.eclipse.core.resources_3.8.1.v20120802-154922.jar; mode/org.eclipse.core.runtime_3.8.0.v20120521-2346.jar; mode/org.eclipse.equinox.common_3.6.100.v20120522-1841.jar; mode/org.eclipse.equinox.preferences_3.5.0.v20120522-1841.jar; mode/org.eclipse.jdt.core_3.8.2.v20120814-155456.jar; mode/org.eclipse.jdt.debug_3.7.101.v20120725-115645.jar; mode/org.eclipse.osgi_3.8.1.v20120830-144521.jar; mode/org.eclipse.text_3.5.200.v20120523-1310.jar;mode/classpath-explorer-1.0.jar; mode/jsoup-1.7.1.jar;">
<src path="src" />
<compilerclasspath path="../java/mode/ecj.jar" />
</javac>
</target>
<src path="src" />
<compilerclasspath path="../java/mode/ecj.jar" />
</javac>
</target>
<target name="build" depends="compile" description="Build the 3.0 editor">
<jar basedir="bin" destfile="mode/${lib.name}.jar" />
</target>
<target name="build" depends="compile" description="Build the 3.0 editor">
<jar basedir="bin" destfile="mode/${lib.name}.jar" />
</target>
<target name="install" depends="build" description="Install to mode folder">
<delete file="${target.path}/modes/${lib.name}/mode/${lib.name}.jar" />
<copy todir="${target.path}/modes/${lib.name}/mode">
<fileset file="mode/${lib.name}.jar" />
</copy>
</target>
<target name="install" depends="build" description="Install to mode folder">
<delete file="${target.path}/modes/${lib.name}/mode/${lib.name}.jar" />
<copy todir="${target.path}/modes/${lib.name}/mode">
<fileset file="mode/${lib.name}.jar" />
</copy>
</target>
<target name="package" depends="build" description="Package PDE X">
<delete dir="${dist}" />
<property name="bundle" value="${dist}/${lib.name}" />
<mkdir dir="${bundle}" />
<mkdir dir="${bundle}/mode" />
<copy todir="${bundle}/mode">
<fileset dir="mode" />
</copy>
<target name="package" depends="build" description="Package PDE X">
<delete dir="${dist}" />
<property name="bundle" value="${dist}/${lib.name}" />
<mkdir dir="${bundle}" />
<mkdir dir="${bundle}/mode" />
<copy todir="${bundle}/mode">
<fileset dir="mode" />
</copy>
<mkdir dir="${bundle}/src" />
<copy todir="${bundle}/src">
<fileset dir="src" />
</copy>
<mkdir dir="${bundle}/src" />
<copy todir="${bundle}/src">
<fileset dir="src" />
</copy>
<mkdir dir="${bundle}/data" />
<copy todir="${bundle}/data">
<fileset dir="data" />
</copy>
<mkdir dir="${bundle}/data" />
<copy todir="${bundle}/data">
<fileset dir="data" />
</copy>
<mkdir dir="${bundle}/application" />
<copy todir="${bundle}/application">
<fileset dir="application" />
</copy>
<mkdir dir="${bundle}/application" />
<copy todir="${bundle}/application">
<fileset dir="application" />
</copy>
<mkdir dir="${bundle}/theme" />
<copy todir="${bundle}/theme">
<fileset dir="theme" />
</copy>
<mkdir dir="${bundle}/theme" />
<copy todir="${bundle}/theme">
<fileset dir="theme" />
</copy>
<copy todir="${bundle}">
<fileset file="keywords.txt" />
</copy>
<copy todir="${bundle}">
<fileset file="mode.properties" />
</copy>
<replaceregexp file="${bundle}/mode.properties" flags="g" match="@@version@@" replace="${release}" />
<replaceregexp file="${bundle}/mode.properties" flags="g" match="@@pretty-version@@" replace="${prettyVersion}" />
</target>
<copy todir="${bundle}">
<fileset file="keywords.txt" />
</copy>
<copy todir="${bundle}">
<fileset file="mode.properties" />
</copy>
<replaceregexp file="${bundle}/mode.properties" flags="g" match="@@version@@" replace="${release}" />
<replaceregexp file="${bundle}/mode.properties" flags="g" match="@@pretty-version@@" replace="${prettyVersion}" />
</target>
<target name="package_zip" depends="package"
description="Create zip file for distribution">
<property name="v" value="_v"/>
<property name="zipStr" value=".zip"/>
<zip destfile="${dist}/${lib.name}${v}${prettyVersion}${zipStr}"
basedir="${dist}/"
excludes="**/.DS_Store"/>
</target>
<target name="full_install" depends="package"
<target name="full_install" depends="package"
description="Full install to mode folder">
<delete dir="${target.path}/modes/${lib.name}" />
<copy todir="${target.path}/modes/">
<fileset dir="dist" />
</copy>
</target>
<delete dir="${target.path}/modes/${lib.name}" />
<copy todir="${target.path}/modes/">
<fileset dir="dist" />
</copy>
</target>
</project>
@@ -268,7 +268,7 @@ public class ASTGenerator {
logE("No CU found!");
}
visitRecur((ASTNode) compilationUnit.types().get(0), codeTree);
SwingWorker worker = new SwingWorker() {
SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
@Override
protected Object doInBackground() throws Exception {
@@ -895,7 +895,7 @@ public class ASTGenerator {
logE("Typed: " + word2 + "|" + " temp Node type: " + testnode.getClass().getSimpleName());
if(testnode instanceof MethodInvocation){
MethodInvocation mi = (MethodInvocation)testnode;
System.out.println(mi.getName() + "," + mi.getExpression() + "," + mi.typeArguments().size());
log(mi.getName() + "," + mi.getExpression() + "," + mi.typeArguments().size());
}
// find nearest ASTNode
@@ -1040,7 +1040,7 @@ public class ASTGenerator {
if (sketchOutline.isVisible()) return;
Collections.sort(candidates);
// CompletionCandidate[][] candi = new CompletionCandidate[candidates.size()][1];
DefaultListModel defListModel = new DefaultListModel();
DefaultListModel<CompletionCandidate> defListModel = new DefaultListModel<CompletionCandidate>();
for (int i = 0; i < candidates.size(); i++) {
// candi[i][0] = candidates.get(i);
@@ -1259,8 +1259,7 @@ public class ASTGenerator {
// First, see if the classname is a fully qualified name and loads straightaway
tehClass = loadClass(className);
// do you mean to check for 'null' here? otherwise, this expression is always true [fry]
if (tehClass instanceof Class) {
if (tehClass != null) {
//log(tehClass.getName() + " located straightaway");
return tehClass;
}
@@ -1282,7 +1281,7 @@ public class ASTGenerator {
}
}
tehClass = loadClass(temp);
if (tehClass instanceof Class) {
if (tehClass != null) {
log(tehClass.getName() + " located.");
return tehClass;
}
@@ -1294,7 +1293,7 @@ public class ASTGenerator {
PdePreprocessor p = new PdePreprocessor(null);
for (String impS : p.getCoreImports()) {
tehClass = loadClass(impS.substring(0,impS.length()-1) + className);
if (tehClass instanceof Class) {
if (tehClass != null) {
log(tehClass.getName() + " located.");
return tehClass;
}
@@ -1304,7 +1303,7 @@ public class ASTGenerator {
for (String impS : p.getDefaultImports()) {
if(className.equals(impS) || impS.endsWith(className)){
tehClass = loadClass(impS);
if (tehClass instanceof Class) {
if (tehClass != null) {
log(tehClass.getName() + " located.");
return tehClass;
}
@@ -1315,7 +1314,7 @@ public class ASTGenerator {
// And finally, the daddy
String daddy = "java.lang." + className;
tehClass = loadClass(daddy);
if (tehClass instanceof Class) {
if (tehClass != null) {
log(tehClass.getName() + " located.");
return tehClass;
}
@@ -1886,7 +1885,6 @@ public class ASTGenerator {
+ lineElement.getEndOffset());
log("PL " + pdeLine);
} catch (BadLocationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -2068,6 +2066,7 @@ public class ASTGenerator {
}
public void handleShowUsage(){
if(editor.hasJavaTabs) return; // show usage disabled if java tabs
log("Last clicked word:" + lastClickedWord);
if(lastClickedWord == null && editor.ta.getSelectedText() == null){
editor.statusMessage("Highlight the class/function/variable name first"
@@ -2263,11 +2262,11 @@ public class ASTGenerator {
int endOffset) {
// log("dfsLookForASTNode() lookin for " + name + " Offsets: " + startOffset
// + "," + endOffset);
Stack stack = new Stack<ASTNode>();
Stack<ASTNode> stack = new Stack<ASTNode>();
stack.push(root);
while (!stack.isEmpty()) {
ASTNode node = (ASTNode) stack.pop();
ASTNode node = stack.pop();
//log("Popped from stack: " + getNodeAsString(node));
Iterator<StructuralPropertyDescriptor> it =
node.structuralPropertiesForType().iterator();
@@ -2321,6 +2320,7 @@ public class ASTGenerator {
protected SketchOutline sketchOutline;
protected void showSketchOutline(){
if(editor.hasJavaTabs) return; // sketch outline disabled if java tabs
sketchOutline = new SketchOutline(codeTree, errorCheckerService);
sketchOutline.show();
}
@@ -2405,6 +2405,7 @@ public class ASTGenerator {
}
public void handleRefactor(){
if(editor.hasJavaTabs) return; // refactoring disabled if java tabs
log("Last clicked word:" + lastClickedWord);
if(lastClickedWord == null && editor.ta.getSelectedText() == null){
editor.statusMessage("Highlight the class/function/variable name first",
@@ -3011,7 +3012,7 @@ public class ASTGenerator {
/**
* A wrapper for java.lang.reflect types.
* Will have to see if the usage turns out to be internal only here or not
* and then accordingly decide where to place this class. TODO
* and then accordingly decide where to place this class.
* @author quarkninja
*
*/
@@ -155,9 +155,10 @@ public class ASTNodeWrapper {
//nodeOffset = ((VariableDeclarationFragment)(fd.fragments().get(0))).getName().getStartPosition();
}
if(jd == null){
if (jd == null) {
log("Visiting children of node " + getNodeAsString(thisNode));
Iterator<StructuralPropertyDescriptor> it = thisNode
Iterator<StructuralPropertyDescriptor> it =
(Iterator<StructuralPropertyDescriptor>) thisNode
.structuralPropertiesForType().iterator();
boolean flag = true;
while (it.hasNext()) {
@@ -213,7 +214,7 @@ public class ASTNodeWrapper {
* @return
*/
private int getJavadocOffset(FieldDeclaration fd){
List<ASTNode> list= fd.modifiers();
List<ASTNode> list= (List<ASTNode>)fd.modifiers();
SimpleName sn = (SimpleName) getNode();
Type tp = fd.getType();
@@ -247,7 +248,7 @@ public class ASTNodeWrapper {
* @return
*/
private int getJavadocOffset(MethodDeclaration md) {
List<ASTNode> list = md.modifiers();
List<ASTNode> list = (List<ASTNode>)md.modifiers();
SimpleName sn = (SimpleName) getNode();
int lineNum = getLineNumber(sn);
log("SN " + sn + ", " + lineNum);
@@ -282,8 +283,7 @@ public class ASTNodeWrapper {
*/
private int getJavadocOffset(TypeDeclaration td){
// TODO: This isn't perfect yet. Class \n \n \n className still breaks it.. :'(
List<ASTNode> list= td.modifiers();
list = td.modifiers();
List<ASTNode> list= (List<ASTNode>)td.modifiers();
SimpleName sn = (SimpleName) getNode();
int lineNum = getLineNumber(sn);
@@ -31,7 +31,7 @@ import processing.app.Sketch;
/**
* Autosave utility for saving sketch backups in the background after
* certain intervals
*
* NOTE: This was developed as an experiment, but disabled for now.
* @author Manindra Moharana <me@mkmoharana.com>
*
*/
@@ -161,7 +161,7 @@ public class CompilationChecker {
}
List<ClassFile> getResults() {
System.out.println("Calling get results");
//System.out.println("Calling get results");
return this.classes;
}
}
@@ -268,12 +268,11 @@ public class CompilationChecker {
try {
urls[i] = jarList.get(i).toURI().toURL();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
urlClassLoader = new URLClassLoader(urls);
System.out.println("URL Classloader ready");
//System.out.println("URL Classloader ready");
}
/**
@@ -99,7 +99,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
protected Color currentLineColor = new Color(255, 255, 150); // the background color for highlighting lines
protected Color breakpointMarkerColor = new Color(74, 84, 94); // the color of breakpoint gutter markers
protected Color currentLineMarkerColor = new Color(226, 117, 0); // the color of current line gutter markers
protected List<LineHighlight> breakpointedLines = new ArrayList(); // breakpointed lines
protected List<LineHighlight> breakpointedLines = new ArrayList<LineHighlight>(); // breakpointed lines
protected LineHighlight currentLine; // line the debugger is currently suspended at
protected final String breakpointMarkerComment = " //<>//"; // breakpoint marker comment
// menus
@@ -189,6 +189,11 @@ public class DebugEditor extends JavaEditor implements ActionListener {
*/
protected JCheckBoxMenuItem completionsEnabled;
/**
* If sketch contains java tabs, some editor features are disabled
*/
protected boolean hasJavaTabs;
/**
* UNUSED. Disbaled for now.
*/
@@ -837,7 +842,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
* removed from.
*/
protected List<LineID> stripBreakpointComments() {
List<LineID> bps = new ArrayList();
List<LineID> bps = new ArrayList<LineID>();
// iterate over all tabs
Sketch sketch = getSketch();
for (int i = 0; i < sketch.getCodeCount(); i++) {
@@ -934,7 +939,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
}
// note modified tabs
final List<String> modified = new ArrayList();
final List<String> modified = new ArrayList<String>();
for (int i = 0; i < getSketch().getCodeCount(); i++) {
SketchCode tab = getSketch().getCode(i);
if (tab.isModified()) {
@@ -1586,9 +1591,9 @@ public class DebugEditor extends JavaEditor implements ActionListener {
if(type == STATUS_COMPILER_ERR) return;
// Clear the message after a delay
SwingWorker s = new SwingWorker<Void, Void>() {
SwingWorker<Object, Object> s = new SwingWorker<Object, Object>() {
@Override
protected Void doInBackground() throws Exception {
protected Object doInBackground() throws Exception {
try {
Thread.sleep(2 * 1000);
} catch (InterruptedException e) {
@@ -1687,19 +1692,20 @@ public class DebugEditor extends JavaEditor implements ActionListener {
}
/**
* Checks if the sketch contains java tabs. If it does, XQMode ain't built
* for it, yet. Also, user should really start looking at Eclipse. Disable
* compilation check.
* Checks if the sketch contains java tabs. If it does, the editor ain't built
* for it, yet. Also, user should really start looking at more powerful IDEs
* likeEclipse. Disable compilation check and some more features.
*/
private void checkForJavaTabs() {
hasJavaTabs = false;
for (int i = 0; i < this.getSketch().getCodeCount(); i++) {
if (this.getSketch().getCode(i).getExtension().equals("java")) {
compilationCheckEnabled = false;
hasJavaTabs = true;
JOptionPane.showMessageDialog(new Frame(), this
.getSketch().getName()
+ " contains .java tabs. Live compilation error checking isn't "
+ "supported for java tabs. Only "
+ "syntax errors will be reported for .pde tabs.");
+ " contains .java tabs. Some editor features are not supported " +
"for .java tabs and will be disabled.");
break;
}
}
@@ -51,13 +51,13 @@ public class Debugger implements VMEventListener {
protected ThreadReference currentThread; // thread the last breakpoint or step occured in
protected String mainClassName; // name of the main class that's currently being debugged
protected ReferenceType mainClass; // the debuggee's main class
protected Set<ReferenceType> classes = new HashSet(); // holds all loaded classes in the debuggee VM
protected List<ClassLoadListener> classLoadListeners = new ArrayList(); // listeners for class load events
protected Set<ReferenceType> classes = new HashSet<ReferenceType>(); // holds all loaded classes in the debuggee VM
protected List<ClassLoadListener> classLoadListeners = new ArrayList<ClassLoadListener>(); // listeners for class load events
protected String srcPath; // path to the src folder of the current build
protected List<LineBreakpoint> breakpoints = new ArrayList(); // list of current breakpoints
protected List<LineBreakpoint> breakpoints = new ArrayList<LineBreakpoint>(); // list of current breakpoints
protected StepRequest requestedStep; // the step request we are currently in, or null if not in a step
protected Map<LineID, LineID> runtimeLineChanges = new HashMap(); // maps line number changes at runtime (orig -> changed)
protected Set<String> runtimeTabsTracked = new HashSet(); // contains tab filenames which already have been tracked for runtime changes
protected Map<LineID, LineID> runtimeLineChanges = new HashMap<LineID, LineID>(); // maps line number changes at runtime (orig -> changed)
protected Set<String> runtimeTabsTracked = new HashSet<String>(); // contains tab filenames which already have been tracked for runtime changes
/**
* Construct a Debugger object.
@@ -514,7 +514,7 @@ public class Debugger implements VMEventListener {
* @return the list of breakpoints in the given tab
*/
public synchronized List<LineBreakpoint> getBreakpoints(String tabFilename) {
List<LineBreakpoint> list = new ArrayList();
List<LineBreakpoint> list = new ArrayList<LineBreakpoint>();
for (LineBreakpoint bp : breakpoints) {
if (bp.lineID().fileName().equals(tabFilename)) {
list.add(bp);
@@ -1002,7 +1002,7 @@ public class Debugger implements VMEventListener {
} catch (IncompatibleThreadStateException ex) {
Logger.getLogger(Debugger.class.getName()).log(Level.SEVERE, null, ex);
}
return new ArrayList();
return new ArrayList<VariableNode>();
}
/**
@@ -1081,7 +1081,7 @@ public class Debugger implements VMEventListener {
* @return call stack as list of {@link DefaultMutableTreeNode}s
*/
protected List<DefaultMutableTreeNode> getStackTrace(ThreadReference t) {
List<DefaultMutableTreeNode> stack = new ArrayList();
List<DefaultMutableTreeNode> stack = new ArrayList<DefaultMutableTreeNode>();
try {
// int i = 0;
for (StackFrame f : t.frames()) {
@@ -151,7 +151,7 @@ public class ErrorBar extends JPanel {
// Error Marker index in the arraylist is LOCALIZED for current tab.
// Also, need to do the update in the UI thread to prevent concurrency issues.
final int fheight = this.getHeight();
SwingWorker worker = new SwingWorker() {
SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
protected Object doInBackground() throws Exception {
SketchCode sc = editor.getSketch().getCurrentCode();
@@ -242,10 +242,9 @@ public class ErrorBar extends JPanel {
// Find out which error/warning the user has clicked
// and then scroll to that
@SuppressWarnings("rawtypes")
@Override
public void mouseClicked(final MouseEvent e) {
SwingWorker worker = new SwingWorker() {
SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
protected Object doInBackground() throws Exception {
for (ErrorMarker eMarker : errorPoints) {
@@ -275,11 +274,10 @@ public class ErrorBar extends JPanel {
// Tooltip on hover
this.addMouseMotionListener(new MouseMotionListener() {
@SuppressWarnings("rawtypes")
@Override
public void mouseMoved(final MouseEvent evt) {
// System.out.println(e);
SwingWorker worker = new SwingWorker() {
SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
protected Object doInBackground() throws Exception {
for (ErrorMarker eMarker : errorPoints) {
@@ -35,7 +35,7 @@ public class LineHighlight implements LineListener {
protected String marker; //
protected Color markerColor;
protected int priority = 0;
protected static Set<LineHighlight> allHighlights = new HashSet();
protected static Set<LineHighlight> allHighlights = new HashSet<LineHighlight>();
protected static boolean isHighestPriority(LineHighlight hl) {
for (LineHighlight check : allHighlights) {
@@ -42,7 +42,7 @@ public class LineID implements DocumentListener {
protected int lineIdx; // the line number, 0-based
protected Document doc; // the Document to use for line number tracking
protected Position pos; // the Position acquired during line number tracking
protected Set<LineListener> listeners = new HashSet(); // listeners for line number changes
protected Set<LineListener> listeners = new HashSet<LineListener>(); // listeners for line number changes
public LineID(String fileName, int lineIdx) {
this.fileName = fileName;
@@ -187,7 +187,7 @@ public class OffsetMatcher {
}
private void minDistInGrid(int g[][], int i, int j, int fi, int fj,
char s1[], char s2[], ArrayList set) {
char s1[], char s2[], ArrayList<OffsetPair> set) {
// if(i < s1.length)System.out.print(s1[i] + " <->");
// if(j < s2.length)System.out.print(s2[j]);
if (i < s1.length && j < s2.length) {
@@ -200,7 +200,7 @@ public class SketchOutline {
}
private void updateSelection(){
SwingWorker worker = new SwingWorker() {
SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
protected Object doInBackground() throws Exception {
String text = searchField.getText().toLowerCase();
tempNode = new DefaultMutableTreeNode();
@@ -252,7 +252,7 @@ public class SketchOutline {
}
private void scrollToNode(){
SwingWorker worker = new SwingWorker() {
SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
protected Object doInBackground() throws Exception {
return null;
@@ -188,7 +188,7 @@ public class TabOutline {
}
private void updateSelection() {
SwingWorker worker = new SwingWorker() {
SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
protected Object doInBackground() throws Exception {
String text = searchField.getText().toLowerCase();
tempNode = new DefaultMutableTreeNode();
@@ -220,7 +220,7 @@ public class TabOutline {
return;
}
// log(e);
SwingWorker worker = new SwingWorker() {
SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
protected Object doInBackground() throws Exception {
return null;
@@ -53,7 +53,7 @@ public class TextArea extends JEditTextArea {
protected DebugEditor editor; // the editor
// line properties
protected Map<Integer, Color> lineColors = new HashMap(); // contains line background colors
protected Map<Integer, Color> lineColors = new HashMap<Integer, Color>(); // contains line background colors
// left-hand gutter properties
protected int gutterPadding = 3; // [px] space added to the left and right of gutter chars
@@ -66,9 +66,9 @@ public class TextArea extends JEditTextArea {
protected String currentLineMarker = "->"; // the text marker for highlighting the current line in the gutter
protected Map<Integer, String> gutterText = new HashMap(); // maps line index to gutter text
protected Map<Integer, String> gutterText = new HashMap<Integer, String>(); // maps line index to gutter text
protected Map<Integer, Color> gutterTextColors = new HashMap(); // maps line index to gutter text color
protected Map<Integer, Color> gutterTextColors = new HashMap<Integer, Color>(); // maps line index to gutter text color
protected TextAreaPainter customPainter;
@@ -207,6 +207,7 @@ public class TextArea extends JEditTextArea {
}
super.processKeyEvent(evt);
if(editor.hasJavaTabs) return; // code completion disabled if java tabs
if (evt.getID() == KeyEvent.KEY_TYPED) {
char keyChar = evt.getKeyChar();
@@ -220,7 +221,7 @@ public class TextArea extends JEditTextArea {
if (evt.isAltDown() || evt.isControlDown() || evt.isMetaDown()) {
if (ExperimentalMode.ccTriggerEnabled && keyChar == KeyEvent.VK_SPACE
&& (evt.isControlDown() || evt.isMetaDown())) {
SwingWorker worker = new SwingWorker() {
SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
protected Object doInBackground() throws Exception {
// Provide completions only if it's enabled
if (ExperimentalMode.codeCompletionsEnabled
@@ -240,7 +241,7 @@ public class TextArea extends JEditTextArea {
return;
}
SwingWorker worker = new SwingWorker() {
SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
protected Object doInBackground() throws Exception {
// errorCheckerService.runManualErrorCheck();
// Provide completions only if it's enabled
@@ -351,7 +352,7 @@ public class TextArea extends JEditTextArea {
// else {
//log2(s + " len " + s.length());
int x = getCaretPosition() - getLineStartOffset(line) - 1, x2 = x + 1, x1 = x - 1;
int x = getCaretPosition() - getLineStartOffset(line) - 1, x1 = x - 1;
if(x >= s.length() || x < 0)
return null; //TODO: Does this check cause problems? Verify.
log2(" x char: " + s.charAt(x));
@@ -651,7 +652,9 @@ public class TextArea extends JEditTextArea {
}
if (me.getButton() == MouseEvent.BUTTON3) {
fetchPhrase(me);
if(!editor.hasJavaTabs){ // tooltips, etc disabled for java tabs
fetchPhrase(me);
}
}
// forward to standard listeners
@@ -87,7 +87,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
ta = textArea;
addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
// log( " Meta,Ctrl "+ (evt.getModifiers() & ctrlMask));
if(ta.editor.hasJavaTabs) return; // Ctrl + Click disabled for java tabs
if (evt.getButton() == MouseEvent.BUTTON1) {
if (evt.isControlDown() || evt.isMetaDown())
handleCtrlClick(evt);
@@ -457,6 +457,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter
}
public String getToolTipText(java.awt.event.MouseEvent evt) {
if(ta.editor.hasJavaTabs) return null; // disabled for java tabs
int off = ta.xyToOffset(evt.getX(), evt.getY());
if (off < 0)
return null;
@@ -117,7 +117,6 @@ public class XQErrorTable extends JTable {
* @param tableModel - TableModel
* @return boolean - If table data was updated
*/
@SuppressWarnings("rawtypes")
synchronized public boolean updateTable(final TableModel tableModel) {
// If problems list is not visible, no need to update
@@ -125,7 +124,7 @@ public class XQErrorTable extends JTable {
return false;
}
SwingWorker worker = new SwingWorker() {
SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
protected Object doInBackground() throws Exception {
return null;
+4
View File
@@ -20,6 +20,10 @@ Critical Bugs
Misc Tasks
----------
-[ ] New sketchbook layout
-[ ] Better compatibility with java tabs
-[x] Trim CompilationChecker class
-[x] Refactoring should support single undo
+12
View File
@@ -1,4 +1,16 @@
0229 pde (3.0a2)
X new tab/rename dialog box
X https://github.com/processing/processing/issues/2431
pulls
X insert tabs properly when prefs set for tabs mode
X https://github.com/processing/processing/pull/2607
_ fix the build scripts to include the examples
_ https://github.com/processing/processing/issues/2652
_ reference wasn't included either
_ https://github.com/processing/processing/issues/2656
_ "Platform is ${platform}" message during 'ant clean'