diff --git a/android/done.txt b/android/done.txt
index cd56d0d1d..85b6ea642 100644
--- a/android/done.txt
+++ b/android/done.txt
@@ -1,3 +1,23 @@
+0192 android (pre)
+X compile android-core with java 5 as the target so that it works on OS X 10.5
+X A3D should use lower color depth on older devices
+X http://code.google.com/p/processing/issues/detail?id=391
+X new api for begin/endRecord()
+A Finish opengl blending modes in A3D
+A http://code.google.com/p/processing/issues/detail?id=290
+A Automatic normal calculation in A3D
+A http://code.google.com/p/processing/issues/detail?id=345
+A Improve texture handling in A3D's PFont
+A http://code.google.com/p/processing/issues/detail?id=394
+A OpenGL resource release mechanism in A3D is broken
+A http://code.google.com/p/processing/issues/detail?id=456
+A Multitexturing in A3D
+A http://code.google.com/p/processing/issues/detail?id=344
+A Problems when loading images asynchronously in A3D.
+A http://code.google.com/p/processing/issues/detail?id=465
+X make several changes to get android running properly with sdk tools r8
+
+
0191 android (pre)
X won't interpret size() in Android Mode without spaces between arguments
X http://code.google.com/p/processing/issues/detail?id=390
diff --git a/android/todo.txt b/android/todo.txt
index ace098ca3..68a2d4d08 100644
--- a/android/todo.txt
+++ b/android/todo.txt
@@ -1,19 +1,13 @@
-0192 android
-X compile android-core with java 5 as the target so that it works on OS X 10.5
-X A3D should use lower color depth on older devices
-X http://code.google.com/p/processing/issues/detail?id=391
-X new api for begin/endRecord()
-A Finish opengl blending modes in A3D
-A http://code.google.com/p/processing/issues/detail?id=290
-A Automatic normal calculation in A3D
-A http://code.google.com/p/processing/issues/detail?id=345
-A Improve texture handling in A3D's PFont
-A http://code.google.com/p/processing/issues/detail?id=394
-A OpenGL resource release mechanism in A3D is broken
-A http://code.google.com/p/processing/issues/detail?id=456
-A Multitexturing in A3D
-A http://code.google.com/p/processing/issues/detail?id=344
-X make several changes to get android running properly with sdk tools r8
+0193 android
+
+
+_ error in 'create avd' with "Emulator already exists" when it needs an upgrade
+_ or cannot be used with the current setup
+_ use 'android list avds' on the command line to see the problem in this case
+_ when there's a 'create avd' error, things still keep running. yay!
+
+_ need to do this for utf8: "overridable Ant javac properties: java.encoding"
+_ new for sdk tools r8, it's using ascii as the default, we're utf-8
_ error in 'create avd' with "Emulator already exists" when it needs an upgrade
_ or cannot be used with the current setup
@@ -31,6 +25,11 @@ _ to create the new sdk object
_ need to do this for utf8: "overridable Ant javac properties: java.encoding"
_ new for sdk tools r8, it's using ascii as the default, we're utf-8
+_ just use generic android apis as requirement, not the google apis
+_ though it does give us the emulator skin.. maybe another option
+
+_ need to do something to make it easier to do new screen sizes.
+
_ when returning to android application, sometimes screen stays black
_ http://code.google.com/p/processing/issues/detail?id=237
@@ -47,6 +46,9 @@ _ javac.exe not included with the download
_ verify that processing-core.jar has downloaded properly
_ http://code.google.com/p/processing/issues/detail?id=421
+_ this is the download page:
+_ http://code.google.com/p/processing/downloads/detail?name=processing-android-core-0191.zip
+_ so look for "SHA1 Checksum: 1ed63f9316441fe46949ef5a92a28f58cc7ee226"
_ gui stuff: http://hg.postspectacular.com/cp5magic/wiki/Home
diff --git a/android/tool/src/processing/app/tools/android/AndroidDevice.java b/android/tool/src/processing/app/tools/android/AndroidDevice.java
index fb309fbc6..7818315d3 100644
--- a/android/tool/src/processing/app/tools/android/AndroidDevice.java
+++ b/android/tool/src/processing/app/tools/android/AndroidDevice.java
@@ -8,7 +8,8 @@ import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import processing.app.debug.RunnerListener;
+
+import processing.app.RunnerListener;
import processing.app.exec.LineProcessor;
import processing.app.exec.ProcessRegistry;
import processing.app.exec.ProcessResult;
diff --git a/android/tool/src/processing/app/tools/android/AndroidMode.java b/android/tool/src/processing/app/tools/android/AndroidMode.java
index a631d7f6e..5fc1d4a39 100644
--- a/android/tool/src/processing/app/tools/android/AndroidMode.java
+++ b/android/tool/src/processing/app/tools/android/AndroidMode.java
@@ -39,15 +39,17 @@ import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import processing.app.*;
-import processing.app.debug.*;
import processing.core.PApplet;
+import processing.mode.java.JavaMode;
+import processing.mode.java.runner.Runner;
// http://dl.google.com/android/repository/repository.xml
// http://dl.google.com/android/android-sdk_r3-mac.zip
// http://dl.google.com/android/repository/tools_r03-macosx.zip
-public class AndroidMode implements DeviceListener {
+
+public class AndroidMode extends JavaMode implements DeviceListener {
private AndroidSDK sdk;
private Editor editor;
private Build build;
@@ -71,6 +73,25 @@ public class AndroidMode implements DeviceListener {
JCheckBoxMenuItem toggleItem;
+
+ public AndroidMode(Base base, File folder) {
+ super(base, folder);
+ }
+
+
+ @Override
+ public Editor createEditor(Base base, String path, int[] location) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ @Override
+ public String getTitle() {
+ return "Android";
+ }
+
+
public void init(final Editor parent, final JMenuBar menubar) {
this.editor = parent;
@@ -107,7 +128,7 @@ public class AndroidMode implements DeviceListener {
item = new JMenuItem("Sketch Permissions");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- new Permissions(editor);
+ new Permissions(editor.getSketch());
}
});
menu.add(item);
@@ -212,7 +233,7 @@ public class AndroidMode implements DeviceListener {
}
// otherwise do the usual
- return new File(Base.getSketchbookFolder(), ANDROID_CORE_FILENAME);
+ return new File(base.getSketchbookFolder(), ANDROID_CORE_FILENAME);
}
@@ -504,9 +525,9 @@ public class AndroidMode implements DeviceListener {
if (lm.find()) {
final String filename = lm.group(1);
final int lineNumber = Integer.parseInt(lm.group(2)) - 1;
- final RunnerException rex = editor.getSketch().placeException(
- exceptionLine, filename, lineNumber);
- editor.statusError(rex == null ? new RunnerException(exceptionLine,
+ final SketchException rex =
+ editor.getSketch().placeException(exceptionLine, filename, lineNumber);
+ editor.statusError(rex == null ? new SketchException(exceptionLine,
false) : rex);
return;
}
@@ -599,5 +620,4 @@ public class AndroidMode implements DeviceListener {
@SuppressWarnings("serial")
private static class MonitorCanceled extends Exception {
}
-
}
\ No newline at end of file
diff --git a/android/tool/src/processing/app/tools/android/Build.java b/android/tool/src/processing/app/tools/android/Build.java
index ac24436e2..30fe3e005 100644
--- a/android/tool/src/processing/app/tools/android/Build.java
+++ b/android/tool/src/processing/app/tools/android/Build.java
@@ -28,15 +28,14 @@ import org.apache.tools.ant.*;
import processing.app.*;
import processing.app.exec.*;
-import processing.app.debug.RunnerException;
import processing.core.PApplet;
-class Build {
+class Build extends processing.mode.java.Build {
static final String basePackage = "processing.android.test";
static final String sdkVersion = "7";
- private final Editor editor;
+// private final Editor editor;
private final AndroidSDK sdk;
Manifest manifest;
@@ -45,14 +44,15 @@ class Build {
File buildFile;
- public Build(final Editor editor, final AndroidSDK sdk) {
- this.editor = editor;
+ public Build(final Sketch sketch, final AndroidSDK sdk) {
+ super(sketch);
+// this.editor = editor;
this.sdk = sdk;
}
public File createProject(String target) {
- final Sketch sketch = editor.getSketch();
+// final Sketch sketch = editor.getSketch();
try {
tempBuildFolder = createTempBuildFolder(sketch);
@@ -77,9 +77,9 @@ class Build {
editor.statusError("Could not parse the size() command.");
return null;
}
- className = sketch.preprocess(srcFolder.getAbsolutePath(),
- manifest.getPackageName(),
- preproc);
+ className = preprocess(srcFolder.getAbsolutePath(),
+ manifest.getPackageName(),
+ preproc);
if (className != null) {
// final File androidXML = new File(tempBuildFolder, "AndroidManifest.xml");
// writeAndroidManifest(androidXML, sketch.getName(), className);
@@ -113,10 +113,10 @@ class Build {
}
} catch (final IOException e) {
e.printStackTrace();
- throw new RunnerException(e.getMessage());
+ throw new SketchException(e.getMessage());
}
}
- } catch (final RunnerException e) {
+ } catch (final SketchException e) {
editor.statusError(e);
return null;
} catch (final IOException e) {
@@ -149,7 +149,7 @@ class Build {
protected File createExportFolder() throws IOException {
- Sketch sketch = editor.getSketch();
+// Sketch sketch = editor.getSketch();
// Create the 'android' build folder, and move any existing version out.
File androidFolder = new File(sketch.getFolder(), "android");
if (androidFolder.exists()) {
@@ -259,11 +259,11 @@ class Build {
final int javacIndex = line.indexOf(javacPrefix);
if (javacIndex != -1) {
// System.out.println("checking: " + line);
- final Sketch sketch = editor.getSketch();
+// final Sketch sketch = editor.getSketch();
// String sketchPath = sketch.getFolder().getAbsolutePath();
- final int offset = javacIndex + javacPrefix.length() + 1;
- final String[] pieces = PApplet.match(line.substring(offset),
- "^(.+):([0-9]+):\\s+(.+)$");
+ int offset = javacIndex + javacPrefix.length() + 1;
+ String[] pieces =
+ PApplet.match(line.substring(offset), "^(.+):([0-9]+):\\s+(.+)$");
if (pieces != null) {
// PApplet.println(pieces);
String fileName = pieces[1];
@@ -272,7 +272,7 @@ class Build {
final int lineNumber = PApplet.parseInt(pieces[2]) - 1;
// PApplet.println("looking for " + fileName + " line " +
// lineNumber);
- final RunnerException rex = sketch.placeException(pieces[3],
+ final SketchException rex = placeException(pieces[3],
fileName, lineNumber);
if (rex != null) {
rex.hideStackTrace();
@@ -368,7 +368,7 @@ class Build {
static final String ICON_36 = "icon-36.png";
private void writeRes(File resFolder,
- String className) throws RunnerException {
+ String className) throws SketchException {
File layoutFolder = mkdirs(resFolder, "layout");
File layoutFile = new File(layoutFolder, "main.xml");
writeResLayoutMain(layoutFile);
@@ -434,11 +434,10 @@ class Build {
}
- private File mkdirs(final File parent, final String name)
- throws RunnerException {
+ private File mkdirs(final File parent, final String name) throws SketchException {
final File result = new File(parent, name);
if (!(result.exists() || result.mkdirs())) {
- throw new RunnerException("Could not create " + result);
+ throw new SketchException("Could not create " + result);
}
return result;
}
@@ -476,7 +475,7 @@ class Build {
final File assetsFolder) throws IOException {
// Copy any libraries to the 'libs' folder
final Sketch sketch = editor.getSketch();
- for (LibraryFolder library : sketch.getImportedLibraries()) {
+ for (Library library : sketch.getImportedLibraries()) {
File libraryFolder = new File(library.getPath());
// in the list is a File object that points the
// library sketch's "library" folder
diff --git a/android/tool/src/processing/app/tools/android/Manifest.java b/android/tool/src/processing/app/tools/android/Manifest.java
index fd7046249..7ca67795e 100644
--- a/android/tool/src/processing/app/tools/android/Manifest.java
+++ b/android/tool/src/processing/app/tools/android/Manifest.java
@@ -45,7 +45,7 @@ public class Manifest {
"file. Only the first activity entry will be updated, and you better \n" +
"hope that's the right one, smartypants.";
- private Editor editor;
+// private Editor editor;
private Sketch sketch;
// entries we care about from the manifest file
@@ -55,15 +55,19 @@ public class Manifest {
private XMLElement xml;
- public Manifest(Editor editor) {
- this.editor = editor;
- this.sketch = editor.getSketch();
+// public Manifest(Editor editor) {
+// this.editor = editor;
+// this.sketch = editor.getSketch();
+// load();
+// }
+ public Manifest(Sketch sketch) {
+ this.sketch = sketch;
load();
}
private String defaultPackageName() {
- Sketch sketch = editor.getSketch();
+// Sketch sketch = editor.getSketch();
return Build.basePackage + "." + sketch.getName().toLowerCase();
}
diff --git a/android/tool/src/processing/app/tools/android/Permissions.java b/android/tool/src/processing/app/tools/android/Permissions.java
index 55c6a4946..e90373a36 100644
--- a/android/tool/src/processing/app/tools/android/Permissions.java
+++ b/android/tool/src/processing/app/tools/android/Permissions.java
@@ -31,8 +31,8 @@ import javax.swing.border.*;
import javax.swing.event.*;
import processing.app.Base;
-import processing.app.Editor;
import processing.app.Preferences;
+import processing.app.Sketch;
public class Permissions extends JFrame {
@@ -47,13 +47,14 @@ public class Permissions extends JFrame {
JLabel descriptionLabel;
// JTextArea descriptionLabel;
- Editor editor;
+// Editor editor;
+ Sketch sketch;
- public Permissions(Editor editor) {
+ public Permissions(Sketch sketch) {
//public Permissions(Editor editor) {
super("Android Permissions Selector");
- this.editor = editor;
+// this.editor = editor;
// XMLElement xml =
@@ -287,7 +288,7 @@ public class Permissions extends JFrame {
setLocation((screen.width - windowSize.width) / 2,
(screen.height - windowSize.height) / 2);
- Manifest mf = new Manifest(editor);
+ Manifest mf = new Manifest(sketch);
setSelections(mf.getPermissions());
// show the window and get to work
@@ -325,7 +326,7 @@ public class Permissions extends JFrame {
protected void saveSelections() {
String[] sel = getSelections();
- Manifest mf = new Manifest(editor);
+ Manifest mf = new Manifest(sketch);
mf.setPermissions(sel);
}
diff --git a/android/tool/src/processing/app/tools/android/Preprocessor.java b/android/tool/src/processing/app/tools/android/Preprocessor.java
index 68cb4b179..554969959 100644
--- a/android/tool/src/processing/app/tools/android/Preprocessor.java
+++ b/android/tool/src/processing/app/tools/android/Preprocessor.java
@@ -29,10 +29,10 @@ import java.util.List;
import processing.app.Base;
import processing.app.Preferences;
import processing.app.Sketch;
-import processing.app.debug.RunnerException;
-import processing.app.preproc.PdePreprocessor;
-import processing.app.preproc.PreprocessResult;
+import processing.app.SketchException;
import processing.core.PApplet;
+import processing.mode.java.preproc.PdePreprocessor;
+import processing.mode.java.preproc.PreprocessorResult;
import antlr.RecognitionException;
import antlr.TokenStreamException;
@@ -63,8 +63,8 @@ public class Preprocessor extends PdePreprocessor {
// actually used in the applet, which is the case especially for anyone
// who is cutting/pasting from the reference.
- String scrubbed = Sketch.scrubComments(sketch.getCode(0).getProgram());
- String[] matches = PApplet.match(scrubbed, Sketch.SIZE_REGEX);
+ String scrubbed = processing.mode.java.Build.scrubComments(sketch.getCode(0).getProgram());
+ String[] matches = PApplet.match(scrubbed, processing.mode.java.Build.SIZE_REGEX);
// PApplet.println("matches: " + Sketch.SIZE_REGEX);
// PApplet.println(matches);
@@ -112,8 +112,8 @@ public class Preprocessor extends PdePreprocessor {
}
- public PreprocessResult write(Writer out, String program, String codeFolderPackages[])
- throws RunnerException, RecognitionException, TokenStreamException {
+ public PreprocessorResult write(Writer out, String program, String codeFolderPackages[])
+ throws SketchException, RecognitionException, TokenStreamException {
if (sizeStatement != null) {
int start = program.indexOf(sizeStatement);
program = program.substring(0, start) +
diff --git a/app/.settings/org.eclipse.jdt.core.prefs b/app/.settings/org.eclipse.jdt.core.prefs
index b3b09b806..5d3c88c4d 100644
--- a/app/.settings/org.eclipse.jdt.core.prefs
+++ b/app/.settings/org.eclipse.jdt.core.prefs
@@ -1,323 +1,325 @@
-#Mon Feb 22 14:47:49 EST 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=ignore
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=20
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=36
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=0
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=false
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=2
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=80
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=space
-org.eclipse.jdt.core.formatter.tabulation.size=2
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+#Sat Dec 04 17:03:59 EST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=36
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=1
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=2
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=80
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=2
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
diff --git a/app/ParserTests.launch b/app/ParserTests.launch
index c2242e67a..346f4a383 100644
--- a/app/ParserTests.launch
+++ b/app/ParserTests.launch
@@ -1,7 +1,7 @@
-
+
@@ -17,6 +17,6 @@
-
+
diff --git a/app/src/antlr/ExtendedCommonASTWithHiddenTokens.java b/app/src/antlr/ExtendedCommonASTWithHiddenTokens.java
index dcbaa7586..07f4f510c 100644
--- a/app/src/antlr/ExtendedCommonASTWithHiddenTokens.java
+++ b/app/src/antlr/ExtendedCommonASTWithHiddenTokens.java
@@ -8,9 +8,9 @@ package antlr;
*/
import java.io.*;
-//import antlr.*;
+
import antlr.collections.*;
-//import antlr.collections.impl.*;
+
/** A CommonAST whose initialization copies hidden token
* information from the Token used to create a node.
diff --git a/app/src/antlr/TokenStreamCopyingHiddenTokenFilter.java b/app/src/antlr/TokenStreamCopyingHiddenTokenFilter.java
index cd3306aed..82055ea5c 100644
--- a/app/src/antlr/TokenStreamCopyingHiddenTokenFilter.java
+++ b/app/src/antlr/TokenStreamCopyingHiddenTokenFilter.java
@@ -1,10 +1,8 @@
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
package antlr;
-//package processing.app.preproc;
-//import antlr.*;
import antlr.collections.impl.BitSet;
/**
diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java
index 8a901aebe..f18b80d3a 100644
--- a/app/src/processing/app/Base.java
+++ b/app/src/processing/app/Base.java
@@ -27,10 +27,12 @@ import java.awt.event.*;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
+import java.util.zip.*;
import javax.swing.*;
import processing.core.*;
+import processing.mode.java.*;
/**
@@ -40,9 +42,9 @@ import processing.core.*;
* files and images, etc) that comes from that.
*/
public class Base {
- static final int REVISION = 192;
+ static final int REVISION = 193;
/** This might be replaced by main() if there's a lib/version.txt file. */
- static public String VERSION_NAME = "0192";
+ static public String VERSION_NAME = "0193";
/** Set true if this a proper release rather than a numbered revision. */
static public boolean RELEASE = false;
/** True if heavy debugging error/log messages are enabled */
@@ -73,37 +75,28 @@ public class Base {
// so that the errors while building don't show up again.
boolean builtOnce;
- static File buildFolder;
-
- // these are static because they're used by Sketch
- static private File examplesFolder;
- static private File librariesFolder;
- static private File toolsFolder;
-
- ArrayList coreLibraries;
- ArrayList contribLibraries;
-
- // maps imported packages to their library folder
-// static HashMap importToLibraryTable;
- static HashMap importToLibraryTable;
-
- // classpath for all known libraries for p5
- // (both those in the p5/libs folder and those with lib subfolders
- // found in the sketchbook)
-// static public String librariesClassPath;
+// static File buildFolder;
// Location for untitled items
static File untitledFolder;
java.util.List editors =
Collections.synchronizedList(new ArrayList());
- Editor activeEditor;
+ protected Editor activeEditor;
// a lone file menu to be used when all sketch windows are closed
static public JMenu defaultFileMenu;
+ private Mode[] modeList;
+ private Mode defaultMode = new JavaMode(this, getContentFile("modes/java"));
+
+ private JMenu sketchbookMenu;
+
+ protected File sketchbookFolder;
+ protected File toolsFolder;
+
static public void main(final String[] args) {
- javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ EventQueue.invokeLater(new Runnable() {
public void run() {
createAndShowGUI(args);
}
@@ -140,7 +133,7 @@ public class Base {
Preferences.init(null);
// setup the theme coloring fun
- Theme.init();
+// Theme.init();
// Set the look and feel before opening the window
try {
@@ -155,14 +148,23 @@ public class Base {
}
// Create a location for untitled sketches
- untitledFolder = createTempFolder("untitled");
- untitledFolder.deleteOnExit();
+ try {
+ untitledFolder = Base.createTempFolder("untitled", "sketches");
+ untitledFolder.deleteOnExit();
+ } catch (IOException e) {
+ //e.printStackTrace();
+ Base.showError("Trouble without a name",
+ "Could not create a place to store untitled sketches.\n" +
+ "That's gonna prevent us from continuing.", e);
+ }
+// System.out.println("about to create base...");
new Base(args);
+// System.out.println("done creating base...");
}
- static protected void setCommandLine() {
+ public static void setCommandLine() {
commandLine = true;
}
@@ -191,7 +193,7 @@ public class Base {
}
- static protected void initRequirements() {
+ public static void initRequirements() {
try {
Class.forName("com.sun.jdi.VirtualMachine");
} catch (ClassNotFoundException cnfe) {
@@ -205,42 +207,14 @@ public class Base {
public Base(String[] args) {
- // Get paths for the libraries and examples in the Processing folder
- //String workingDirectory = System.getProperty("user.dir");
- examplesFolder = getContentFile("examples");
- librariesFolder = getContentFile("libraries");
- toolsFolder = getContentFile("tools");
-
// Put this after loading the examples, so that building the default file
// menu works on Mac OS X (since it needs examplesFolder to be set).
platform.init(this);
+ toolsFolder = getContentFile("tools");
+
// Get the sketchbook path, and make sure it's set properly
- String sketchbookPath = Preferences.get("sketchbook.path");
-
- // If a value is at least set, first check to see if the folder exists.
- // If it doesn't, warn the user that the sketchbook folder is being reset.
- if (sketchbookPath != null) {
- File skechbookFolder = new File(sketchbookPath);
- if (!skechbookFolder.exists()) {
- Base.showWarning("Sketchbook folder disappeared",
- "The sketchbook folder no longer exists.\n" +
- "Processing will switch to the default sketchbook\n" +
- "location, and create a new sketchbook folder if\n" +
- "necessary. Procesing will then stop talking about\n" +
- "himself in the third person.", null);
- sketchbookPath = null;
- }
- }
-
- // If no path is set, get the default sketchbook folder for this platform
- if (sketchbookPath == null) {
- File defaultFolder = getDefaultSketchbookFolder();
- Preferences.set("sketchbook.path", defaultFolder.getAbsolutePath());
- if (!defaultFolder.exists()) {
- defaultFolder.mkdirs();
- }
- }
+ determineSketchbookFolder();
// Check if there were previously opened sketches to be restored
boolean opened = restoreSketches();
@@ -267,7 +241,10 @@ public class Base {
// Create a new empty window (will be replaced with any files to be opened)
if (!opened) {
+ System.out.println("opening a new window");
handleNew();
+ } else {
+ System.out.println("something else was opened");
}
// check for updates
@@ -277,6 +254,21 @@ public class Base {
}
+ /**
+ * Single location for the default extension, rather than hardwiring .pde
+ * all over the place. While it may seem like fun to send the Arduino guys
+ * on a treasure hunt, it gets old after a while.
+ */
+ static protected String getExtension() {
+ return ".pde";
+ }
+
+
+ public Mode getDefaultMode() {
+ return defaultMode;
+ }
+
+
/**
* Post-constructor setup for the editor area. Loads the last
* sketch that was used (if any), and restores other Editor settings.
@@ -462,162 +454,20 @@ public class Base {
}
- // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-
- static JMenu sketchbookMenu;
- static JMenu examplesMenu;
- static JMenu importMenu;
-
-
- public JMenu buildFileMenu(final Editor editor) {
- JMenuItem item;
- JMenu fileMenu = new JMenu("File");
-
- item = newJMenuItem("New", 'N');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- handleNew();
- }
- });
- fileMenu.add(item);
-
- item = newJMenuItem("Open...", 'O');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- handleOpenPrompt();
- }
- });
- fileMenu.add(item);
-
- if (sketchbookMenu == null) {
- sketchbookMenu = new JMenu("Sketchbook");
- rebuildSketchbookMenu(sketchbookMenu);
- }
- fileMenu.add(sketchbookMenu);
-
- if (examplesMenu == null) {
- examplesMenu = new JMenu("Examples");
- rebuildExamplesMenu(examplesMenu);
- }
- fileMenu.add(examplesMenu);
-
- item = newJMenuItem("Close", 'W');
- if (editor != null) {
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- handleClose(editor);
- }
- });
- } else {
- item.setEnabled(false);
- }
- fileMenu.add(item);
-
- item = newJMenuItem("Save", 'S');
- if (editor != null) {
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- editor.handleSave(false);
- }
- });
- editor.setSaveItem(item);
- } else {
- item.setEnabled(false);
- }
- fileMenu.add(item);
-
- item = newJMenuItemShift("Save As...", 'S');
- if (editor != null) {
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- editor.handleSaveAs();
- }
- });
- editor.setSaveAsItem(item);
- } else {
- item.setEnabled(false);
- }
- fileMenu.add(item);
-
- item = newJMenuItem("Export", 'E');
- if (editor != null) {
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- editor.handleExport();
- }
- });
- } else {
- item.setEnabled(false);
- }
- fileMenu.add(item);
-
- item = newJMenuItemShift("Export Application", 'E');
- if (editor != null) {
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- editor.handleExportApplication();
- }
- });
- } else {
- item.setEnabled(false);
- }
- fileMenu.add(item);
-
- fileMenu.addSeparator();
-
- item = newJMenuItemShift("Page Setup", 'P');
- if (editor != null) {
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- editor.handlePageSetup();
- }
- });
- } else {
- item.setEnabled(false);
- }
- fileMenu.add(item);
-
- item = newJMenuItem("Print", 'P');
- if (editor != null) {
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- editor.handlePrint();
- }
- });
- } else {
- item.setEnabled(false);
- }
- fileMenu.add(item);
-
- // Mac OS X already has its own preferences and quit menu.
- // That's right! Think different, b*tches!
- if (!Base.isMacOS()) {
- fileMenu.addSeparator();
-
- item = newJMenuItem("Preferences", ',');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- handlePrefs();
- }
- });
- fileMenu.add(item);
-
- fileMenu.addSeparator();
-
- item = newJMenuItem("Quit", 'Q');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- handleQuit();
- }
- });
- fileMenu.add(item);
- }
- return fileMenu;
+ static public void addDisabledItem(JMenu menu, String title) {
+ JMenuItem item = new JMenuItem(title);
+ item.setEnabled(false);
+ menu.add(item);
}
- // .................................................................
+ // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+
+ /** Returns the frontmost, active editor window. */
+ public Editor getActiveEditor() {
+ return activeEditor;
+ }
// Because of variations in native windowing systems, no guarantees about
@@ -629,6 +479,9 @@ public class Base {
// set the current window to be the console that's getting output
EditorConsole.setEditor(activeEditor);
+
+ // make this the next mode to be loaded
+ defaultMode = whichEditor.getMode();
}
@@ -676,7 +529,16 @@ public class Base {
}
- // .................................................................
+// /**
+// * Return the same mode as the active editor, or the default mode, which
+// * begins as Java/Standard, but is updated with the last mode used.
+// */
+// protected Mode nextEditorMode() {
+// return (activeEditor == null) ? defaultMode : activeEditor.getMode();
+// }
+
+
+ // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
boolean breakTime = false;
@@ -697,7 +559,7 @@ public class Base {
// In 0126, untitled sketches will begin in the temp folder,
// and then moved to a new location because Save will default to Save As.
- File sketchbookDir = getSketchbookFolder();
+// File sketchbookDir = getSketchbookFolder();
File newbieParentDir = untitledFolder;
String prefix = Preferences.get("editor.untitled.prefix");
@@ -740,13 +602,13 @@ public class Base {
newbieDir = new File(newbieParentDir, newbieName);
index++;
// Make sure it's not in the temp folder *and* it's not in the sketchbook
- } while (newbieDir.exists() || new File(sketchbookDir, newbieName).exists());
+ } while (newbieDir.exists() || new File(sketchbookFolder, newbieName).exists());
// Make the directory for the new sketch
newbieDir.mkdirs();
// Make an empty pde file
- File newbieFile = new File(newbieDir, newbieName + ".pde");
+ File newbieFile = new File(newbieDir, newbieName + getExtension());
new FileOutputStream(newbieFile); // create the file
return newbieFile.getAbsolutePath();
}
@@ -761,11 +623,15 @@ public class Base {
if (path != null) {
Editor editor = handleOpen(path);
editor.untitled = true;
+ } else {
+ System.err.println("untitled went null...");
}
} catch (IOException e) {
if (activeEditor != null) {
activeEditor.statusError(e);
+ } else {
+ e.printStackTrace();
}
}
}
@@ -838,7 +704,7 @@ public class Base {
public boolean accept(File dir, String name) {
// TODO this doesn't seem to ever be used. AWESOME.
//System.out.println("check filter on " + dir + " " + name);
- return name.toLowerCase().endsWith(".pde");
+ return name.toLowerCase().endsWith(getExtension());
}
});
@@ -871,11 +737,11 @@ public class Base {
File file = new File(path);
if (!file.exists()) return null;
-
+
if (!Sketch.isSanitaryName(file.getName())) {
Base.showWarning("You're tricky, but not tricky enough",
file.getName() + " is not a valid name for a sketch.\n" +
- "Better to stick to ASCII, no spaces, and make sure\n" +
+ "Better to stick to ASCII, no spaces, and make sure\n" +
"it doesn't start with a number.", null);
return null;
}
@@ -905,7 +771,8 @@ public class Base {
// }
// System.err.println(" creating new editor");
- Editor editor = new Editor(this, path, location);
+// Editor editor = new Editor(this, defaultMode, path, location);
+ Editor editor = defaultMode.createEditor(this, path, location);
// Editor editor = null;
// try {
// editor = new Editor(this, path, location);
@@ -955,6 +822,8 @@ public class Base {
// if (Preferences.getBoolean("sketchbook.closing_last_window_quits") ||
// (editor.untitled && !editor.getSketch().isModified())) {
if (Base.isMacOS()) {
+ // If the central menubar isn't supported on this OS X JVM,
+ // we have to do the old behavior. Yuck!
if (defaultFileMenu == null) {
Object[] options = { "OK", "Cancel" };
String prompt =
@@ -995,8 +864,9 @@ public class Base {
} else {
editor.setVisible(false);
editor.dispose();
- defaultFileMenu.insert(Base.sketchbookMenu, 2);
- defaultFileMenu.insert(Base.examplesMenu, 3);
+ defaultFileMenu.insert(sketchbookMenu, 2);
+// defaultFileMenu.insert(Base.examplesMenu, 3);
+ defaultFileMenu.insert(defaultMode.getExamplesMenu(), 3);
activeEditor = null;
}
@@ -1082,8 +952,11 @@ public class Base {
EventQueue.invokeLater(new Runnable() {
public void run() {
//System.out.println("starting rebuild");
- rebuildSketchbookMenu(sketchbookMenu);
- rebuildToolbarMenu(Editor.toolbarMenu);
+// rebuildSketchbookMenu(sketchbookMenu);
+ rebuildSketchbookMenu();
+ for (Mode mode : modeList) {
+ mode.rebuildToolbarMenu();
+ }
//System.out.println("done with rebuild");
}
});
@@ -1091,144 +964,24 @@ public class Base {
}
- protected void rebuildToolbarMenu(JMenu menu) {
- JMenuItem item;
- menu.removeAll();
-
- //System.out.println("rebuilding toolbar menu");
- // Add the single "Open" item
- item = newJMenuItem("Open...", 'O');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- handleOpenPrompt();
- }
- });
- menu.add(item);
- menu.addSeparator();
-
- // Add a list of all sketches and subfolders
- try {
- boolean sketches = addSketches(menu, getSketchbookFolder(), true);
- //boolean sketches = addSketches(menu, getSketchbookFolder());
- if (sketches) menu.addSeparator();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- //System.out.println("rebuilding examples menu");
- // Add each of the subfolders of examples directly to the menu
- try {
- addSketches(menu, examplesFolder, true);
- //addSketches(menu, examplesFolder);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
-
- protected void rebuildSketchbookMenu(JMenu menu) {
+ protected void rebuildSketchbookMenu() { //JMenu menu) {
//System.out.println("rebuilding sketchbook menu");
//new Exception().printStackTrace();
try {
- menu.removeAll();
- addSketches(menu, getSketchbookFolder(), false);
- //addSketches(menu, getSketchbookFolder());
+ sketchbookMenu.removeAll();
+ addSketches(sketchbookMenu, sketchbookFolder, false);
} catch (IOException e) {
e.printStackTrace();
}
}
- public void rebuildLibraryList() {
- // reset the table mapping imports to libraries
- importToLibraryTable = new HashMap();
-
- try {
- coreLibraries = LibraryFolder.list(librariesFolder);
- contribLibraries = LibraryFolder.list(getSketchbookLibrariesFolder());
- } catch (IOException e) {
- Base.showWarning("Unhappiness",
- "An error occurred while loading libraries.\n" +
- "not all the books will be in place.", e);
- }
- }
-
-
-// PrintWriter pw;
-
- public void rebuildImportMenu() { //JMenu importMenu) {
- //System.out.println("rebuilding import menu");
- importMenu.removeAll();
-
- rebuildLibraryList();
-
- ActionListener listener = new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- activeEditor.getSketch().importLibrary(e.getActionCommand());
- }
- };
-
-// try {
-// pw = new PrintWriter(new FileWriter(System.getProperty("user.home") + "/Desktop/libs.csv"));
-// } catch (IOException e1) {
-// e1.printStackTrace();
-// }
-
- for (LibraryFolder library : coreLibraries) {
- JMenuItem item = new JMenuItem(library.getName());
- item.addActionListener(listener);
- item.setActionCommand(library.getJarPath());
- importMenu.add(item);
- }
-
- if (contribLibraries.size() != 0) {
- importMenu.addSeparator();
- JMenuItem contrib = new JMenuItem("Contributed");
- contrib.setEnabled(false);
-
- for (LibraryFolder library : contribLibraries) {
- JMenuItem item = new JMenuItem(library.getName());
- item.addActionListener(listener);
- item.setActionCommand(library.getJarPath());
- importMenu.add(item);
- }
- }
-
-// // Add from the "libraries" subfolder in the Processing directory
-// try {
-// addLibraries(importMenu, librariesFolder);
-// } catch (IOException e) {
-// e.printStackTrace();
-// }
-// // Add libraries found in the sketchbook folder
-// int separatorIndex = importMenu.getItemCount();
-// try {
-// File sketchbookLibraries = getSketchbookLibrariesFolder();
-// boolean found = addLibraries(importMenu, sketchbookLibraries);
-// if (found) {
-// JMenuItem contrib = new JMenuItem("Contributed");
-// contrib.setEnabled(false);
-// importMenu.insert(contrib, separatorIndex);
-// importMenu.insertSeparator(separatorIndex);
-// }
-// } catch (IOException e) {
-// e.printStackTrace();
-// }
-
-// pw.flush();
-// pw.close();
- }
-
-
- public void rebuildExamplesMenu(JMenu menu) {
- //System.out.println("rebuilding examples menu");
- try {
- menu.removeAll();
- addSketches(menu, examplesFolder, false);
- //addSketches(menu, examplesFolder);
- } catch (IOException e) {
- e.printStackTrace();
+ public JMenu getSketchbookMenu() {
+ if (sketchbookMenu == null) {
+ sketchbookMenu = new JMenu("Sketchbook");
+ rebuildSketchbookMenu();
}
+ return sketchbookMenu;
}
@@ -1266,7 +1019,7 @@ public class Base {
handleOpen(path);
}
} else {
- showWarning("Sketch Does Not Exist",
+ showWarning("Sketch Disappeared",
"The selected sketch no longer exists.\n" +
"You may need to restart Processing to update\n" +
"the sketchbook menu.", null);
@@ -1285,7 +1038,7 @@ public class Base {
File subfolder = new File(folder, list[i]);
if (!subfolder.isDirectory()) continue;
- File entry = new File(subfolder, list[i] + ".pde");
+ File entry = new File(subfolder, list[i] + getExtension());
// if a .pde file of the same prefix as the folder exists..
if (entry.exists()) {
//String sanityCheck = sanitizedName(list[i]);
@@ -1325,110 +1078,6 @@ public class Base {
}
- /*
- protected boolean addLibraries(JMenu menu, File folder) throws IOException {
- if (!folder.isDirectory()) return false;
-
- String list[] = folder.list(new FilenameFilter() {
- public boolean accept(File dir, String name) {
- // skip .DS_Store files, .svn folders, etc
- if (name.charAt(0) == '.') return false;
- if (name.equals("CVS")) return false;
- return (new File(dir, name).isDirectory());
- }
- });
- // if a bad folder or something like that, this might come back null
- if (list == null) return false;
-
- // alphabetize list, since it's not always alpha order
- // replaced hella slow bubble sort with this feller for 0093
- Arrays.sort(list, String.CASE_INSENSITIVE_ORDER);
-
- ActionListener listener = new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- activeEditor.getSketch().importLibrary(e.getActionCommand());
- }
- };
-
- boolean ifound = false;
-
- for (String potentialName : list) {
- File subfolder = new File(folder, potentialName);
- File libraryFolder = new File(subfolder, "library");
- File libraryJar = new File(libraryFolder, potentialName + ".jar");
- // If a .jar file of the same prefix as the folder exists
- // inside the 'library' subfolder of the sketch
- if (libraryJar.exists()) {
- String sanityCheck = Sketch.sanitizeName(potentialName);
- if (!sanityCheck.equals(potentialName)) {
- String mess =
- "The library \"" + potentialName + "\" cannot be used.\n" +
- "Library names must contain only basic letters and numbers.\n" +
- "(ASCII only and no spaces, and it cannot start with a number)";
- Base.showMessage("Ignoring bad library name", mess);
- continue;
- }
-
- String libraryName = potentialName;
- File exportFile = new File(libraryFolder, "export.txt");
-// System.out.println(exportFile.getAbsolutePath());
- if (exportFile.exists()) {
- String[] exportLines = PApplet.loadStrings(exportFile);
- for (String line : exportLines) {
- String[] pieces = PApplet.trim(PApplet.split(line, '='));
-// System.out.println(pieces);
- if (pieces[0].equals("name")) {
- libraryName = pieces[1].trim();
- }
- }
- }
-
- // get the path for all .jar files in this code folder
- String libraryClassPath =
- Compiler.contentsToClassPath(libraryFolder);
- // grab all jars and classes from this folder,
- // and append them to the library classpath
-// librariesClassPath +=
-// File.pathSeparatorChar + libraryClassPath;
- // need to associate each import with a library folder
- String packages[] =
- Compiler.packageListFromClassPath(libraryClassPath);
- for (String pkg : packages) {
-// pw.println(pkg + "\t" + libraryFolder.getAbsolutePath());
- LibraryFolder library = importToLibraryTable.get(pkg);
- File already = library.getPath();
- if (already != null) {
- Base.showWarning("Library Calling", "The library found in\n" +
- libraryFolder.getAbsolutePath() + "\n" +
- "conflicts with the library found in\n" +
- already.getAbsolutePath() + "\n" +
- "which already defines the package " + pkg, null);
- } else {
- importToLibraryTable.put(pkg, libraryFolder);
- }
- }
-
- JMenuItem item = new JMenuItem(libraryName);
- item.addActionListener(listener);
- item.setActionCommand(libraryJar.getAbsolutePath());
- menu.add(item);
- ifound = true;
-
- } else { // not a library, but is still a folder, so recurse
- JMenu submenu = new JMenu(potentialName);
- // needs to be separate var, otherwise would set ifound to false
- boolean found = addLibraries(submenu, subfolder);
- if (found) {
- menu.add(submenu);
- ifound = true;
- }
- }
- }
- return ifound;
- }
- */
-
-
// .................................................................
@@ -1506,6 +1155,11 @@ public class Base {
}
+ static public String getPlatformName() {
+ return PConstants.platformNames[PApplet.platform];
+ }
+
+ /*
static public String getPlatformName() {
String osname = System.getProperty("os.name");
@@ -1522,6 +1176,7 @@ public class Base {
return "other";
}
}
+ */
/**
@@ -1615,6 +1270,7 @@ public class Base {
}
+ /*
static public File getBuildFolder() {
if (buildFolder == null) {
String buildPath = Preferences.get("build.path");
@@ -1630,62 +1286,95 @@ public class Base {
}
return buildFolder;
}
+ */
/**
- * Get the path to the platform's temporary folder, by creating
- * a temporary temporary file and getting its parent folder.
- *
- * Modified for revision 0094 to actually make the folder randomized
- * to avoid conflicts in multi-user environments. (Bug 177)
+ * Create a temporary folder by using the createTempFile() mechanism,
+ * deleting the file it creates, and making a folder using the location
+ * that was provided.
*/
- static public File createTempFolder(String name) {
- try {
- File folder = File.createTempFile(name, null);
- //String tempPath = ignored.getParent();
- //return new File(tempPath);
- folder.delete();
- folder.mkdirs();
- return folder;
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
+ static public File createTempFolder(String prefix, String suffix) throws IOException {
+ File folder = File.createTempFile(prefix, suffix);
+ // Now delete that file and create a folder in its place
+ folder.delete();
+ folder.mkdirs();
+ // And send the folder back to your friends
+ return folder;
}
- static public String getExamplesPath() {
- return examplesFolder.getAbsolutePath();
- }
+// static public String getExamplesPath() {
+// return examplesFolder.getAbsolutePath();
+// }
+
+// public File getExamplesFolder() {
+// return examplesFolder;
+// }
- static public String getLibrariesPath() {
- return librariesFolder.getAbsolutePath();
- }
+// static public String getLibrariesPath() {
+// return librariesFolder.getAbsolutePath();
+// }
- static public File getToolsFolder() {
+// public File getLibrariesFolder() {
+// return librariesFolder;
+// }
+
+
+// static public File getToolsFolder() {
+ public File getToolsFolder() {
return toolsFolder;
}
- static public String getToolsPath() {
- return toolsFolder.getAbsolutePath();
+// static public String getToolsPath() {
+// return toolsFolder.getAbsolutePath();
+// }
+
+
+ protected void determineSketchbookFolder() {
+ // If a value is at least set, first check to see if the folder exists.
+ // If it doesn't, warn the user that the sketchbook folder is being reset.
+ String sketchbookPath = Preferences.get("sketchbook.path");
+ if (sketchbookPath != null) {
+ sketchbookFolder = new File(sketchbookPath);
+ if (!sketchbookFolder.exists()) {
+ Base.showWarning("Sketchbook folder disappeared",
+ "The sketchbook folder no longer exists.\n" +
+ "Processing will switch to the default sketchbook\n" +
+ "location, and create a new sketchbook folder if\n" +
+ "necessary. Procesing will then stop talking about\n" +
+ "himself in the third person.", null);
+ sketchbookFolder = null;
+ }
+ }
+
+ // If no path is set, get the default sketchbook folder for this platform
+ if (sketchbookFolder == null) {
+ sketchbookFolder = getDefaultSketchbookFolder();
+ Preferences.set("sketchbook.path", sketchbookFolder.getAbsolutePath());
+ if (!sketchbookFolder.exists()) {
+ sketchbookFolder.mkdirs();
+ }
+ }
}
- static public File getSketchbookFolder() {
- return new File(Preferences.get("sketchbook.path"));
+ public File getSketchbookFolder() {
+// return new File(Preferences.get("sketchbook.path"));
+ return sketchbookFolder;
}
- static public File getSketchbookLibrariesFolder() {
- return new File(getSketchbookFolder(), "libraries");
+ public File getSketchbookLibrariesFolder() {
+// return new File(getSketchbookFolder(), "libraries");
+ return new File(sketchbookFolder, "libraries");
}
- protected File getDefaultSketchbookFolder() {
+ static protected File getDefaultSketchbookFolder() {
File sketchbookFolder = null;
try {
sketchbookFolder = platform.getDefaultSketchbookFolder();
@@ -1715,19 +1404,18 @@ public class Base {
* Check for a new sketchbook location.
*/
static protected File promptSketchbookLocation() {
- File folder = null;
-
- folder = new File(System.getProperty("user.home"), "sketchbook");
+ // Most often this will happen on Linux, so default to their home dir.
+ File folder = new File(System.getProperty("user.home"), "sketchbook");
+ String prompt = "Select (or create new) folder for sketches...";
+ folder = Base.selectFolder(prompt, folder, null);
+ if (folder == null) {
+ System.exit(0);
+ }
+ // Create the folder if it doesn't exist already
if (!folder.exists()) {
folder.mkdirs();
return folder;
}
-
- String prompt = "Select (or create new) folder for sketches...";
- folder = Base.selectFolder(prompt, null, null);
- if (folder == null) {
- System.exit(0);
- }
return folder;
}
@@ -2154,6 +1842,7 @@ public class Base {
/**
* Get an image associated with the current color theme.
+ * @deprecated
*/
static public Image getThemeImage(String name, Component who) {
return getLibImage("theme/" + name, who);
@@ -2162,6 +1851,7 @@ public class Base {
/**
* Return an Image object from inside the Processing lib folder.
+ * @deprecated
*/
static public Image getLibImage(String name, Component who) {
Image image = null;
@@ -2413,15 +2103,30 @@ public class Base {
* and returns a list of their relative paths.
* Ignores any files/folders prefixed with a dot.
*/
- static public String[] listFiles(String path, boolean relative) {
- return listFiles(new File(path), relative);
- }
+// static public String[] listFiles(String path, boolean relative) {
+// return listFiles(new File(path), relative);
+// }
static public String[] listFiles(File folder, boolean relative) {
String path = folder.getAbsolutePath();
Vector vector = new Vector();
- listFiles(relative ? (path + File.separator) : "", path, vector);
+ listFiles(relative ? (path + File.separator) : "", path, null, vector);
+ String outgoing[] = new String[vector.size()];
+ vector.copyInto(outgoing);
+ return outgoing;
+ }
+
+
+ static public String[] listFiles(File folder, boolean relative, String extension) {
+ String path = folder.getAbsolutePath();
+ Vector vector = new Vector();
+ if (extension != null) {
+ if (!extension.startsWith(".")) {
+ extension = "." + extension;
+ }
+ }
+ listFiles(relative ? (path + File.separator) : "", path, extension, vector);
String outgoing[] = new String[vector.size()];
vector.copyInto(outgoing);
return outgoing;
@@ -2429,22 +2134,191 @@ public class Base {
static protected void listFiles(String basePath,
- String path, Vector vector) {
+ String path, String extension,
+ Vector vector) {
File folder = new File(path);
- String list[] = folder.list();
- if (list == null) return;
-
- for (int i = 0; i < list.length; i++) {
- if (list[i].charAt(0) == '.') continue;
-
- File file = new File(path, list[i]);
- String newPath = file.getAbsolutePath();
- if (newPath.startsWith(basePath)) {
- newPath = newPath.substring(basePath.length());
+ String[] list = folder.list();
+ if (list != null) {
+ for (String item : list) {
+ if (item.charAt(0) == '.') continue;
+ if (extension == null || item.toLowerCase().endsWith(extension)) {
+ File file = new File(path, item);
+ String newPath = file.getAbsolutePath();
+ if (newPath.startsWith(basePath)) {
+ newPath = newPath.substring(basePath.length());
+ }
+ vector.add(newPath);
+ if (file.isDirectory()) {
+ listFiles(basePath, newPath, extension, vector);
+ }
+ }
}
- vector.add(newPath);
- if (file.isDirectory()) {
- listFiles(basePath, newPath, vector);
+ }
+ }
+
+
+ /////////////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Given a folder, return a list of absolute paths to all jar or zip files
+ * inside that folder, separated by pathSeparatorChar.
+ *
+ * This will prepend a colon (or whatever the path separator is)
+ * so that it can be directly appended to another path string.
+ *
+ * As of 0136, this will no longer add the root folder as well.
+ *
+ * This function doesn't bother checking to see if there are any .class
+ * files in the folder or within a subfolder.
+ */
+ static public String contentsToClassPath(File folder) {
+ if (folder == null) return "";
+
+ StringBuffer abuffer = new StringBuffer();
+ String sep = System.getProperty("path.separator");
+
+ try {
+ String path = folder.getCanonicalPath();
+
+// disabled as of 0136
+ // add the folder itself in case any unzipped files
+// abuffer.append(sep);
+// abuffer.append(path);
+//
+ // When getting the name of this folder, make sure it has a slash
+ // after it, so that the names of sub-items can be added.
+ if (!path.endsWith(File.separator)) {
+ path += File.separator;
+ }
+
+ String list[] = folder.list();
+ for (int i = 0; i < list.length; i++) {
+ // Skip . and ._ files. Prior to 0125p3, .jar files that had
+ // OS X AppleDouble files associated would cause trouble.
+ if (list[i].startsWith(".")) continue;
+
+ if (list[i].toLowerCase().endsWith(".jar") ||
+ list[i].toLowerCase().endsWith(".zip")) {
+ abuffer.append(sep);
+ abuffer.append(path);
+ abuffer.append(list[i]);
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace(); // this would be odd
+ }
+ //System.out.println("included path is " + abuffer.toString());
+ //packageListFromClassPath(abuffer.toString()); // WHY?
+ return abuffer.toString();
+ }
+
+
+ /**
+ * A classpath, separated by the path separator, will contain
+ * a series of .jar/.zip files or directories containing .class
+ * files, or containing subdirectories that have .class files.
+ *
+ * @param path the input classpath
+ * @return array of possible package names
+ */
+ static public String[] packageListFromClassPath(String path) {
+ Hashtable table = new Hashtable();
+ String pieces[] =
+ PApplet.split(path, File.pathSeparatorChar);
+
+ for (int i = 0; i < pieces.length; i++) {
+ //System.out.println("checking piece '" + pieces[i] + "'");
+ if (pieces[i].length() == 0) continue;
+
+ if (pieces[i].toLowerCase().endsWith(".jar") ||
+ pieces[i].toLowerCase().endsWith(".zip")) {
+ //System.out.println("checking " + pieces[i]);
+ packageListFromZip(pieces[i], table);
+
+ } else { // it's another type of file or directory
+ File dir = new File(pieces[i]);
+ if (dir.exists() && dir.isDirectory()) {
+ packageListFromFolder(dir, null, table);
+ //importCount = magicImportsRecursive(dir, null,
+ // table);
+ //imports, importCount);
+ }
+ }
+ }
+ int tableCount = table.size();
+ String output[] = new String[tableCount];
+ int index = 0;
+ Enumeration e = table.keys();
+ while (e.hasMoreElements()) {
+ output[index++] = ((String) e.nextElement()).replace('/', '.');
+ }
+ //System.arraycopy(imports, 0, output, 0, importCount);
+ //PApplet.printarr(output);
+ return output;
+ }
+
+
+ static private void packageListFromZip(String filename, Hashtable table) {
+ try {
+ ZipFile file = new ZipFile(filename);
+ Enumeration entries = file.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = (ZipEntry) entries.nextElement();
+
+ if (!entry.isDirectory()) {
+ String name = entry.getName();
+
+ if (name.endsWith(".class")) {
+ int slash = name.lastIndexOf('/');
+ if (slash == -1) continue;
+
+ String pname = name.substring(0, slash);
+ if (table.get(pname) == null) {
+ table.put(pname, new Object());
+ }
+ }
+ }
+ }
+ } catch (IOException e) {
+ System.err.println("Ignoring " + filename + " (" + e.getMessage() + ")");
+ //e.printStackTrace();
+ }
+ }
+
+
+ /**
+ * Make list of package names by traversing a directory hierarchy.
+ * Each time a class is found in a folder, add its containing set
+ * of folders to the package list. If another folder is found,
+ * walk down into that folder and continue.
+ */
+ static private void packageListFromFolder(File dir, String sofar,
+ Hashtable table) {
+ //String imports[],
+ //int importCount) {
+ //System.err.println("checking dir '" + dir + "'");
+ boolean foundClass = false;
+ String files[] = dir.list();
+
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].equals(".") || files[i].equals("..")) continue;
+
+ File sub = new File(dir, files[i]);
+ if (sub.isDirectory()) {
+ String nowfar =
+ (sofar == null) ? files[i] : (sofar + "." + files[i]);
+ packageListFromFolder(sub, nowfar, table);
+ //System.out.println(nowfar);
+ //imports[importCount++] = nowfar;
+ //importCount = magicImportsRecursive(sub, nowfar,
+ // imports, importCount);
+ } else if (!foundClass) { // if no classes found in this folder yet
+ if (files[i].endsWith(".class")) {
+ //System.out.println("unique class: " + files[i] + " for " + sofar);
+ table.put(sofar, new Object());
+ foundClass = true;
+ }
}
}
}
diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java
index fcb3b0d0f..d76f20cf6 100644
--- a/app/src/processing/app/Editor.java
+++ b/app/src/processing/app/Editor.java
@@ -3,7 +3,7 @@
/*
Part of the Processing project - http://processing.org
- Copyright (c) 2004-10 Ben Fry and Casey Reas
+ Copyright (c) 2004-11 Ben Fry and Casey Reas
Copyright (c) 2001-04 Massachusetts Institute of Technology
This program is free software; you can redistribute it and/or modify
@@ -22,7 +22,6 @@
package processing.app;
-import processing.app.debug.*;
import processing.app.syntax.*;
import processing.app.tools.*;
import processing.core.*;
@@ -32,7 +31,6 @@ import java.awt.datatransfer.*;
import java.awt.event.*;
import java.awt.print.*;
import java.io.*;
-import java.lang.reflect.Method;
import java.net.*;
import java.util.*;
import java.util.zip.*;
@@ -46,9 +44,9 @@ import javax.swing.undo.*;
/**
* Main editor panel for the Processing Development Environment.
*/
-public class Editor extends JFrame implements RunnerListener {
-
- final Base base;
+public abstract class Editor extends JFrame implements RunnerListener {
+ protected Base base;
+ protected Mode mode;
// otherwise, if the window is resized with the message label
// set to blank, it's preferredSize() will be fukered
@@ -67,35 +65,25 @@ public class Editor extends JFrame implements RunnerListener {
// file and sketch menus for re-inserting items
private JMenu fileMenu;
+ private JMenuItem saveMenuItem;
+ private JMenuItem saveAsMenuItem;
+
private JMenu sketchMenu;
- private final EditorToolbar toolbar;
- // these menus are shared so that they needn't be rebuilt for all windows
- // each time a sketch is created, renamed, or moved.
- static JMenu toolbarMenu;
-
- EditorHeader header;
- EditorStatus status;
- EditorConsole console;
-
- private final JSplitPane splitPane;
- private final JPanel consolePanel;
+ protected EditorHeader header;
+ protected EditorToolbar toolbar;
+ protected JEditTextArea textarea;
+ protected EditorStatus status;
+ protected JSplitPane splitPane;
+ protected JPanel consolePanel;
+ protected EditorConsole console;
+ protected EditorLineStatus lineStatus;
// currently opened program
- private Sketch sketch;
-
- private final EditorLineStatus lineStatus;
-
- private final JEditTextArea textarea;
- private final EditorListener listener;
+ protected Sketch sketch;
// runtime information and window placement
private Point sketchWindowLocation;
- private Runner runtime;
-
-// private JMenuItem exportAppItem;
- private JMenuItem saveMenuItem;
- private JMenuItem saveAsMenuItem;
// undo fellers
private JMenuItem undoItem, redoItem;
@@ -104,26 +92,22 @@ public class Editor extends JFrame implements RunnerListener {
private UndoManager undo;
// used internally, and only briefly
private CompoundEdit compoundEdit;
-
- private FindReplace find;
-
- private Runnable runHandler;
- private Runnable presentHandler;
- private Runnable stopHandler;
- private Runnable exportHandler;
- private Runnable exportAppHandler;
-
+ // maintain caret position during undo operations
private final Stack caretUndoStack = new Stack();
private final Stack caretRedoStack = new Stack();
- public Editor(Base ibase, String path, int[] location) {
- super("Processing");
- this.base = ibase;
+ private FindReplace find;
- Base.setIcon(this);
+
+ protected Editor(final Base base, String path, int[] location, final Mode mode) {
+ super("Processing");
+ this.base = base;
+ this.mode = mode;
+
+ Base.setIcon(this); // TODO should this be per-mode?
// Install default actions for Run, Present, etc.
- resetHandlers();
+// resetHandlers();
// add listener to handle window close box hit event
addWindowListener(new WindowAdapter() {
@@ -141,25 +125,25 @@ public class Editor extends JFrame implements RunnerListener {
public void windowActivated(WindowEvent e) {
// EditorConsole.systemOut.println("editor window activated");
base.handleActivated(Editor.this);
-// // re-add the sub-menus that are shared by all windows
- fileMenu.insert(Base.sketchbookMenu, 2);
- fileMenu.insert(Base.examplesMenu, 3);
- sketchMenu.insert(Base.importMenu, 4);
+// mode.handleActivated(Editor.this);
+ fileMenu.insert(base.getSketchbookMenu(), 2);
+ fileMenu.insert(mode.getExamplesMenu(), 3);
+ sketchMenu.insert(mode.getImportMenu(), 4);
}
// added for 1.0.5
// http://dev.processing.org/bugs/show_bug.cgi?id=1260
public void windowDeactivated(WindowEvent e) {
// EditorConsole.systemErr.println("editor window deactivated");
- fileMenu.remove(Base.sketchbookMenu);
- fileMenu.remove(Base.examplesMenu);
- sketchMenu.remove(Base.importMenu);
+// mode.handleDeactivated(Editor.this);
+ fileMenu.remove(base.getSketchbookMenu());
+ fileMenu.remove(mode.getExamplesMenu());
+ sketchMenu.remove(mode.getImportMenu());
}
});
buildMenuBar();
- // For rev 0120, placing things inside a JPanel
Container contentPain = getContentPane();
contentPain.setLayout(new BorderLayout());
JPanel pain = new JPanel();
@@ -169,17 +153,13 @@ public class Editor extends JFrame implements RunnerListener {
Box box = Box.createVerticalBox();
Box upper = Box.createVerticalBox();
- if (toolbarMenu == null) {
- toolbarMenu = new JMenu();
- base.rebuildToolbarMenu(toolbarMenu);
- }
- toolbar = new EditorToolbar(this, toolbarMenu);
+ toolbar = createToolbar();
upper.add(toolbar);
header = new EditorHeader(this);
upper.add(header);
- textarea = new JEditTextArea(new PdeTextAreaDefaults());
+ textarea = new JEditTextArea(new PdeTextAreaDefaults(mode));
textarea.setRightClickPopup(new TextAreaPopup());
textarea.setHorizontalOffset(JEditTextArea.leftHandGutter);
@@ -195,12 +175,11 @@ public class Editor extends JFrame implements RunnerListener {
console.setBorder(null);
consolePanel.add(console, BorderLayout.CENTER);
- lineStatus = new EditorLineStatus(textarea);
+ lineStatus = new EditorLineStatus(this);
consolePanel.add(lineStatus, BorderLayout.SOUTH);
upper.add(textarea);
- splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
- upper, consolePanel);
+ splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, upper, consolePanel);
splitPane.setOneTouchExpandable(true);
// repaint child panes while resizing
@@ -223,7 +202,7 @@ public class Editor extends JFrame implements RunnerListener {
// hopefully these are no longer needed w/ swing
// (har har har.. that was wishful thinking)
- listener = new EditorListener(this, textarea);
+// listener = new PdeKeyListener(this, textarea);
pain.add(box);
// get shift down/up events so we can show the alt version of toolbar buttons
@@ -239,7 +218,7 @@ public class Editor extends JFrame implements RunnerListener {
// Set the minimum size for the editor window
setMinimumSize(new Dimension(Preferences.getInteger("editor.window.width.min"),
- Preferences.getInteger("editor.window.height.min")));
+ Preferences.getInteger("editor.window.height.min")));
// Bring back the general options for the editor
applyPreferences();
@@ -297,7 +276,8 @@ public class Editor extends JFrame implements RunnerListener {
}
}
} catch (Exception e) {
- e.printStackTrace();
+ Base.showWarning("Drag & Drop Problem",
+ "An error occurred while trying to add files to the sketch.", e);
return false;
}
@@ -313,6 +293,22 @@ public class Editor extends JFrame implements RunnerListener {
return true;
}
}
+
+
+ public Mode getMode() {
+ return mode;
+ }
+
+
+// public Settings getTheme() {
+// return mode.getTheme();
+// }
+
+
+ abstract public EditorToolbar createToolbar();
+
+
+ abstract public Formatter createFormatter();
protected void setPlacement(int[] location) {
@@ -340,18 +336,6 @@ public class Editor extends JFrame implements RunnerListener {
}
- /**
- * Hack for #@#)$(* Mac OS X 10.2.
- *
- * This appears to only be required on OS X 10.2, and is not
- * even being called on later versions of OS X or Windows.
- */
-// public Dimension getMinimumSize() {
-// //System.out.println("getting minimum size");
-// return new Dimension(500, 550);
-// }
-
-
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -361,7 +345,6 @@ public class Editor extends JFrame implements RunnerListener {
* with things in the Preferences window.
*/
protected void applyPreferences() {
-
// apply the setting for 'use external editor'
boolean external = Preferences.getBoolean("editor.external");
@@ -371,38 +354,35 @@ public class Editor extends JFrame implements RunnerListener {
TextAreaPainter painter = textarea.getPainter();
if (external) {
-
// disable line highlight and turn off the caret when disabling
- Color color = Theme.getColor("editor.external.bgcolor");
+ Color color = mode.getColor("editor.external.bgcolor");
painter.setBackground(color);
painter.setLineHighlightEnabled(false);
textarea.setCaretVisible(false);
// new stuff
- splitPane.setDividerLocation(toolbar.getHeight() + header.getHeight());
- splitPane.setResizeWeight(0D);
- textarea.setMinimumSize(new Dimension(textarea.getWidth(), 0));
- } else {
- Color color = Theme.getColor("editor.bgcolor");
+// splitPane.setDividerLocation(toolbar.getHeight() + header.getHeight());
+// splitPane.setResizeWeight(0D);
+// textarea.setMinimumSize(new Dimension(textarea.getWidth(), 0));
+ } else {
+ Color color = mode.getColor("editor.bgcolor");
painter.setBackground(color);
boolean highlight = Preferences.getBoolean("editor.linehighlight");
painter.setLineHighlightEnabled(highlight);
textarea.setCaretVisible(true);
// new stuff
- splitPane.setDividerLocation(-1); // any negative value resets to preferred size
- splitPane.setResizeWeight(1D);
- textarea.setMinimumSize(null);
+// splitPane.setDividerLocation(-1); // any negative value resets to preferred size
+// splitPane.setResizeWeight(1D);
+// textarea.setMinimumSize(null);
}
// apply changes to the font size for the editor
- //TextAreaPainter painter = textarea.getPainter();
painter.setFont(Preferences.getFont("editor.font"));
- //Font font = painter.getFont();
- //textarea.getPainter().setFont(new Font("Courier", Font.PLAIN, 36));
// in case tab expansion stuff has changed
- listener.applyPreferences();
+ // removing this, just checking prefs directly instead
+// listener.applyPreferences();
// in case moved to a new location
// For 0125, changing to async version (to be implemented later)
@@ -418,76 +398,292 @@ public class Editor extends JFrame implements RunnerListener {
protected void buildMenuBar() {
JMenuBar menubar = new JMenuBar();
menubar = new JMenuBar();
- menubar.add(fileMenu = base.buildFileMenu(this));
+ fileMenu = buildFileMenu();
+ menubar.add(fileMenu);
menubar.add(buildEditMenu());
menubar.add(buildSketchMenu());
menubar.add(buildToolsMenu());
-
- // These are temporary entries while Android mode is being worked out.
- // The mode will not be in the tools menu, and won't involve a cmd-key
- if (!Base.RELEASE) {
- try {
- Class clazz = Class.forName("processing.app.tools.android.AndroidMode");
- Object mode = clazz.newInstance();
- Method m = clazz.getMethod("init", new Class[] { Editor.class, JMenuBar.class });
- //String libraryPath = (String) m.invoke(null, new Object[] { });
- m.invoke(mode, new Object[] { this, menubar });
- } catch (Exception e) {
- e.printStackTrace();
- }
+
+ JMenu modeMenu = buildModeMenu();
+ if (modeMenu != null) {
+ menubar.add(modeMenu);
}
+// // These are temporary entries while Android mode is being worked out.
+// // The mode will not be in the tools menu, and won't involve a cmd-key
+// if (!Base.RELEASE) {
+// try {
+// Class clazz = Class.forName("processing.app.tools.android.AndroidMode");
+// Object mode = clazz.newInstance();
+// Method m = clazz.getMethod("init", new Class[] { Editor.class, JMenuBar.class });
+// //String libraryPath = (String) m.invoke(null, new Object[] { });
+// m.invoke(mode, new Object[] { this, menubar });
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+
menubar.add(buildHelpMenu());
setJMenuBar(menubar);
}
+
+ abstract public JMenu buildFileMenu();
+
+
+// public JMenu buildFileMenu(Editor editor) {
+// return buildFileMenu(editor, null);
+// }
+//
+//
+// // most of these items are per-mode
+// protected JMenu buildFileMenu(Editor editor, JMenuItem[] exportItems) {
+
+
+ protected JMenu buildFileMenu(JMenuItem[] exportItems) {
+ JMenuItem item;
+ JMenu fileMenu = new JMenu("File");
- public void setSaveItem(JMenuItem item) {
+ item = Base.newJMenuItem("New", 'N');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ base.handleNew();
+ }
+ });
+ fileMenu.add(item);
+
+ item = Base.newJMenuItem("Open...", 'O');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ base.handleOpenPrompt();
+ }
+ });
+ fileMenu.add(item);
+
+ fileMenu.add(base.getSketchbookMenu());
+ fileMenu.add(mode.getExamplesMenu());
+
+ item = Base.newJMenuItem("Close", 'W');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ base.handleClose(Editor.this);
+ }
+ });
+ fileMenu.add(item);
+
+ item = Base.newJMenuItem("Save", 'S');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ handleSaveRequest(false);
+ }
+ });
saveMenuItem = item;
- }
+ fileMenu.add(item);
-
- public void setSaveAsItem(JMenuItem item) {
+ item = Base.newJMenuItemShift("Save As...", 'S');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ handleSaveAs();
+ }
+ });
saveAsMenuItem = item;
+ fileMenu.add(item);
+
+ if (exportItems != null) {
+ for (JMenuItem ei : exportItems) {
+ fileMenu.add(ei);
+ }
+ }
+ fileMenu.addSeparator();
+
+ item = Base.newJMenuItemShift("Page Setup", 'P');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ handlePageSetup();
+ }
+ });
+ fileMenu.add(item);
+
+ item = Base.newJMenuItem("Print", 'P');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ handlePrint();
+ }
+ });
+ fileMenu.add(item);
+
+ // Mac OS X already has its own preferences and quit menu.
+ // That's right! Think different, b*tches!
+ if (!Base.isMacOS()) {
+ fileMenu.addSeparator();
+
+ item = Base.newJMenuItem("Preferences", ',');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ base.handlePrefs();
+ }
+ });
+ fileMenu.add(item);
+
+ fileMenu.addSeparator();
+
+ item = Base.newJMenuItem("Quit", 'Q');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ base.handleQuit();
+ }
+ });
+ fileMenu.add(item);
+ }
+ return fileMenu;
+ }
+
+
+// public void setSaveItem(JMenuItem item) {
+// saveMenuItem = item;
+// }
+
+
+// public void setSaveAsItem(JMenuItem item) {
+// saveAsMenuItem = item;
+// }
+
+
+ protected JMenu buildEditMenu() {
+ JMenu menu = new JMenu("Edit");
+ JMenuItem item;
+
+ undoItem = Base.newJMenuItem("Undo", 'Z');
+ undoItem.addActionListener(undoAction = new UndoAction());
+ menu.add(undoItem);
+
+ // Gotta follow them interface guidelines
+ // http://code.google.com/p/processing/issues/detail?id=363
+ if (Base.isWindows()) {
+ redoItem = Base.newJMenuItem("Redo", 'Y');
+ } else { // Linux and OS X
+ redoItem = Base.newJMenuItemShift("Redo", 'Z');
+ }
+ redoItem.addActionListener(redoAction = new RedoAction());
+ menu.add(redoItem);
+
+ menu.addSeparator();
+
+ // TODO "cut" and "copy" should really only be enabled
+ // if some text is currently selected
+ item = Base.newJMenuItem("Cut", 'X');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ handleCut();
+ }
+ });
+ menu.add(item);
+
+ item = Base.newJMenuItem("Copy", 'C');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ textarea.copy();
+ }
+ });
+ menu.add(item);
+
+ item = Base.newJMenuItemShift("Copy as HTML", 'C');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ handleCopyAsHTML();
+ }
+ });
+ menu.add(item);
+
+ item = Base.newJMenuItem("Paste", 'V');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ textarea.paste();
+ sketch.setModified(true);
+ }
+ });
+ menu.add(item);
+
+ item = Base.newJMenuItem("Select All", 'A');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ textarea.selectAll();
+ }
+ });
+ menu.add(item);
+
+ menu.addSeparator();
+
+ item = Base.newJMenuItem("Comment/Uncomment", '/');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ handleCommentUncomment();
+ }
+ });
+ menu.add(item);
+
+ item = Base.newJMenuItem("Increase Indent", ']');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ handleIndentOutdent(true);
+ }
+ });
+ menu.add(item);
+
+ item = Base.newJMenuItem("Decrease Indent", '[');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ handleIndentOutdent(false);
+ }
+ });
+ menu.add(item);
+
+ menu.addSeparator();
+
+ item = Base.newJMenuItem("Find...", 'F');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (find == null) {
+ find = new FindReplace(Editor.this);
+ }
+ //new FindReplace(Editor.this).show();
+ find.setVisible(true);
+ }
+ });
+ menu.add(item);
+
+ // TODO find next should only be enabled after a
+ // search has actually taken place
+ item = Base.newJMenuItem("Find Next", 'G');
+ item.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (find != null) {
+ //find.find(true);
+ //FindReplace find = new FindReplace(Editor.this); //.show();
+ find.find(true);
+ }
+ }
+ });
+ menu.add(item);
+
+ return menu;
}
- protected JMenu buildSketchMenu() {
+ abstract public JMenu buildSketchMenu();
+
+
+ protected JMenu buildSketchMenu(JMenuItem[] runItems) {
JMenuItem item;
sketchMenu = new JMenu("Sketch");
- item = Base.newJMenuItem("Run", 'R');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- handleRun(false);
- }
- });
- sketchMenu.add(item);
-
- item = Base.newJMenuItemShift("Present", 'R');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- handleRun(true);
- }
- });
- sketchMenu.add(item);
-
- item = new JMenuItem("Stop");
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- handleStop();
- }
- });
- sketchMenu.add(item);
+ for (JMenuItem mi : runItems) {
+ sketchMenu.add(mi);
+ }
sketchMenu.addSeparator();
- if (Base.importMenu == null) {
- Base.importMenu = new JMenu("Import Library...");
- //base.rebuildImportMenu(importMenu);
- base.rebuildImportMenu();
- }
- sketchMenu.add(Base.importMenu);
+ sketchMenu.add(mode.getImportMenu());
item = Base.newJMenuItem("Show Sketch Folder", 'K');
item.addActionListener(new ActionListener() {
@@ -508,14 +704,17 @@ public class Editor extends JFrame implements RunnerListener {
return sketchMenu;
}
+
+
+ abstract public void handleImportLibrary(String item);
protected JMenu buildToolsMenu() {
JMenu menu = new JMenu("Tools");
addInternalTools(menu);
- addTools(menu, Base.getToolsFolder());
- File sketchbookTools = new File(Base.getSketchbookFolder(), "tools");
+ addTools(menu, base.getToolsFolder());
+ File sketchbookTools = new File(base.getSketchbookFolder(), "tools");
addTools(menu, sketchbookTools);
return menu;
@@ -624,6 +823,14 @@ public class Editor extends JFrame implements RunnerListener {
}
+ /**
+ * Override this if you want a special menu for your particular 'mode'.
+ */
+ public JMenu buildModeMenu() {
+ return null;
+ }
+
+
protected String findClassInZipFile(String base, File file) {
// Class file to search for
String classFileName = "/" + base + ".class";
@@ -678,12 +885,11 @@ public class Editor extends JFrame implements RunnerListener {
protected JMenu addInternalTools(JMenu menu) {
- JMenuItem item;
-
- item = createToolMenuItem("processing.app.tools.AutoFormatTool");
- int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
- item.setAccelerator(KeyStroke.getKeyStroke('T', modifiers));
- menu.add(item);
+// JMenuItem item;
+// item = createToolMenuItem("processing.app.tools.AutoFormatTool");
+// int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
+// item.setAccelerator(KeyStroke.getKeyStroke('T', modifiers));
+// menu.add(item);
menu.add(createToolMenuItem("processing.app.tools.CreateFont"));
menu.add(createToolMenuItem("processing.app.tools.ColorSelector"));
@@ -820,127 +1026,6 @@ public class Editor extends JFrame implements RunnerListener {
}
- protected JMenu buildEditMenu() {
- JMenu menu = new JMenu("Edit");
- JMenuItem item;
-
- undoItem = Base.newJMenuItem("Undo", 'Z');
- undoItem.addActionListener(undoAction = new UndoAction());
- menu.add(undoItem);
-
- // Gotta follow them interface guidelines
- // http://code.google.com/p/processing/issues/detail?id=363
- if (Base.isWindows()) {
- redoItem = Base.newJMenuItem("Redo", 'Y');
- } else { // Linux and OS X
- redoItem = Base.newJMenuItemShift("Redo", 'Z');
- }
- redoItem.addActionListener(redoAction = new RedoAction());
- menu.add(redoItem);
-
- menu.addSeparator();
-
- // TODO "cut" and "copy" should really only be enabled
- // if some text is currently selected
- item = Base.newJMenuItem("Cut", 'X');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- handleCut();
- }
- });
- menu.add(item);
-
- item = Base.newJMenuItem("Copy", 'C');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textarea.copy();
- }
- });
- menu.add(item);
-
- item = Base.newJMenuItemShift("Copy as HTML", 'C');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- handleCopyAsHTML();
- }
- });
- menu.add(item);
-
- item = Base.newJMenuItem("Paste", 'V');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textarea.paste();
- sketch.setModified(true);
- }
- });
- menu.add(item);
-
- item = Base.newJMenuItem("Select All", 'A');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- textarea.selectAll();
- }
- });
- menu.add(item);
-
- menu.addSeparator();
-
- item = Base.newJMenuItem("Comment/Uncomment", '/');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- handleCommentUncomment();
- }
- });
- menu.add(item);
-
- item = Base.newJMenuItem("Increase Indent", ']');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- handleIndentOutdent(true);
- }
- });
- menu.add(item);
-
- item = Base.newJMenuItem("Decrease Indent", '[');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- handleIndentOutdent(false);
- }
- });
- menu.add(item);
-
- menu.addSeparator();
-
- item = Base.newJMenuItem("Find...", 'F');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (find == null) {
- find = new FindReplace(Editor.this);
- }
- //new FindReplace(Editor.this).show();
- find.setVisible(true);
- }
- });
- menu.add(item);
-
- // TODO find next should only be enabled after a
- // search has actually taken place
- item = Base.newJMenuItem("Find Next", 'G');
- item.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (find != null) {
- //find.find(true);
- //FindReplace find = new FindReplace(Editor.this); //.show();
- find.find(true);
- }
- }
- });
- menu.add(item);
-
- return menu;
- }
-
-
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -1037,24 +1122,24 @@ public class Editor extends JFrame implements RunnerListener {
// abstract from the editor in this fashion.
- public void setHandlers(Runnable runHandler, Runnable presentHandler,
- Runnable stopHandler,
- Runnable exportHandler, Runnable exportAppHandler) {
- this.runHandler = runHandler;
- this.presentHandler = presentHandler;
- this.stopHandler = stopHandler;
- this.exportHandler = exportHandler;
- this.exportAppHandler = exportAppHandler;
- }
+// public void setHandlers(Runnable runHandler, Runnable presentHandler,
+// Runnable stopHandler,
+// Runnable exportHandler, Runnable exportAppHandler) {
+// this.runHandler = runHandler;
+// this.presentHandler = presentHandler;
+// this.stopHandler = stopHandler;
+// this.exportHandler = exportHandler;
+// this.exportAppHandler = exportAppHandler;
+// }
- public void resetHandlers() {
- runHandler = new DefaultRunHandler();
- presentHandler = new DefaultPresentHandler();
- stopHandler = new DefaultStopHandler();
- exportHandler = new DefaultExportHandler();
- exportAppHandler = new DefaultExportAppHandler();
- }
+// public void resetHandlers() {
+// runHandler = new DefaultRunHandler();
+// presentHandler = new DefaultPresentHandler();
+// stopHandler = new DefaultStopHandler();
+// exportHandler = new DefaultExportHandler();
+// exportAppHandler = new DefaultExportAppHandler();
+// }
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -1271,7 +1356,7 @@ public class Editor extends JFrame implements RunnerListener {
code.setDocument(document);
// turn on syntax highlighting
- document.setTokenMarker(new PdeKeywords());
+ document.setTokenMarker(mode.getTokenMarker());
// insert the program text into the document object
try {
@@ -1355,9 +1440,46 @@ public class Editor extends JFrame implements RunnerListener {
}
+ public void handleAutoFormat() {
+ final String source = getText();
+
+ try {
+ final String formattedText = createFormatter().format(source);
+ // save current (rough) selection point
+ int selectionEnd = getSelectionStop();
+
+ // make sure the caret would be past the end of the text
+ if (formattedText.length() < selectionEnd - 1) {
+ selectionEnd = formattedText.length() - 1;
+ }
+
+ if (formattedText.equals(source)) {
+ statusNotice("No changes necessary for Auto Format.");
+ } else {
+ // replace with new bootiful text
+ // selectionEnd hopefully at least in the neighborhood
+ setText(formattedText);
+ setSelection(selectionEnd, selectionEnd);
+ getSketch().setModified(true);
+ // mark as finished
+ statusNotice("Auto Format finished.");
+ }
+
+ } catch (final Exception e) {
+ statusError(e);
+ }
+ }
+
+
+ abstract public String getCommentPrefix();
+
+
protected void handleCommentUncomment() {
startCompoundEdit();
+ String prefix = getCommentPrefix();
+ int prefixLen = prefix.length();
+
int startLine = textarea.getSelectionStartLine();
int stopLine = textarea.getSelectionStopLine();
@@ -1379,13 +1501,13 @@ public class Editor extends JFrame implements RunnerListener {
boolean commented = true;
for (int i = startLine; commented && (i <= stopLine); i++) {
int pos = textarea.getLineStartOffset(i);
- if (pos + 2 > length) {
+ if (pos + prefixLen > length) {
commented = false;
} else {
// Check the first two characters to see if it's already a comment.
String begin = textarea.getText(pos, 2);
//System.out.println("begin is '" + begin + "'");
- commented = begin.equals("//");
+ commented = begin.equals(prefix);
}
}
@@ -1393,14 +1515,14 @@ public class Editor extends JFrame implements RunnerListener {
int location = textarea.getLineStartOffset(line);
if (commented) {
// remove a comment
- textarea.select(location, location+2);
- if (textarea.getSelectedText().equals("//")) {
+ textarea.select(location, location + prefixLen);
+ if (textarea.getSelectedText().equals(prefix)) {
textarea.setSelectedText("");
}
} else {
// add a comment
textarea.select(location, location);
- textarea.setSelectedText("//");
+ textarea.setSelectedText(prefix);
}
}
// Subtract one from the end, otherwise selects past the current line.
@@ -1411,7 +1533,17 @@ public class Editor extends JFrame implements RunnerListener {
}
- protected void handleIndentOutdent(boolean indent) {
+ public void handleIndent() {
+ handleIndentOutdent(true);
+ }
+
+
+ public void handleOutdent() {
+ handleIndentOutdent(false);
+ }
+
+
+ public void handleIndentOutdent(boolean indent) {
int tabSize = Preferences.getInteger("editor.tabs.size");
String tabString = Editor.EMPTY.substring(0, tabSize);
@@ -1461,7 +1593,7 @@ public class Editor extends JFrame implements RunnerListener {
statusNotice("First select a word to find in the reference.");
} else {
- String referenceFile = PdeKeywords.getReference(text);
+ String referenceFile = mode.getReference(text);
//System.out.println("reference file is " + referenceFile);
if (referenceFile == null) {
statusNotice("No reference available for \"" + text + "\"");
@@ -1475,75 +1607,6 @@ public class Editor extends JFrame implements RunnerListener {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
- /**
- * Implements Sketch → Run.
- * @param present Set true to run in full screen (present mode).
- */
- public void handleRun(boolean present) {
- internalCloseRunner();
- toolbar.activate(EditorToolbar.RUN);
- statusEmpty();
-
- // do this to advance/clear the terminal window / dos prompt / etc
- for (int i = 0; i < 10; i++) System.out.println();
-
- // clear the console on each run, unless the user doesn't want to
- if (Preferences.getBoolean("console.auto_clear")) {
- console.clear();
- }
-
- // Cannot use invokeLater() here, otherwise it gets
- // placed on the event thread and causes a hang--bad idea all around.
- new Thread(present ? presentHandler : runHandler).start();
- }
-
-
- class DefaultRunHandler implements Runnable {
- public void run() {
- try {
- sketch.prepare();
- String appletClassName = sketch.build();
- if (appletClassName != null) {
- runtime = new Runner(Editor.this, sketch);
- runtime.launch(appletClassName, false);
- }
- } catch (Exception e) {
- statusError(e);
- }
- }
- }
-
-
- class DefaultPresentHandler implements Runnable {
- public void run() {
- try {
- sketch.prepare();
- String appletClassName = sketch.build();
- if (appletClassName != null) {
- runtime = new Runner(Editor.this, sketch);
- runtime.launch(appletClassName, true);
- }
- } catch (Exception e) {
- statusError(e);
- }
- }
- }
-
-
- class DefaultStopHandler implements Runnable {
- public void run() {
- try {
- if (runtime != null) {
- runtime.close(); // kills the window
- runtime = null; // will this help?
- }
- } catch (Exception e) {
- statusError(e);
- }
- }
- }
-
-
/**
* Set the location of the sketch run window. Used by Runner to update the
* Editor about window drag events while the sketch is running.
@@ -1561,50 +1624,10 @@ public class Editor extends JFrame implements RunnerListener {
return sketchWindowLocation;
}
-
- /**
- * Implements Sketch → Stop, or pressing Stop on the toolbar.
- */
- public void handleStop() { // called by menu or buttons
- toolbar.activate(EditorToolbar.STOP);
-
- internalCloseRunner();
-
- toolbar.deactivate(EditorToolbar.RUN);
- toolbar.deactivate(EditorToolbar.STOP);
-
- // focus the PDE again after quitting presentation mode [toxi 030903]
- toFront();
- }
-
-
- /**
- * Deactivate the Run button. This is called by Runner to notify that the
- * sketch has stopped running, usually in response to an error (or maybe
- * the sketch completing and exiting?) Tools should not call this function.
- * To initiate a "stop" action, call handleStop() instead.
- */
- public void deactivateRun() {
- toolbar.deactivate(EditorToolbar.RUN);
- }
-
-
- public void deactivateExport() {
- toolbar.deactivate(EditorToolbar.EXPORT);
- }
-
-
- /**
- * Handle internal shutdown of the runner.
- */
- public void internalCloseRunner() {
- if (stopHandler != null)
- try {
- stopHandler.run();
- } catch (Exception e) { }
-
- sketch.cleanup();
- }
+
+// public void internalCloseRunner() {
+// mode.internalCloseRunner(this);
+// }
/**
@@ -1626,7 +1649,7 @@ public class Editor extends JFrame implements RunnerListener {
JOptionPane.QUESTION_MESSAGE);
if (result == JOptionPane.YES_OPTION) {
- return handleSave(true);
+ return handleSaveRequest(true);
} else if (result == JOptionPane.NO_OPTION) {
return true; // ok to continue
@@ -1678,7 +1701,7 @@ public class Editor extends JFrame implements RunnerListener {
Object result = pane.getValue();
if (result == options[0]) { // save (and close/quit)
- return handleSave(true);
+ return handleSaveRequest(true);
} else if (result == options[2]) { // don't save (still close/quit)
return true;
@@ -1828,21 +1851,20 @@ public class Editor extends JFrame implements RunnerListener {
* won't run properly while a quit is happening. This fixes
* Bug 276.
*/
- public boolean handleSave(boolean immediately) {
- //stopRunner();
- handleStop(); // 0136
+ public boolean handleSaveRequest(boolean immediately) {
+// handleStop(); // 0136
if (untitled) {
return handleSaveAs();
// need to get the name, user might also cancel here
} else if (immediately) {
- handleSave2();
+ handleSave();
} else {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
- handleSave2();
+ handleSave();
}
});
}
@@ -1850,8 +1872,7 @@ public class Editor extends JFrame implements RunnerListener {
}
- protected void handleSave2() {
- toolbar.activate(EditorToolbar.SAVE);
+ public void handleSave() {
statusNotice("Saving...");
try {
if (sketch.save()) {
@@ -1859,12 +1880,6 @@ public class Editor extends JFrame implements RunnerListener {
} else {
statusEmpty();
}
- // rebuild sketch menu in case a save-as was forced
- // Disabling this for 0125, instead rebuild the menu inside
- // the Save As method of the Sketch object, since that's the
- // only one who knows whether something was renamed.
- //sketchbook.rebuildMenus();
- //sketchbook.rebuildMenusAsync();
} catch (Exception e) {
// show the error as a message in the window
@@ -1875,19 +1890,10 @@ public class Editor extends JFrame implements RunnerListener {
//checkModifiedMode = 0;
// this is used when another operation calls a save
}
- //toolbar.clear();
- toolbar.deactivate(EditorToolbar.SAVE);
}
public boolean handleSaveAs() {
- //stopRunner(); // formerly from 0135
- handleStop();
-
- toolbar.activate(EditorToolbar.SAVE);
-
- //SwingUtilities.invokeLater(new Runnable() {
- //public void run() {
statusNotice("Saving...");
try {
if (sketch.saveAs()) {
@@ -1903,115 +1909,6 @@ public class Editor extends JFrame implements RunnerListener {
} catch (Exception e) {
// show the error as a message in the window
statusError(e);
-
- } finally {
- // make sure the toolbar button deactivates
- toolbar.deactivate(EditorToolbar.SAVE);
- }
-
- return true;
- }
-
-
- /**
- * Called by Sketch → Export.
- * Handles calling the export() function on sketch, and
- * queues all the gui status stuff that comes along with it.
- *
- * Made synchronized to (hopefully) avoid problems of people
- * hitting export twice, quickly, and horking things up.
- */
- synchronized public void handleExport() {
- if (!handleExportCheckModified()) return;
- toolbar.activate(EditorToolbar.EXPORT);
-
- new Thread(exportHandler).start();
- }
-
-
- class DefaultExportHandler implements Runnable {
- public void run() {
- try {
- boolean success = sketch.exportApplet();
- if (success) {
- File appletFolder = new File(sketch.getFolder(), "applet");
- Base.openFolder(appletFolder);
- statusNotice("Done exporting.");
- } else {
- // error message will already be visible
- }
- } catch (Exception e) {
- statusError(e);
- }
- //toolbar.clear();
- toolbar.deactivate(EditorToolbar.EXPORT);
- }
- }
-
-
- /**
- * Handler for Sketch → Export Application
- */
- synchronized public void handleExportApplication() {
- if (!handleExportCheckModified()) return;
- toolbar.activate(EditorToolbar.EXPORT);
-
- // previous was using SwingUtilities.invokeLater()
- new Thread(exportAppHandler).start();
- }
-
-
- class DefaultExportAppHandler implements Runnable {
- public void run() {
- statusNotice("Exporting application...");
- try {
- if (sketch.exportApplicationPrompt()) {
- Base.openFolder(sketch.getFolder());
- statusNotice("Done exporting.");
- } else {
- // error message will already be visible
- // or there was no error, in which case it was canceled.
- }
- } catch (Exception e) {
- statusNotice("Error during export.");
- e.printStackTrace();
- }
- //toolbar.clear();
- toolbar.deactivate(EditorToolbar.EXPORT);
- }
- }
-
-
- /**
- * Checks to see if the sketch has been modified, and if so,
- * asks the user to save the sketch or cancel the export.
- * This prevents issues where an incomplete version of the sketch
- * would be exported, and is a fix for
- * Bug 157
- */
- protected boolean handleExportCheckModified() {
- if (!sketch.isModified()) return true;
-
- Object[] options = { "OK", "Cancel" };
- int result = JOptionPane.showOptionDialog(this,
- "Save changes before export?",
- "Save",
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE,
- null,
- options,
- options[0]);
-
- if (result == JOptionPane.OK_OPTION) {
- handleSave(true);
-
- } else {
- // why it's not CANCEL_OPTION is beyond me (at least on the mac)
- // but f-- it.. let's get this shite done..
- //} else if (result == JOptionPane.CANCEL_OPTION) {
- statusNotice("Export canceled, changes must first be saved.");
- //toolbar.clear();
- return false;
}
return true;
}
@@ -2067,16 +1964,26 @@ public class Editor extends JFrame implements RunnerListener {
}
+ /**
+ * Halt the current runner for whatever reason. Might be the VM dying,
+ * the window closing, an error...
+ */
+ abstract public void internalCloseRunner();
+
+
+ abstract public void deactivateRun();
+
+
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
/**
- * Show an error int the status bar.
+ * Show an error in the status bar.
*/
public void statusError(String what) {
status.error(what);
//new Exception("deactivating RUN").printStackTrace();
- toolbar.deactivate(EditorToolbar.RUN);
+// toolbar.deactivate(EditorToolbar.RUN);
}
@@ -2090,8 +1997,8 @@ public class Editor extends JFrame implements RunnerListener {
// return;
// }
- if (e instanceof RunnerException) {
- RunnerException re = (RunnerException) e;
+ if (e instanceof SketchException) {
+ SketchException re = (SketchException) e;
if (re.hasCodeIndex()) {
sketch.setCurrentCode(re.getCodeIndex());
}
@@ -2252,7 +2159,7 @@ public class Editor extends JFrame implements RunnerListener {
discourseItem.setEnabled(true);
String sel = textarea.getSelectedText().trim();
- String referenceFile = PdeKeywords.getReference(sel);
+ String referenceFile = mode.getReference(sel);
referenceItem.setEnabled(referenceFile != null);
} else {
diff --git a/app/src/processing/app/EditorConsole.java b/app/src/processing/app/EditorConsole.java
index 88644ce79..281b109f3 100644
--- a/app/src/processing/app/EditorConsole.java
+++ b/app/src/processing/app/EditorConsole.java
@@ -3,7 +3,7 @@
/*
Part of the Processing project - http://processing.org
- Copyright (c) 2004-06 Ben Fry and Casey Reas
+ Copyright (c) 2004-10 Ben Fry and Casey Reas
Copyright (c) 2001-04 Massachusetts Institute of Technology
This program is free software; you can redistribute it and/or modify
@@ -26,18 +26,27 @@ package processing.app;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
+
import javax.swing.*;
import javax.swing.text.*;
+import processing.core.PApplet;
+import java.text.SimpleDateFormat;
import java.util.*;
/**
* Message console that sits below the editing area.
- *
- * Debugging this class is tricky... If it's throwing exceptions,
+ *
+ * Be careful when debugging this class, because if it's throwing exceptions,
* don't take over System.err, and debug while watching just System.out
- * or just write println() or whatever directly to systemOut or systemErr.
+ * or just call println() or whatever directly to systemOut or systemErr.
+ *
+ * Also note that encodings will not work properly when run from Eclipse. This
+ * means that if you use non-ASCII characters in a println() or some such,
+ * the characters won't print properly in the Processing and/or Eclipse console.
+ * It seems that Eclipse's console-grabbing and that of Processing don't
+ * get along with one another. Use 'ant run' to work on encoding-related issues.
*/
public class EditorConsole extends JScrollPane {
Editor editor;
@@ -50,16 +59,12 @@ public class EditorConsole extends JScrollPane {
int maxLineCount;
- static File errFile;
- static File outFile;
- static File tempFolder;
-
// Single static instance shared because there's only one real System.out.
// Within the input handlers, the currentConsole variable will be used to
// echo things to the correct location.
- static public PrintStream systemOut;
- static public PrintStream systemErr;
+ static PrintStream systemOut;
+ static PrintStream systemErr;
static PrintStream consoleOut;
static PrintStream consoleErr;
@@ -75,42 +80,53 @@ public class EditorConsole extends JScrollPane {
systemOut = System.out;
systemErr = System.err;
- // Create a temporary folder which will have a randomized name. Has to
- // be randomized otherwise another instance of Processing (or one of its
- // sister IDEs) might collide with the file causing permissions problems.
- // The files and folders are not deleted on exit because they may be
- // needed for debugging or bug reporting.
- tempFolder = Base.createTempFolder("console");
+ // placing everything inside a try block because this can be a dangerous
+ // time for the lights to blink out and crash for and obscure reason.
try {
- String outFileName = Preferences.get("console.output.file");
- if (outFileName != null) {
- outFile = new File(tempFolder, outFileName);
- stdoutFile = new FileOutputStream(outFile);
- }
+ // Create output files that will have a randomized name. Has to
+ // be randomized otherwise another instance of Processing (or one of its
+ // sister IDEs) might collide with the file causing permissions problems.
+ // The files and folders are not deleted on exit because they may be
+ // needed for debugging or bug reporting.
+ SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd");
+ String randy = PApplet.nf((int) (1000 * Math.random()), 4);
+ String stamp = formatter.format(new Date()) + "_" + randy;
- String errFileName = Preferences.get("console.error.file");
- if (errFileName != null) {
- errFile = new File(tempFolder, errFileName);
- stderrFile = new FileOutputStream(errFile);
- }
- } catch (IOException e) {
- Base.showWarning("Console Error",
- "A problem occurred while trying to open the\n" +
- "files used to store the console output.", e);
- }
- consoleOut = new PrintStream(new EditorConsoleStream(false));
- consoleErr = new PrintStream(new EditorConsoleStream(true));
+ File consoleDir = Base.getSettingsFile("console");
+ consoleDir.mkdirs();
+ File outFile = new File(consoleDir, stamp + ".out");
+ stdoutFile = new FileOutputStream(outFile);
+ File errFile = new File(consoleDir, stamp + ".err");
+ stderrFile = new FileOutputStream(errFile);
+
+ consoleOut = new PrintStream(new EditorConsoleStream(false));
+ consoleErr = new PrintStream(new EditorConsoleStream(true));
- if (Preferences.getBoolean("console")) {
- try {
- System.setOut(consoleOut);
- System.setErr(consoleErr);
- } catch (Exception e) {
- e.printStackTrace(systemErr);
- }
+ System.setOut(consoleOut);
+ System.setErr(consoleErr);
+
+// } catch (Exception e) {
+// stdoutFile = null;
+// stderrFile = null;
+//
+// e.printStackTrace();
+// Base.showWarning("Console Error",
+// "A problem occurred while trying to open the\n" +
+// "files used to store the console output.", e);
+ } catch (Exception e) {
+ stdoutFile = null;
+ stderrFile = null;
+
+ consoleOut = null;
+ consoleErr = null;
+
+ System.setOut(systemOut);
+ System.setErr(systemErr);
+
+ e.printStackTrace(systemErr);
}
}
-
+
public EditorConsole(Editor editor) {
this.editor = editor;
@@ -121,47 +137,11 @@ public class EditorConsole extends JScrollPane {
consoleTextPane = new JTextPane(consoleDoc);
consoleTextPane.setEditable(false);
- // necessary?
- MutableAttributeSet standard = new SimpleAttributeSet();
- StyleConstants.setAlignment(standard, StyleConstants.ALIGN_LEFT);
- consoleDoc.setParagraphAttributes(0, 0, standard, true);
-
- // build styles for different types of console output
- Color bgColor = Theme.getColor("console.color");
- Color fgColorOut = Theme.getColor("console.output.color");
- Color fgColorErr = Theme.getColor("console.error.color");
- Font font = Theme.getFont("console.font");
-
- stdStyle = new SimpleAttributeSet();
- StyleConstants.setForeground(stdStyle, fgColorOut);
- StyleConstants.setBackground(stdStyle, bgColor);
- StyleConstants.setFontSize(stdStyle, font.getSize());
- StyleConstants.setFontFamily(stdStyle, font.getFamily());
- StyleConstants.setBold(stdStyle, font.isBold());
- StyleConstants.setItalic(stdStyle, font.isItalic());
-
- errStyle = new SimpleAttributeSet();
- StyleConstants.setForeground(errStyle, fgColorErr);
- StyleConstants.setBackground(errStyle, bgColor);
- StyleConstants.setFontSize(errStyle, font.getSize());
- StyleConstants.setFontFamily(errStyle, font.getFamily());
- StyleConstants.setBold(errStyle, font.isBold());
- StyleConstants.setItalic(errStyle, font.isItalic());
-
- consoleTextPane.setBackground(bgColor);
+ updateMode();
// add the jtextpane to this scrollpane
this.setViewportView(consoleTextPane);
- // calculate height of a line of text in pixels
- // and size window accordingly
- FontMetrics metrics = this.getFontMetrics(font);
- int height = metrics.getAscent() + metrics.getDescent();
- int lines = Preferences.getInteger("console.lines"); //, 4);
- int sizeFudge = 6; //10; // unclear why this is necessary, but it is
- setPreferredSize(new Dimension(1024, (height * lines) + sizeFudge));
- setMinimumSize(new Dimension(1024, (height * 4) + sizeFudge));
-
// to fix ugliness.. normally macosx java 1.3 puts an
// ugly white border around this object, so turn it off.
if (Base.isMacOS()) {
@@ -182,6 +162,53 @@ public class EditorConsole extends JScrollPane {
}
}).start();
}
+
+
+ /**
+ * Change coloring, fonts, etc in response to a mode change.
+ */
+ protected void updateMode() {
+ Mode mode = editor.getMode();
+
+ // necessary?
+ MutableAttributeSet standard = new SimpleAttributeSet();
+ StyleConstants.setAlignment(standard, StyleConstants.ALIGN_LEFT);
+ consoleDoc.setParagraphAttributes(0, 0, standard, true);
+
+ Font font = Preferences.getFont("console.font");
+
+ // build styles for different types of console output
+ Color bgColor = mode.getColor("console.color");
+ Color fgColorOut = mode.getColor("console.output.color");
+ Color fgColorErr = mode.getColor("console.error.color");
+
+ stdStyle = new SimpleAttributeSet();
+ StyleConstants.setForeground(stdStyle, fgColorOut);
+ StyleConstants.setBackground(stdStyle, bgColor);
+ StyleConstants.setFontSize(stdStyle, font.getSize());
+ StyleConstants.setFontFamily(stdStyle, font.getFamily());
+ StyleConstants.setBold(stdStyle, font.isBold());
+ StyleConstants.setItalic(stdStyle, font.isItalic());
+
+ errStyle = new SimpleAttributeSet();
+ StyleConstants.setForeground(errStyle, fgColorErr);
+ StyleConstants.setBackground(errStyle, bgColor);
+ StyleConstants.setFontSize(errStyle, font.getSize());
+ StyleConstants.setFontFamily(errStyle, font.getFamily());
+ StyleConstants.setBold(errStyle, font.isBold());
+ StyleConstants.setItalic(errStyle, font.isItalic());
+
+ consoleTextPane.setBackground(bgColor);
+
+ // calculate height of a line of text in pixels
+ // and size window accordingly
+ FontMetrics metrics = this.getFontMetrics(font);
+ int height = metrics.getAscent() + metrics.getDescent();
+ int lines = Preferences.getInteger("console.lines"); //, 4);
+ int sizeFudge = 6; //10; // unclear why this is necessary, but it is
+ setPreferredSize(new Dimension(1024, (height * lines) + sizeFudge));
+ setMinimumSize(new Dimension(1024, (height * 4) + sizeFudge));
+ }
static public void setEditor(Editor editor) {
@@ -202,34 +229,32 @@ public class EditorConsole extends JScrollPane {
System.setOut(systemOut);
System.setErr(systemErr);
- // close the PrintStream
- consoleOut.close();
- consoleErr.close();
-
- // also have to close the original FileOutputStream
- // otherwise it won't be shut down completely
try {
- stdoutFile.close();
- stderrFile.close();
+ // close the PrintStream
+ if (consoleOut != null) consoleOut.close();
+ if (consoleErr != null) consoleErr.close();
+
+ // also have to close the original FileOutputStream
+ // otherwise it won't be shut down completely
+ if (stdoutFile != null) stdoutFile.close();
+ if (stderrFile != null) stderrFile.close();
+
} catch (IOException e) {
- e.printStackTrace(systemOut);
+ e.printStackTrace(systemErr);
}
-
- outFile.delete();
- errFile.delete();
- tempFolder.delete();
- }
-
-
- public void write(byte b[], int offset, int length, boolean err) {
- // we could do some cross platform CR/LF mangling here before outputting
- // add text to output document
- message(new String(b, offset, length), err, false);
}
+// public void write(byte b[], int offset, int length, boolean err) {
+// // we could do some cross platform CR/LF mangling here before outputting
+// // add text to output document
+// message(new String(b, offset, length), err, false);
+// }
+
+
// added sync for 0091.. not sure if it helps or hinders
- synchronized public void message(String what, boolean err, boolean advance) {
+ //synchronized public void message(String what, boolean err, boolean advance) {
+ synchronized public void message(String what, boolean err) {
if (err) {
systemErr.print(what);
//systemErr.print("CE" + what);
@@ -238,35 +263,24 @@ public class EditorConsole extends JScrollPane {
//systemOut.print("CO" + what);
}
- if (advance) {
- appendText("\n", err);
- if (err) {
- systemErr.println();
- } else {
- systemOut.println();
- }
- }
+// if (advance) {
+// appendText("\n", err);
+// if (err) {
+// systemErr.println();
+// } else {
+// systemOut.println();
+// }
+// }
- // to console display
- appendText(what, err);
- // moved down here since something is punting
- }
-
-
- /**
- * Append a piece of text to the console.
- *
- * Swing components are NOT thread-safe, and since the MessageSiphon
- * instantiates new threads, and in those callbacks, they often print
- * output to stdout and stderr, which are wrapped by EditorConsoleStream
- * and eventually leads to EditorConsole.appendText(), which directly
- * updates the Swing text components, causing deadlock.
- *
- * Updates are buffered to the console and displayed at regular
- * intervals on Swing's event-dispatching thread. (patch by David Mellis)
- */
- synchronized private void appendText(String txt, boolean e) {
- consoleDoc.appendString(txt, e ? errStyle : stdStyle);
+ // Append a piece of text to the console. Swing components are NOT
+ // thread-safe, and since the MessageSiphon instantiates new threads,
+ // and in those callbacks, they often print output to stdout and stderr,
+ // which are wrapped by EditorConsoleStream and eventually leads to
+ // EditorConsole.appendText(), which directly updates the Swing text
+ // components, causing deadlock. Updates are buffered to the console and
+ // displayed at regular intervals on Swing's event-dispatching thread.
+ // (patch by David Mellis)
+ consoleDoc.appendString(what, err ? errStyle : stdStyle);
}
@@ -297,33 +311,14 @@ public class EditorConsole extends JScrollPane {
public void flush() { }
public void write(byte b[]) { // appears never to be used
- if (currentConsole != null) {
- currentConsole.write(b, 0, b.length, err);
- } else {
- try {
- if (err) {
- systemErr.write(b);
- } else {
- systemOut.write(b);
- }
- } catch (IOException e) { } // just ignore, where would we write?
- }
-
- OutputStream echo = err ? stderrFile : stdoutFile;
- if (echo != null) {
- try {
- echo.write(b);
- echo.flush();
- } catch (IOException e) {
- e.printStackTrace();
- echo = null;
- }
- }
+ write(b, 0, b.length);
}
public void write(byte b[], int offset, int length) {
if (currentConsole != null) {
- currentConsole.write(b, offset, length, err);
+ //currentConsole.write(b, offset, length, err);
+// currentConsole.message(new String(b, offset, length), err, false);
+ currentConsole.message(new String(b, offset, length), err);
} else {
try {
if (err) {
@@ -347,24 +342,8 @@ public class EditorConsole extends JScrollPane {
}
public void write(int b) {
- single[0] = (byte)b;
- if (currentConsole != null) {
- currentConsole.write(single, 0, 1, err);
- } else {
- // redirect for all the extra handling above
- write(new byte[] { (byte) b }, 0, 1);
- }
-
- OutputStream echo = err ? stderrFile : stdoutFile;
- if (echo != null) {
- try {
- echo.write(b);
- echo.flush();
- } catch (IOException e) {
- e.printStackTrace();
- echo = null;
- }
- }
+ single[0] = (byte) b;
+ write(single, 0, 1);
}
}
}
diff --git a/app/src/processing/app/EditorHeader.java b/app/src/processing/app/EditorHeader.java
index a72b18b89..32a61f033 100644
--- a/app/src/processing/app/EditorHeader.java
+++ b/app/src/processing/app/EditorHeader.java
@@ -33,8 +33,8 @@ import javax.swing.*;
* Sketch tabs at the top of the editor window.
*/
public class EditorHeader extends JComponent {
- static Color backgroundColor;
- static Color textColor[] = new Color[2];
+ Color backgroundColor;
+ Color textColor[] = new Color[2];
Editor editor;
@@ -65,7 +65,7 @@ public class EditorHeader extends JComponent {
static final int PIECE_WIDTH = 4;
- static Image[][] pieces;
+ Image[][] pieces;
//
@@ -75,26 +75,9 @@ public class EditorHeader extends JComponent {
public EditorHeader(Editor eddie) {
- this.editor = eddie; // weird name for listener
+ this.editor = eddie;
- if (pieces == null) {
- pieces = new Image[STATUS.length][WHERE.length];
- for (int i = 0; i < STATUS.length; i++) {
- for (int j = 0; j < WHERE.length; j++) {
- String path = "tab-" + STATUS[i] + "-" + WHERE[j] + ".gif";
- pieces[i][j] = Base.getThemeImage(path, this);
- }
- }
- }
-
- if (backgroundColor == null) {
- backgroundColor =
- Theme.getColor("header.bgcolor");
- textColor[SELECTED] =
- Theme.getColor("header.text.selected.color");
- textColor[UNSELECTED] =
- Theme.getColor("header.text.unselected.color");
- }
+ updateMode();
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
@@ -118,6 +101,23 @@ public class EditorHeader extends JComponent {
}
+ public void updateMode() {
+ Mode mode = editor.getMode();
+ pieces = new Image[STATUS.length][WHERE.length];
+ for (int i = 0; i < STATUS.length; i++) {
+ for (int j = 0; j < WHERE.length; j++) {
+ String filename = "tab-" + STATUS[i] + "-" + WHERE[j] + ".gif";
+ pieces[i][j] = mode.loadImage(filename);
+ }
+ }
+
+ backgroundColor = mode.getColor("header.bgcolor");
+ textColor[SELECTED] = mode.getColor("header.text.selected.color");
+ textColor[UNSELECTED] = mode.getColor("header.text.unselected.color");
+ font = mode.getFont("header.text.font");
+ }
+
+
public void paintComponent(Graphics screen) {
if (screen == null) return;
@@ -148,9 +148,6 @@ public class EditorHeader extends JComponent {
}
Graphics g = offscreen.getGraphics();
- if (font == null) {
- font = Theme.getFont("header.text.font");
- }
g.setFont(font); // need to set this each time through
metrics = g.getFontMetrics();
fontAscent = metrics.getAscent();
@@ -173,8 +170,9 @@ public class EditorHeader extends JComponent {
for (int i = 0; i < sketch.getCodeCount(); i++) {
SketchCode code = sketch.getCode(i);
- String codeName = sketch.hideExtension(code.getExtension()) ?
- code.getPrettyName() : code.getFileName();
+ // hide extensions for .pde files (or whatever else is the norm elsewhere
+ boolean hide = editor.getMode().hideExtension(code.getExtension());
+ String codeName = hide ? code.getPrettyName() : code.getFileName();
// if modified, add the li'l glyph next to the name
String text = " " + codeName + (code.isModified() ? " \u00A7" : " ");
diff --git a/app/src/processing/app/EditorLineStatus.java b/app/src/processing/app/EditorLineStatus.java
index f28175ff0..04c0d8911 100644
--- a/app/src/processing/app/EditorLineStatus.java
+++ b/app/src/processing/app/EditorLineStatus.java
@@ -22,8 +22,6 @@
package processing.app;
-import processing.app.syntax.*;
-
import java.awt.*;
import javax.swing.*;
@@ -32,7 +30,8 @@ import javax.swing.*;
* Li'l status bar fella that shows the line number.
*/
public class EditorLineStatus extends JComponent {
- JEditTextArea textarea;
+ Editor editor;
+// JEditTextArea textarea;
int start = -1, stop;
Image resize;
@@ -45,21 +44,28 @@ public class EditorLineStatus extends JComponent {
String text = "";
- public EditorLineStatus(JEditTextArea textarea) {
- this.textarea = textarea;
- textarea.editorLineStatus = this;
+ public EditorLineStatus(Editor editor) {
+ this.editor = editor;
+
+// textarea = editor.getTextArea();
+ // not pretty, but it just does one thing...
+// textarea.editorLineStatus = this;
+ editor.getTextArea().editorLineStatus = this;
- background = Theme.getColor("linestatus.bgcolor");
- font = Theme.getFont("linestatus.font");
- foreground = Theme.getColor("linestatus.color");
- high = Theme.getInteger("linestatus.height");
+ updateMode();
+ }
+
+
+ public void updateMode() {
+ Mode mode = editor.getMode();
+ background = mode.getColor("linestatus.bgcolor");
+ font = mode.getFont("linestatus.font");
+ foreground = mode.getColor("linestatus.color");
+ high = mode.getInteger("linestatus.height");
if (Base.isMacOS()) {
- resize = Base.getThemeImage("resize.gif", this);
+ resize = mode.loadImage("resize.gif");
}
- //linestatus.bgcolor = #000000
- //linestatus.font = SansSerif,plain,10
- //linestatus.color = #FFFFFF
}
diff --git a/app/src/processing/app/EditorStatus.java b/app/src/processing/app/EditorStatus.java
index a7035ab7c..054ba735a 100644
--- a/app/src/processing/app/EditorStatus.java
+++ b/app/src/processing/app/EditorStatus.java
@@ -3,7 +3,7 @@
/*
Part of the Processing project - http://processing.org
- Copyright (c) 2004-08 Ben Fry and Casey Reas
+ Copyright (c) 2004-10 Ben Fry and Casey Reas
Copyright (c) 2001-04 Massachusetts Institute of Technology
This program is free software; you can redistribute it and/or modify
@@ -31,9 +31,9 @@ import javax.swing.*;
/**
* Panel just below the editing area that contains status messages.
*/
-public class EditorStatus extends JPanel /*implements ActionListener*/ {
- static Color bgcolor[];
- static Color fgcolor[];
+public class EditorStatus extends JPanel {
+ Color[] bgcolor;
+ Color[] fgcolor;
static final int NOTICE = 0;
static final int ERR = 1;
@@ -61,38 +61,42 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
int sizeW, sizeH;
int imageW, imageH;
- //JButton yesButton;
- //JButton noButton;
JButton cancelButton;
JButton okButton;
JTextField editField;
- //Thread promptThread;
int response;
public EditorStatus(Editor editor) {
this.editor = editor;
empty();
+ updateMode();
+ }
+
+
+ public void updateMode() {
+ Mode mode = editor.getMode();
+ bgcolor = new Color[] {
+ mode.getColor("status.notice.bgcolor"),
+ mode.getColor("status.error.bgcolor"),
+ mode.getColor("status.edit.bgcolor")
+ };
- if (bgcolor == null) {
- bgcolor = new Color[3]; //4];
- bgcolor[0] = Theme.getColor("status.notice.bgcolor");
- bgcolor[1] = Theme.getColor("status.error.bgcolor");
- bgcolor[2] = Theme.getColor("status.edit.bgcolor");
+ fgcolor = new Color[] {
+ mode.getColor("status.notice.fgcolor"),
+ mode.getColor("status.error.fgcolor"),
+ mode.getColor("status.edit.fgcolor")
+ };
- fgcolor = new Color[3]; //4];
- fgcolor[0] = Theme.getColor("status.notice.fgcolor");
- fgcolor[1] = Theme.getColor("status.error.fgcolor");
- fgcolor[2] = Theme.getColor("status.edit.fgcolor");
- }
+ font = mode.getFont("status.font");
+ metrics = null;
}
public void empty() {
mode = NOTICE;
message = NO_MESSAGE;
- //update();
repaint();
}
@@ -100,7 +104,6 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
public void notice(String message) {
mode = NOTICE;
this.message = message;
- //update();
repaint();
}
@@ -116,31 +119,6 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
}
- /*
- public void prompt(String message) {
- mode = PROMPT;
- this.message = message;
-
- response = 0;
- yesButton.setVisible(true);
- noButton.setVisible(true);
- cancelButton.setVisible(true);
- yesButton.requestFocus();
-
- repaint();
- }
-
-
- // prompt has been handled, re-hide the buttons
- public void unprompt() {
- yesButton.setVisible(false);
- noButton.setVisible(false);
- cancelButton.setVisible(false);
- empty();
- }
- */
-
-
public void edit(String message, String dflt) {
mode = EDIT;
this.message = message;
@@ -164,27 +142,9 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
}
- /*
- public void update() {
- Graphics g = this.getGraphics();
- try {
- setBackground(bgcolor[mode]);
- } catch (NullPointerException e) { } // if not ready yet
- if (g != null) paint(g);
- }
-
- public void update(Graphics g) {
- paint(g);
- }
- */
-
-
public void paintComponent(Graphics screen) {
- //if (screen == null) return;
if (okButton == null) setup();
- //System.out.println("status.paintComponent");
-
Dimension size = getSize();
if ((size.width != sizeW) || (size.height != sizeH)) {
// component has been resized
@@ -211,10 +171,8 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
}
Graphics g = offscreen.getGraphics();
- if (font == null) {
- font = Theme.getFont("status.font");
- //new Font("SansSerif", Font.PLAIN, 12));
- g.setFont(font);
+ g.setFont(font);
+ if (metrics == null) {
metrics = g.getFontMetrics();
ascent = metrics.getAscent();
}
@@ -267,20 +225,9 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
}
setLayout(null);
- /*
- yesButton.addActionListener(this);
- noButton.addActionListener(this);
- cancelButton.addActionListener(this);
- okButton.addActionListener(this);
- */
-
- //add(yesButton);
- //add(noButton);
add(cancelButton);
add(okButton);
- //yesButton.setVisible(false);
- //noButton.setVisible(false);
cancelButton.setVisible(false);
okButton.setVisible(false);
@@ -405,10 +352,12 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
return getMinimumSize();
}
+
public Dimension getMinimumSize() {
return new Dimension(300, Preferences.GRID_SIZE);
}
+
public Dimension getMaximumSize() {
return new Dimension(3000, Preferences.GRID_SIZE);
}
diff --git a/app/src/processing/app/EditorToolbar.java b/app/src/processing/app/EditorToolbar.java
index 8443ae07a..872406774 100644
--- a/app/src/processing/app/EditorToolbar.java
+++ b/app/src/processing/app/EditorToolbar.java
@@ -24,6 +24,7 @@ package processing.app;
import java.awt.*;
import java.awt.event.*;
+import java.util.ArrayList;
import javax.swing.*;
import javax.swing.event.*;
@@ -34,17 +35,18 @@ import javax.swing.event.*;
*/
public class EditorToolbar extends JComponent implements MouseInputListener, KeyListener {
- /** Rollover titles for each button. */
- static final String title[] = {
- "Run", "Stop", "New", "Open", "Save", "Export"
- };
-
- /** Titles for each button when the shift key is pressed. */
- static final String titleShift[] = {
- "Present", "Stop", "New Editor Window", "Open in Another Window", "Save", "Export to Application"
- };
+// /** Rollover titles for each button. */
+// static final String title[] = {
+// "Run", "Stop", "New", "Open", "Save", "Export"
+// };
+//
+// /** Titles for each button when the shift key is pressed. */
+// static final String titleShift[] = {
+// "Present", "Stop", "New Editor Window", "Open in Another Window", "Save", "Export to Application"
+// };
- static final int BUTTON_COUNT = title.length;
+
+// static final int BUTTON_COUNT = title.length;
/** Width of each toolbar button. */
static final int BUTTON_WIDTH = 27;
/** Height of each toolbar button. */
@@ -54,89 +56,89 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
/** Size of the button image being chopped up. */
static final int BUTTON_IMAGE_SIZE = 33;
-
- static final int RUN = 0;
- static final int STOP = 1;
-
- static final int NEW = 2;
- static final int OPEN = 3;
- static final int SAVE = 4;
- static final int EXPORT = 5;
-
static final int INACTIVE = 0;
static final int ROLLOVER = 1;
static final int ACTIVE = 2;
- Editor editor;
+ protected Base base;
+ protected Editor editor;
+ protected Mode mode;
Image offscreen;
int width, height;
Color bgcolor;
- static Image[][] buttonImages;
- int currentRollover;
+// static Image[][] buttonImages;
+// int currentRollover;
+ protected Button rollover;
- JPopupMenu popup;
- JMenu menu;
+// int buttonCount;
+ /** Current state for this button */
+// int[] state; // = new int[BUTTON_COUNT];
+ /** Current image for this button's state */
+// Image[] stateImage;
+// int which[]; // mapping indices to implementation
- int buttonCount;
- int[] state = new int[BUTTON_COUNT];
- Image[] stateImage;
- int which[]; // mapping indices to implementation
-
- int x1[], x2[];
- int y1, y2;
+// int x1[], x2[];
+ static final int TOP = 0;
+ static final int BOTTOM = BUTTON_HEIGHT;
Font statusFont;
Color statusColor;
boolean shiftPressed;
-
-// Color modeButtonColor;
-// Font modeTextFont;
-// Color modeTextColor;
-// String modeTitle = "JAVA"; //"Java";
+
+ // what the mode indicator looks like
+ Color modeButtonColor;
+ Font modeTextFont;
+ Color modeTextColor;
+ String modeTitle; // = "JAVA"; //"Java";
// String modeTitle = "ANDROID"; //"Java";
-// int modeX1, modeY1;
-// int modeX2, modeY2;
+ int modeX1, modeY1;
+ int modeX2, modeY2;
+
+ ArrayList