From e542a0735604ebc50c3c99a730e7cec55ddc903a Mon Sep 17 00:00:00 2001 From: lonnen Date: Tue, 7 Sep 2010 20:45:41 +0000 Subject: [PATCH] Added licesnse info, fixed core doc, started adding Sketch perspective stuff --- .../Processing Plugin for Eclipse/feature.xml | 41 +-- .../META-INF/MANIFEST.MF | 1 + .../plugin/core/ProcessingCore.java | 18 +- .../core/ProcessingCorePreferences.java | 43 ++- .../processing/plugin/core/ProcessingLog.java | 13 +- .../plugin/core/builder/SketchBuilder.java | 337 +++++++----------- .../plugin/core/builder/SketchProject.java | 84 +++-- .../plugin/core/builder/Utilities.java | 14 +- ...singSketchLaunchConfigurationDelegate.java | 46 +-- editor/processing.plugin.ui/plugin.xml | 12 + .../processing/plugin/ui/ProcessingLog.java | 11 + .../plugin/ui/ProcessingPlugin.java | 10 + .../launching/RunSketchAsAppletShortcut.java | 14 +- .../ui/preferences/CorePreferencePage.java | 14 +- .../ui/preferences/PreferenceConstants.java | 10 + .../ui/preferences/PreferenceInitializer.java | 10 + .../ProcessingAnnotationHover.java | 10 + .../ProcessingDocumentSetupParticipant.java | 10 + .../ui/processingeditor/ProcessingEditor.java | 10 + .../ProcessingPartitionScanner.java | 10 + .../ProcessingSourceViewerConfiguration.java | 10 + .../ProcessingAutoIndentStrategy.java | 10 + .../language/ProcessingCodeScanner.java | 10 + .../ProcessingCompletionProcessor.java | 10 + .../ProcessingDoubleClickSelector.java | 10 + .../util/ProcessingColorProvider.java | 10 + .../util/ProcessingWhitespaceDetector.java | 10 + .../util/ProcessingWordDetector.java | 10 + .../plugin/ui/wizards/NewSketchWizard.java | 10 + .../ui/wizards/NewSketchWizardPage.java | 10 + 30 files changed, 476 insertions(+), 342 deletions(-) diff --git a/editor/Processing Plugin for Eclipse/feature.xml b/editor/Processing Plugin for Eclipse/feature.xml index 4717979bc..ab5bf972f 100644 --- a/editor/Processing Plugin for Eclipse/feature.xml +++ b/editor/Processing Plugin for Eclipse/feature.xml @@ -10,37 +10,24 @@ - Processing was started in Spring 2001 by Ben Fry and Casey Reas. -Fry was a PhD candidate at the MIT Media Laboratory and Reas -was an Associate Professor at the Interaction Design Institute -Ivrea. While Fry and Reas were employees of these institutions, -Processing began as a personal initiative and development took -place during the night and weekends through 2003. MIT indirectly -funded Processing through Fry's graduate stipend and Ivrea indirectly -funded Processing through Reas's salary. Due to his research -agreement with MIT, all code written by Fry during this time -is copyright MIT. -In summer 2003, Ivrea funded four individuals to work on the -project for a few months. This resulted in Dan Mosedale's preprocessor -using Antlr and Sami Arola's contributions to the graphics engine. -The code for these elements are both copyright 2003 Interaction -Design Institute Ivrea. In August 2003, Reas left the Interaction -Design Institute Ivrea and in June 2004, Fry left the MIT Media -Laboratory. The code and complete reference written since June + The Processing Plug-in for Eclipse was written in Summer 2010 by Chris Lonnen. It enables support for the Processing programming language in Eclipse. + +Processing was started in Spring 2001 by Ben Fry and Casey Reas. Fry was a PhD candidate at the MIT Media Laboratory and Reas was an Associate Professor at the Interaction Design Institute Ivrea. While Fry and Reas were employees of these institutions, Processing began as a personal initiative and development took place during the night and weekends through 2003. MIT indirectly funded Processing through Fry's graduate stipend and Ivrea indirectly funded Processing through Reas's salary. Due to his research agreement with MIT, all code written by Fry during this time is copyright MIT. + +In summer 2003, Ivrea funded four individuals to work on the project for a few months. This resulted in Dan Mosedale's preprocessor using Antlr and Sami Arola's contributions to the graphics engine. The code for these elements are both copyright 2003 Interaction Design Institute Ivrea. In August 2003, Reas left the Interaction Design Institute Ivrea and in June 2004, Fry left the MIT Media Laboratory. The code and complete reference written since June 2004 are copyright Ben Fry and Casey Reas. -Portions of the code were written by other contributors and are -attributed in the source code. For example, portions of the graphics -engine were written by Karsten Schmidt. The Processing Plug-in for -Eclipse was written in Summer 2010 by Chris Lonnen. There are many -contributions to the Exhibition and Examples on the Processing.org -website and these are attributed in context. -The Reference for the Language and Environment are under a Creative -Commons license which makes it possible to re-use this content -for non-commercial purposes if it is credited. + +Portions of the code were written by other contributors and are attributed in the source code. For example, portions of the graphics engine were written by Karsten Schmidt. + +There are many contributions to the Exhibition and Examples on the Processing.org website and these are attributed in context. The Reference for the Language and Environment are under a Creative Commons license which makes it possible to re-use this content for non-commercial purposes if it is credited. - [Enter License Description here.] + This program and the accompanying materials, unless otherwise noted, are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.opensource.org/licenses/eclipse-1.0.php + +Several libraries are included from the Processing language and Processing development environment. These are included under the GNU LGPL (http://www.gnu.org/licenses/lgpl.html). + +All images are included under a creative commons license (http://creativecommons.org/) that allows re-use for non-commercial work if it is credited. diff --git a/editor/processing.plugin.core/META-INF/MANIFEST.MF b/editor/processing.plugin.core/META-INF/MANIFEST.MF index 3a9d56fd7..aea013b8f 100644 --- a/editor/processing.plugin.core/META-INF/MANIFEST.MF +++ b/editor/processing.plugin.core/META-INF/MANIFEST.MF @@ -15,3 +15,4 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: processing.plugin.core, processing.plugin.core.builder +Import-Package: org.eclipse.core.commands diff --git a/editor/processing.plugin.core/src/processing/plugin/core/ProcessingCore.java b/editor/processing.plugin.core/src/processing/plugin/core/ProcessingCore.java index 2ef8d8a6b..15d51444c 100644 --- a/editor/processing.plugin.core/src/processing/plugin/core/ProcessingCore.java +++ b/editor/processing.plugin.core/src/processing/plugin/core/ProcessingCore.java @@ -1,12 +1,13 @@ -/******************************************************************************* +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * * This program and the accompanying materials are made available under the - * terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.opensource.org/licenses/cpl1.0.php + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php * * Contributors: * Chris Lonnen - initial API and implementation - *******************************************************************************/ - + */ package processing.plugin.core; import java.io.File; @@ -28,12 +29,7 @@ import org.eclipse.core.runtime.Plugin; import processing.plugin.core.builder.Utilities; /** - * The plug-in runtime class containing the core (UI-free) support for Processing - * sketches. - *

- * Like all plug-in runtime classes (subclasses of Plugin), this class - * is automatically instantiated by the platform when the plug-in gets activated. - *

+ * The plug-in activator enabling the core (UI-free) support for Processing sketches. *

* The single instance of this class can be accessed from any plug-in declaring the * Processing core plug-in as a prerequisite via diff --git a/editor/processing.plugin.core/src/processing/plugin/core/ProcessingCorePreferences.java b/editor/processing.plugin.core/src/processing/plugin/core/ProcessingCorePreferences.java index ea2db1558..02d93d1ae 100644 --- a/editor/processing.plugin.core/src/processing/plugin/core/ProcessingCorePreferences.java +++ b/editor/processing.plugin.core/src/processing/plugin/core/ProcessingCorePreferences.java @@ -1,12 +1,13 @@ -/******************************************************************************* +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * * This program and the accompanying materials are made available under the - * terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.opensource.org/licenses/cpl1.0.php + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php * * Contributors: - * Red Robin - Design pattern - * Chris Lonnen - Initial API and implementation - *******************************************************************************/ + * Chris Lonnen - initial API and implementation + */ package processing.plugin.core; import org.eclipse.core.runtime.IPath; @@ -14,13 +15,13 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Preferences; /** - * Container class for controlling access to the Procesing Core - * preference store. Modification of these preferences should only - * be done by preferences pages in processing.plugin.ui plug-in, but - * may be programatically accessed in the case of headless operation. + * Utility class for controlling access to the Processing Core preference store. + *

+ * Every expected preference has its own getter / setter */ @SuppressWarnings("deprecation") public class ProcessingCorePreferences { + //TODO this uses the depreciated Preferences store. Fix that. private static ProcessingCorePreferences current; @@ -28,24 +29,28 @@ public class ProcessingCorePreferences { static { current = new ProcessingCorePreferences(); } /** Name of the sketchbook location preference for lookup. */ - protected static final String SKETCHBOOK = ProcessingCore.PLUGIN_ID + ".preferences.skethbook"; + protected static final String SKETCHBOOK = ProcessingCore.PLUGIN_ID + ".preferences.sketchbook"; /** Returns the stored sketchbook path as a string. */ - public String getSketchbookPathString(){ + public String getSketchbookPathAsString(){ return this.getStore().getString(SKETCHBOOK); } - /** Returns the path to the sketchbook or null if there is none. */ - public IPath getSketchbookPath(){ - return this.pathOrNull(this.getSketchbookPathString()); - } - /** Saves the path to the sketchbook. */ - public void setSketchbookPath(String sketchbookPath){ + public void setSketchbookPathWithString(String sketchbookPath){ this.getStore().setValue(SKETCHBOOK, sketchbookPath); this.save(); } + /** Returns the path to the sketchbook or null if there is none. */ + public IPath getSketchbookPath(){ + return this.pathOrNull(this.getSketchbookPathAsString()); + } + + /** Set the sketchbook path using a path */ + public void setSketchbookPathWithPath(IPath sketchbookPath){ + this.getStore().setValue(SKETCHBOOK, sketchbookPath.toOSString()); + } /** Singleton pattern */ private ProcessingCorePreferences(){} @@ -66,7 +71,7 @@ public class ProcessingCorePreferences { } /** Utility method that returns a path from a string or null */ - protected IPath pathOrNull(String pathString){ + private IPath pathOrNull(String pathString){ return ( pathString.length()== 0 ) ? null : new Path(pathString); } } diff --git a/editor/processing.plugin.core/src/processing/plugin/core/ProcessingLog.java b/editor/processing.plugin.core/src/processing/plugin/core/ProcessingLog.java index dd7312452..c3825bcee 100644 --- a/editor/processing.plugin.core/src/processing/plugin/core/ProcessingLog.java +++ b/editor/processing.plugin.core/src/processing/plugin/core/ProcessingLog.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.core; import org.eclipse.core.runtime.IStatus; @@ -10,7 +20,8 @@ import org.eclipse.core.runtime.Status; * @author lonnen */ public class ProcessingLog { - + //TODO merge with ProcessingCore. Having multiple ProcessingLog files is friggin' confusing. + // Who needs a constructor? /** diff --git a/editor/processing.plugin.core/src/processing/plugin/core/builder/SketchBuilder.java b/editor/processing.plugin.core/src/processing/plugin/core/builder/SketchBuilder.java index 9ca08f661..0273a23b3 100644 --- a/editor/processing.plugin.core/src/processing/plugin/core/builder/SketchBuilder.java +++ b/editor/processing.plugin.core/src/processing/plugin/core/builder/SketchBuilder.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.core.builder; import java.io.ByteArrayInputStream; @@ -12,13 +22,17 @@ import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; +//import org.eclipse.core.resources.IResourceChangeListener; +//import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IncrementalProjectBuilder; +//import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.QualifiedName; +import org.eclipse.jdt.core.JavaModelException; import processing.app.Preferences; import processing.app.debug.RunnerException; @@ -29,12 +43,12 @@ import processing.plugin.core.ProcessingCore; import processing.plugin.core.ProcessingLog; /** - * Builder for Processing Sketches + * Builder for Processing Sketches. *

* Preprocesses .pde sketches into Java. Errors returned are reflected back on the source files. - * From Eclipse's perspective, Sketch projects are actually specially configured Java projects. - * The SketchNature manages this configuration stuff, so woe be to those who would carelessly - * manipulate this builder directly. + * The SketchNature class is tightly integrated and manages the configuration so this builder + * works together with the JDT, so woe be to those who would carelessly manipulate this builder + * directly. *

*

* The builder is compatible with the PDE, and it expects sketches to be laid out with the @@ -43,11 +57,10 @@ import processing.plugin.core.ProcessingLog; * able to use the PDE interchangeably with this builder. *

*

- * Though this implements the Incremental Project Builder, all builds are really full - * builds because the preprocessor is not incremental. + * Though this implements the Incremental Project Builder, the preprocessor is not incremental + * and forces all builds to be full builds. To save a little bit of time, any build request is + * treated as a full build without an inspection of the resource delta. *

- * @author lonnen - * */ public class SketchBuilder extends IncrementalProjectBuilder{ @@ -153,56 +166,50 @@ public class SketchBuilder extends IncrementalProjectBuilder{ * This can be a long running process, so we use a monitor. */ protected IProject[] fullBuild( SketchProject sketchProject, IProgressMonitor monitor) throws CoreException { - clean(sketchProject, monitor); - IProject sketch = sketchProject.getProject(); + clean(sketchProject, monitor); // tabula rasa + IProject sketch = sketchProject.getProject(); if ( sketch == null || !sketch.isAccessible() ){ - ProcessingLog.logError("Sketch is inaccessible!", null); + ProcessingLog.logError("Sketch is inaccessible. Aborting build process.", null); return null; } - // may not exist. - IFolder codeFolder = sketchProject.getCodeFolder(); - - /* - * A (temporary?) build folder, will be created if it doesn't exist. - * Markers cannot be added to this because it is a vanilla File. - */ - IFolder buildFolder = sketchProject.getBuildFolder(); - + sketchProject.wasLastBuildSuccessful = false; + IFolder buildFolder = sketchProject.getBuildFolder(); // created by the getter if (buildFolder == null){ ProcessingLog.logError("Build folder could not be accessed.", null); return null; } - monitor.beginTask("Sketch Build", 400); // not sure how much work to do here - if(!sketch.isOpen()) { return null; } // has to be open to access it + monitor.beginTask("Sketch Build", 40); // not sure how much work to do here if(checkCancel(monitor)) { return null; } - - PdePreprocessor preproc = new PdePreprocessor(sketch.getName(), 4); + /* If the code folder exists: + * Find any .jar files in it and its subfolders + * Add their paths to the library jar list for addition to the class path later on + * Get the packages of those jars so they can be added to the imports + * Add it to the class path source folders + */ + + IFolder codeFolder = sketchProject.getCodeFolder(); // may not exist String[] codeFolderPackages = null; - - // If the code folder exists: - // Find any .jar files in it and its subfolders - // Add their paths to the library jar list for addition to the class path later on - // Get the packages of those jars so they can be added to the imports - // Add it to the class path source folders if (codeFolder != null && codeFolder.exists()){ String codeFolderClassPath = Utilities.contentsToClassPath(codeFolder.getLocation().toFile()); for( String s : codeFolderClassPath.split(File.separator)){ if (!s.isEmpty()){ libraryJarPathList.add(new Path(s).makeAbsolute()); -// System.out.println("Library added " + s); } } codeFolderPackages = Utilities.packageListFromClassPath(codeFolderClassPath); -// srcFolderPathList.add(codeFolder.getFullPath()); // TODO verify this. } - // concatenate the individual .pde files into one large file using temporary - // 'session properties' attached to the IResource files, mark the start and end lines that they - // contribute to the bigCode file. This information will be used later for mapping errors backwards - + monitor.worked(10); + if(checkCancel(monitor)) { return null; } + /* concatenate the individual .pde files into one large file. + * Using temporary session properties attached to IResource files, mark where the file + * starts and ends in the bigCode file. This information is used later for mapping + * errors back to their source. + */ + StringBuffer bigCode = new StringBuffer(); int bigCount = 0; // line count @@ -219,7 +226,9 @@ public class SketchBuilder extends IncrementalProjectBuilder{ monitor.worked(10); if(checkCancel(monitor)) { return null; } - + // Feed everything to the preprocessor + + PdePreprocessor preproc = new PdePreprocessor(sketch.getName(), 4); PreprocessResult result = null; try{ IFile output = buildFolder.getFile(sketch.getName()+".java"); @@ -227,48 +236,34 @@ public class SketchBuilder extends IncrementalProjectBuilder{ result = preproc.write(stream, bigCode.toString(), codeFolderPackages); + sketchProject.sketch_width = -1; + sketchProject.sketch_height = -1; + String scrubbed = Utilities.scrubComments(stream.toString()); - String[] matches = Utilities.match(scrubbed, Utilities.SIZE_REGEX); - + String[] matches = Utilities.match(scrubbed, Utilities.SIZE_REGEX); if(matches != null){ try { int wide = Integer.parseInt(matches[1]); int high = Integer.parseInt(matches[2]); - if (high > 0){ - SketchProject.sketch_height = high; - } else { - SketchProject.sketch_height = -1; - } - if( wide > 0) { - SketchProject.sketch_width = wide; - } else { - SketchProject.sketch_width = -1; - } - + if(wide > 0) sketchProject.sketch_width = wide; + if (high > 0) sketchProject.sketch_height = high; } catch (NumberFormatException e) { - // found a reference to size, but it didn't - // seem to contain numbers - -// final String message = -// "The size of this applet could not automatically be\n" + -// "determined from your code. You'll have to edit the\n" + -// "HTML file to set the size of the applet.\n" + -// "Use only numeric values (not variables) for the size()\n" + -// "command. See the size() reference for an explanation."; - - // set these back to null - SketchProject.sketch_height = -1; - SketchProject.sketch_width = -1; - - ProcessingLog.logInfo("Could not find applet size"); + ProcessingLog.logInfo( + "Found a reference to size, but it didn't seem to contain numbers. " + + "Will use default sizes instead." + ); } - } // else no size() command found + } // else no size() command found, defaults are used ByteArrayInputStream inStream = new ByteArrayInputStream(stream.toString().getBytes()); try{ if (!output.exists()){ output.create(inStream, true, monitor); + //TODO resource change listener to move trace back JDT errors +// IWorkspace w = ResourcesPlugin.getWorkspace(); +// IResourceChangeListener rcl = new ProblemListener(output); +// w.addResourceChangeListener(rcl); } else { output.setContents(inStream, true, false, monitor); } @@ -276,8 +271,9 @@ public class SketchBuilder extends IncrementalProjectBuilder{ stream.close(); inStream.close(); } + srcFolderPathList.add(buildFolder.getFullPath()); -// System.out.println("Source added " + buildFolder.getFullPath()); + } catch(antlr.RecognitionException re){ IResource errorFile = null; // if this remains null, the error is reported back on the sketch itself with no line number @@ -301,36 +297,18 @@ public class SketchBuilder extends IncrementalProjectBuilder{ errorLine = -1; } - String msg = re.getMessage(); - - //TODO better errors handling, matching errors often get put after the document end. see highlightLine() inside editor. - // try to find a way to put all this error handling code in one spot. All of the message parsing and resource blaming, - // so it doesn't appear multiple times in the source. - if (msg.equals("expecting RCURLY, found 'null'")) - msg = "Found one too many { characters without a } to match it."; - if (msg.indexOf("expecting RBRACK") != -1) - msg = "Syntax error, maybe a missing right ] character?"; - if (msg.indexOf("expecting SEMI") != -1) - msg = "Syntax error, maybe a missing semicolon?"; - if (msg.indexOf("expecting RPAREN") != -1) - msg = "Syntax error, maybe a missing right parenthesis?"; - if (msg.indexOf("preproc.web_colors") != -1) - msg = "A web color (such as #ffcc00) must be six digits."; - - reportProblem(msg, errorFile, errorLine, true); - return null; // exit the build + reportProblem(re.getMessage(), errorFile, errorLine, true); + return null; // bail early } catch (antlr.TokenStreamRecognitionException tsre) { + // System.out.println("and then she tells me " + tsre.toString()); String mess = "^line (\\d+):(\\d+):\\s"; // a regexp to grab the line and column from the exception String[] matches = Utilities.match(tsre.toString(), mess); IResource errorFile = null; int errorLine = -1; - if (matches != null){ errorLine = Integer.parseInt(matches[1]) - 1; - // int errorColumn = Integer.parseInt(matches[2]); // unused in the builder - for( IResource file : sketch.members()){ if("pde".equalsIgnoreCase(file.getFileExtension())){ int low = (Integer) file.getSessionProperty(new QualifiedName(BUILDER_ID, "preproc start")); @@ -342,8 +320,6 @@ public class SketchBuilder extends IncrementalProjectBuilder{ } } } - - } // If no file was found or the regex failed @@ -353,15 +329,14 @@ public class SketchBuilder extends IncrementalProjectBuilder{ } reportProblem(tsre.getMessage(), errorFile, errorLine, true); - return null; + return null; // bail early } catch (RunnerException re){ /* * This error is not addressed in the PDE. I've only seen it correspond to - * an unclosed, double quote mark ("). The runner reports 1 line behind where - * it occurs, so we add 1 to its line. + * an unclosed, double quote mark ("). */ IResource errorFile = null; // if this remains null, the error is reported back on the sketch itself with no line - int errorLine = re.getCodeLine() + 1; + int errorLine = re.getCodeLine() + 1; // always reported 1 line early for( IResource file : sketch.members()){ if("pde".equalsIgnoreCase(file.getFileExtension())){ @@ -379,153 +354,80 @@ public class SketchBuilder extends IncrementalProjectBuilder{ if (errorFile == null){ errorFile = sketch; errorLine = -1; - } + } - //DEBUG - //System.out.println("error line - error file - offset"); - //System.out.println(errorLine + " - " + errorFile + " - " + getPreprocOffset((IFile) folderContents[errorFile])); - - String msg = re.getMessage(); - - //TODO see better error mapping todo above - if (msg.equals("expecting RCURLY, found 'null'")) - msg = "Found one too many { characters without a } to match it."; - if (msg.indexOf("expecting RBRACK") != -1) - msg = "Syntax error, maybe a missing right ] character?"; - if (msg.indexOf("expecting SEMI") != -1) - msg = "Syntax error, maybe a missing semicolon?"; - if (msg.indexOf("expecting RPAREN") != -1) - msg = "Syntax error, maybe a missing right parenthesis?"; - if (msg.indexOf("preproc.web_colors") != -1) - msg = "A web color (such as #ffcc00) must be six digits."; - - reportProblem(msg, errorFile, errorLine, true); - return null; // exit the build + reportProblem(re.getMessage(), errorFile, errorLine, true); + return null; // bail } catch (Exception e){ ProcessingLog.logError(e); - return null; + return null; // bail } monitor.worked(10); if(checkCancel(monitor)) { return null; } + // Library import checking - ArrayList libs = new ArrayList(); // a list of all the libraries that can be found + ArrayList allFoundLibraries = new ArrayList(); // a list of all the libraries that can be found - libs.addAll( Utilities.getLibraryJars(ProcessingCore.getProcessingCore().getCoreLibsFolder()) ); - libs.addAll( Utilities.getLibraryJars(Utilities.getSketchBookLibsFolder(sketch)) ); + allFoundLibraries.addAll( Utilities.getLibraryJars(ProcessingCore.getProcessingCore().getCoreLibsFolder()) ); + allFoundLibraries.addAll( Utilities.getLibraryJars(Utilities.getSketchBookLibsFolder(sketch)) ); - // setup the library table - HashMap importToLibraryTable = new HashMap(); + HashMap libraryImportToPathTable = new HashMap(); -// System.out.println("Libraries found (path sep: " + File.separator + " ) :"); - for (String s : libs ){ -// System.out.println(s); - String[] packages = Utilities.packageListFromClassPath(s); - for (String pkg : packages){ - importToLibraryTable.put(pkg, new Path(s)); -// System.out.println(pkg); - } + for (String libraryPath : allFoundLibraries ){ + String[] packages = Utilities.packageListFromClassPath(libraryPath); + for (String pkg : packages) libraryImportToPathTable.put(pkg, new Path(libraryPath)); } -// System.out.println("There were a few extra imports: " + result.extraImports.size()); + boolean importProblems = false; for (int i=0; i < result.extraImports.size(); i++){ - String item = result.extraImports.get(i); - // remove things up to the last dot - int dot = item.lastIndexOf('.'); - String entry = (dot == -1) ? item : item.substring(0, dot); -// System.out.println(entry); - IPath libPath = importToLibraryTable.get(entry); + String importPackage = result.extraImports.get(i); + int dot = importPackage.lastIndexOf('.'); + String entry = (dot == -1) ? importPackage : importPackage.substring(0, dot); + IPath libPath = libraryImportToPathTable.get(entry); if (libPath != null ){ - libraryJarPathList.add(libPath.makeAbsolute()); // huzzah! we've found it, make sure its fed to the compiler -// System.out.println("Extra lib added: " + libPath.makeAbsolute()); + libraryJarPathList.add(libPath.makeAbsolute()); // we've got it! } else { // The user is trying to import something we won't be able to find. reportProblem( - "Library import " + entry +" could not be found. Check the library folder in your sketchbook.", + "Library import "+ entry +" could not be found. Check the library folder in your sketchbook.", sketch.getFile( sketch.getName() + ".pde"), i+1, true ); + importProblems=true; } } - - // Adding the ol' Java classpath is handled by Eclipse. We don't worry about it. + if (importProblems) return null; // bail after all errors are found. monitor.worked(10); if(checkCancel(monitor)) { return null; } - - // I don't think this next part is necessary. - // At this point we've written the derived java file and the code folder, - // if it exists, is marked to be added to the classpath. There's not much sense - // to copying things to the code folder and further messing with the offsets. - - // // 3. loop over the code[] and save each .java file - // - // for( IResource file : sketch.members()){ - // if("java".equalsIgnoreCase(file.getFileExtension())){ - // String filename = file.getName() + ".java"; - // try{ - // String program = Utilities.readFile((IFile) file); - // String[] pkg = Utilities.match(program, Utilities.PACKAGE_REGEX); - // // if no package, add one - // if(pkg == null){ - // pkg = new String[] { packageName }; - // // add the package name to the source - // program = "package " + packageName + ";" + program; - // } - // IFolder packageFolder = buildFolder.getFolder(pkg[0].replace('.', '/')); - // if (!packageFolder.exists()) - // packageFolder.create(IResource.NONE, true, null); - // - // IFile modFile = packageFolder.getFile(file.getName() + ".java"); - // - // ByteArrayInputStream inStream = new ByteArrayInputStream(program.getBytes()); - // try{ - // if (modFile.exists()) { - // modFile.setContents(inStream, true, false, monitor); - // } else { - // modFile.create(inStream, true, monitor); - // } - // modFile.setDerived(true, monitor); - // } finally { - // inStream.close(); - // } - // } catch (Exception e){ - // ProcessingLog.logError("Problem moving " + filename + " to the build folder.", e); - // } - // } else if("pde".equalsIgnoreCase(file.getFileExtension())){ - // // The compiler will need this to have a proper offset - // // not sure why every file gets the same offset, but ok I'll go with it... [lonnen] aug 20 2011 - // file.setSessionProperty(new QualifiedName(BUILDER_ID, "preproc start"), result.headerOffset); - // } - // } - - monitor.worked(10); - if(checkCancel(monitor)) { return null; } + // Almost there! Set a new classpath using all this stuff we've computed. // Even though the list types are specified, Java still tosses errors when I try - // to directly convert them or cast them. So instead I'm stuck doing this. + // to cast them. So instead I'm stuck with explicit iteration. IPath[] libPaths = new IPath[libraryJarPathList.size()]; + int i=0; for(IPath path : libraryJarPathList) libPaths[i++] = path; IPath[] srcPaths = new IPath[srcFolderPathList.size()]; + i=0; for(IPath path : srcFolderPathList) srcPaths[i++] = path; - sketchProject.updateClasspathEntries( srcPaths, libPaths); + try{ + sketchProject.updateClasspathEntries( srcPaths, libPaths); + } catch (JavaModelException e) { + ProcessingLog.logError("There was a problem setting the compiler class path.", e); + return null; // bail ! + } + // everything is cool + sketchProject.wasLastBuildSuccessful = true; return null; } - /** - * Try to delete all of the existing P5 problem markers - *

- * This should only remove the Processing specific markers. - * - * @param project the project to be stripped of problem markers - * @return true if all markers were deleted, false if some remain - * @throws CoreException - */ + /** Delete all of the existing P5 problem markers. */ protected static void deleteP5ProblemMarkers(IResource resource) throws CoreException{ if(resource != null && resource.exists()){ resource.deleteMarkers(SketchBuilder.PREPROCMARKER, true, IResource.DEPTH_INFINITE); @@ -533,26 +435,35 @@ public class SketchBuilder extends IncrementalProjectBuilder{ } } + /** Purge all the Processing set problem markers from the Processing sketch. */ protected static void deleteP5ProblemMarkers(SketchProject sketch)throws CoreException{ if(sketch != null) deleteP5ProblemMarkers(sketch.getProject()); } /** - * Generates a problem marker from the preprocessor output + * Generates and assigns a processing problem marker. *

* Tags the whole line and adds an issue to the Problems box. If the problem could not be tied * to a specific file it will be marked against the project and the line will not be marked. - * - * @param msg error message - * @param file where the problem occurred - * @param line_number what line did the problem occur on - * @param isError is this an error */ - private void reportProblem(String msg, IResource file, int lineNumber, boolean isError){ + private void reportProblem(String message, IResource problemFile, int lineNumber, boolean isError){ + + // translate error messages to a friendlier form + if (message.equals("expecting RCURLY, found 'null'")) + message = "Found one too many { characters without a } to match it."; + if (message.indexOf("expecting RBRACK") != -1) + message = "Syntax error, maybe a missing right ] character?"; + if (message.indexOf("expecting SEMI") != -1) + message = "Syntax error, maybe a missing semicolon?"; + if (message.indexOf("expecting RPAREN") != -1) + message = "Syntax error, maybe a missing right parenthesis?"; + if (message.indexOf("preproc.web_colors") != -1) + message = "A web color (such as #ffcc00) must be six digits."; + try{ - IMarker marker = file.createMarker(SketchBuilder.PREPROCMARKER); - marker.setAttribute(IMarker.MESSAGE, msg); + IMarker marker = problemFile.createMarker(SketchBuilder.PREPROCMARKER); + marker.setAttribute(IMarker.MESSAGE, message); marker.setAttribute(IMarker.SEVERITY, isError ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING); if( lineNumber != -1) marker.setAttribute(IMarker.LINE_NUMBER, lineNumber); @@ -563,15 +474,13 @@ public class SketchBuilder extends IncrementalProjectBuilder{ } /** - * Check for interruptions + * Check for interruptions. *

* The build process is rather long so if the user cancels things toss an exception. * Builds also tie up the workspace, so check to see if something is demanding to * interrupt it and let it. Usually these interruptions would force a rebuild of the * system anyhow, so save some CPU cycles and time. - *

- * - * @param monitor + *

* @return true if the build is hogging the resource thread * @throws OperationCanceledException is the user cancels */ diff --git a/editor/processing.plugin.core/src/processing/plugin/core/builder/SketchProject.java b/editor/processing.plugin.core/src/processing/plugin/core/builder/SketchProject.java index 40f2fd284..9072c6db9 100644 --- a/editor/processing.plugin.core/src/processing/plugin/core/builder/SketchProject.java +++ b/editor/processing.plugin.core/src/processing/plugin/core/builder/SketchProject.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.core.builder; import java.util.ArrayList; @@ -21,28 +31,45 @@ import org.eclipse.core.runtime.QualifiedName; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.launching.IVMInstall; import org.eclipse.jdt.launching.JavaRuntime; import processing.plugin.core.ProcessingCore; import processing.plugin.core.ProcessingLog; +/** + * A nature indicating that the project is a Processing sketch. + *

+ * This handles all the setup and config for the sketch builder + * and the JDT JavaProject that underlies a Processing sketch. + * Attempts to muck about with the sketch settings should do so + * through methods presented in this nature to prevent things + * from turning ugly. Actually, any mucking about will probably + * mess things up. + *

+ * This also holds state information about the sketch itself + * that is generated and collected from the sketch files, the + * builder, a thorough background check, and maybe a little + * dumpster diving. It acs as an ad-hoc model of a sketch project. + */ public class SketchProject implements IProjectNature { /** value: "processing.plugin.core.sketchNature" */ public static final String NATURE_ID = ProcessingCore.PLUGIN_ID + ".sketchNature"; - /** The basic project entry being managed */ - protected IProject project; - // TODO make these a preference public static final int DEFAULT_WIDTH = 100; public static final int DEFAULT_HEIGHT = 100; - // set every build - protected static int sketch_width = -1; - protected static int sketch_height = -1; + /** The basic project entry being managed */ + protected IProject project; + protected int sketch_width = -1; + protected int sketch_height = -1; + + protected boolean wasLastBuildSuccessful = false; + /** * Return the SketchProject associated with the given IProject, or null * if the project is not associated with a SketchProject. @@ -88,19 +115,15 @@ public class SketchProject implements IProjectNature { /** Removes the sketch and java natures from a project */ public static void removeSketchNature(IProject project) throws CoreException{ - if (!project.isOpen()) - return; - - // doesn't have the nature, we're done - if (!SketchProject.isSketchProject(project)) - return; + if (!project.isOpen()) return; + if (!SketchProject.isSketchProject(project)) return; IProjectDescription description = project.getDescription(); List newIds = new ArrayList(); newIds.addAll(Arrays.asList(description.getNatureIds())); newIds.remove(newIds.indexOf(NATURE_ID)); - if (newIds.contains(JavaCore.NATURE_ID)) + if (newIds.contains(JavaCore.NATURE_ID)) newIds.remove(newIds.indexOf(JavaCore.NATURE_ID)); description.setNatureIds(newIds.toArray(new String[newIds.size()])); @@ -127,8 +150,7 @@ public class SketchProject implements IProjectNature { /** Associate the sketch builder with this nature's project */ public void configure() throws CoreException { - if (!project.isOpen()) - return; + if (!project.isOpen()) return; getCodeFolder(); getDataFolder(); @@ -149,14 +171,11 @@ public class SketchProject implements IProjectNature { if (ploc != -1) newCmds.remove(ploc); newCmds.add(0, command); - - for(ICommand c : newCmds){ - System.out.println( c.toString() ); - } // Now that we're sure it's gone, add a single instance to the front of the list description.setBuildSpec( - (ICommand[]) newCmds.toArray(new ICommand[newCmds.size()])); + (ICommand[]) newCmds.toArray(new ICommand[newCmds.size()]) + ); project.setDescription(description,null); updateClasspathEntries(null, null); @@ -167,8 +186,9 @@ public class SketchProject implements IProjectNature { * project and remove the markers it generated. */ public void deconfigure() throws CoreException { - if (!project.isOpen()) - return; + if (!project.isOpen()) return; + + SketchBuilder.deleteP5ProblemMarkers(project); // clean up annotations IProjectDescription description = project.getDescription(); ICommand[] cmds = description.getBuildSpec(); @@ -180,9 +200,6 @@ public class SketchProject implements IProjectNature { description.setBuildSpec(newCmds.toArray(new ICommand[newCmds.size()])); } } - - // clean up your tokens - SketchBuilder.deleteP5ProblemMarkers(project); } /** Returns a qualified name for the property relative to this plug-in */ @@ -299,7 +316,7 @@ public class SketchProject implements IProjectNature { * @param srcFolderPathList A list of absolute paths to source folders * @param libraryJarPathList A list of absolute paths to source folders */ - public void updateClasspathEntries( IPath[] srcFolderPathList, IPath[] libraryJarPathList) { + public void updateClasspathEntries( IPath[] srcFolderPathList, IPath[] libraryJarPathList) throws JavaModelException { IJavaProject jproject = this.getJavaProject(); // Get a default VM to toss in the mix @@ -358,13 +375,9 @@ public class SketchProject implements IProjectNature { // } // } - try { - jproject.setOutputLocation( getJavaBuildFolder().getFullPath(), null); - jproject.setRawClasspath(classpathEntries, null); -// jproject.setRawClasspath(new IClasspathEntry[0], null); - } catch (Exception e) { - ProcessingLog.logError("There was a problem setting the compiler class path.", e); - } + jproject.setOutputLocation( getJavaBuildFolder().getFullPath(), null); + jproject.setRawClasspath(classpathEntries, null); +// jproject.setRawClasspath(new IClasspathEntry[0], null); ignoreWarnings(); } @@ -442,6 +455,11 @@ public class SketchProject implements IProjectNature { JavaCore.setOptions(options); } + /** Getter for classes outside of this package */ + public boolean wasLastBuildSuccessful(){ + return wasLastBuildSuccessful; + } + /** Return the sketch's height, or the default height if size() has not been specified */ public int getHeight() { return (sketch_height == -1) ? DEFAULT_HEIGHT : sketch_height; diff --git a/editor/processing.plugin.core/src/processing/plugin/core/builder/Utilities.java b/editor/processing.plugin.core/src/processing/plugin/core/builder/Utilities.java index bfc6e6815..4aedd8c1b 100644 --- a/editor/processing.plugin.core/src/processing/plugin/core/builder/Utilities.java +++ b/editor/processing.plugin.core/src/processing/plugin/core/builder/Utilities.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.core.builder; import java.io.BufferedReader; @@ -26,12 +36,12 @@ import processing.plugin.core.ProcessingLog; /** * General container for static utility methods related to the build * process that should not be grouped with the ProcessingCore class. - * + *

* Many of these are taken from PApplet or Base or some other class * that invokes UI. They have been placed here and sometimes modified * slightly to avoid invoking any UI components which cause warnings * and other scary messages in Eclipse that might spook users. - * + *

* All the UI stuff hasn't quite been removed yet, but if code is in here * it is not part of the problem, so that's something. */ diff --git a/editor/processing.plugin.core/src/processing/plugin/core/launching/ProcessingSketchLaunchConfigurationDelegate.java b/editor/processing.plugin.core/src/processing/plugin/core/launching/ProcessingSketchLaunchConfigurationDelegate.java index 2881d9451..cba81c705 100644 --- a/editor/processing.plugin.core/src/processing/plugin/core/launching/ProcessingSketchLaunchConfigurationDelegate.java +++ b/editor/processing.plugin.core/src/processing/plugin/core/launching/ProcessingSketchLaunchConfigurationDelegate.java @@ -1,12 +1,13 @@ -/******************************************************************************* +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * * This program and the accompanying materials are made available under the - * terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.opensource.org/licenses/cpl1.0.php + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php * * Contributors: - * IBM Corporation - initial API and implementation - * Chris Lonnen - adaptation for Processing - *******************************************************************************/ + * Chris Lonnen - initial API and implementation + */ package processing.plugin.core.launching; import java.io.File; @@ -28,10 +29,14 @@ import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; import org.eclipse.jdt.launching.JavaLaunchDelegate; import org.eclipse.jdt.launching.JavaRuntime; +import processing.plugin.core.ProcessingLog; + /** - * The launch configuration delegate for Processing Sketches. It is really a customized Java - * launch configuration delegate, as Processing Sketches are compiled down and ultimately run - * as Java applications (shhh! don't tell anyone). + * The default launch configuration delegate for Processing Sketches. + *

+ * Checks to make sure the last build was successful and that the sketch is not being run in debug mode. + * Then it computes some sensible defaults, builds a simple html wrapper and launches the sketch as an + * applet. This is not the same process as an export, and will not populate the applet folder. */ public class ProcessingSketchLaunchConfigurationDelegate extends JavaLaunchDelegate implements IDebugEventSetListener { @@ -63,7 +68,9 @@ public class ProcessingSketchLaunchConfigurationDelegate extends JavaLaunchDeleg */ public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException { if(mode.equals(ILaunchManager.RUN_MODE)){ - return true; + if(configuration.getAttribute("wasLastBuildSuccessful", false)) + return true; + ProcessingLog.logInfo("Aborting launch -- Sketch has unresolved build problems."); } return false; } @@ -78,22 +85,13 @@ public class ProcessingSketchLaunchConfigurationDelegate extends JavaLaunchDeleg fgLaunchToFileMap.remove(launch); temp.delete(); } finally { - // unregister any listeners? there shouldn't be any + // unregister any debug listeners? there shouldn't be any // because we don't support debugging } } } - // URL fileLocation = ProcessingCore.getProcessingCore().getPluginResource(""); - // try { - // File folder = new File(FileLocator.toFileURL(fileLocation).getPath()); - // if (folder.exists()) - // return folder; - // } catch (Exception e) { - // ProcessingLog.logError(e); - // } - public File buildHTMLFile(ILaunchConfiguration configuration, File dir) { FileWriter writer = null; File tempFile = null; @@ -173,17 +171,11 @@ public class ProcessingSketchLaunchConfigurationDelegate extends JavaLaunchDeleg // return arguments.toString(); // } - public String getMainTypeName(ILaunchConfiguration configuration) throws CoreException{ return configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_APPLETVIEWER_CLASS, IJavaLaunchConfigurationConstants.DEFAULT_APPLETVIEWER_CLASS); } - /** - * Returns the applet's main type name. - * - * @param configuration - * @throws CoreException - */ + /** Returns the applet's main type name. */ public String getAppletMainTypeName(ILaunchConfiguration configuration) throws CoreException{ return super.getMainTypeName(configuration); } diff --git a/editor/processing.plugin.ui/plugin.xml b/editor/processing.plugin.ui/plugin.xml index 13efb4e57..3881011fd 100644 --- a/editor/processing.plugin.ui/plugin.xml +++ b/editor/processing.plugin.ui/plugin.xml @@ -78,6 +78,18 @@ + + + + Write Processing sketches. + + + diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/ProcessingLog.java b/editor/processing.plugin.ui/src/processing/plugin/ui/ProcessingLog.java index eb1a8078c..5d3e22f93 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/ProcessingLog.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/ProcessingLog.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui; import org.eclipse.core.runtime.IStatus; @@ -10,6 +20,7 @@ import org.eclipse.core.runtime.Status; * @author lonnen */ public class ProcessingLog { + //TODO merge with ProcessingPlugin. Having multiple ProcessingLog files is friggin' confusing. // Who needs a constructor? diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/ProcessingPlugin.java b/editor/processing.plugin.ui/src/processing/plugin/ui/ProcessingPlugin.java index 792d90ed8..d8359136f 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/ProcessingPlugin.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/ProcessingPlugin.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui; import org.eclipse.jface.text.rules.RuleBasedScanner; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/launching/RunSketchAsAppletShortcut.java b/editor/processing.plugin.ui/src/processing/plugin/ui/launching/RunSketchAsAppletShortcut.java index 164d39fce..38fc9a2fd 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/launching/RunSketchAsAppletShortcut.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/launching/RunSketchAsAppletShortcut.java @@ -1,12 +1,13 @@ -/******************************************************************************* +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * * This program and the accompanying materials are made available under the - * terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.opensource.org/licenses/cpl1.0.php + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php * * Contributors: - * IBM Corporation - initial API - * Chris Lonnen - implementation for Processing - *******************************************************************************/ + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.launching; import org.eclipse.core.resources.IFile; @@ -43,6 +44,7 @@ public class RunSketchAsAppletShortcut implements ILaunchShortcut { wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_WIDTH, sketch.getWidth()); wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_HEIGHT, sketch.getHeight()); wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_NAME, "Processing Sketch"); + wc.setAttribute("wasLastBuildSuccessful", sketch.wasLastBuildSuccessful()); wc.setMappedResources(new IResource[] { sketch.getJavaProject().getUnderlyingResource() }); // config =wc.doSave(); config = wc; // this prevents a run config from being saved and sticking around. diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/preferences/CorePreferencePage.java b/editor/processing.plugin.ui/src/processing/plugin/ui/preferences/CorePreferencePage.java index 0d58c29f7..a9d12d75e 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/preferences/CorePreferencePage.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/preferences/CorePreferencePage.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.preferences; import org.eclipse.core.resources.ResourcesPlugin; @@ -74,7 +84,7 @@ public class CorePreferencePage extends PreferencePage implements IWorkbenchPref } public void initContents(){ - String sketchbook = ProcessingCorePreferences.current().getSketchbookPathString(); + String sketchbook = ProcessingCorePreferences.current().getSketchbookPathAsString(); if(sketchbook != null){ System.out.println("INIT: " + sketchbook + ";"); sketchbookPathField.setText(sketchbook.toString()); @@ -136,7 +146,7 @@ public class CorePreferencePage extends PreferencePage implements IWorkbenchPref setValid(true); setMessage(null); setErrorMessage(null); - ProcessingCorePreferences.current().setSketchbookPath(sketchbookPathField.getText()); + ProcessingCorePreferences.current().setSketchbookPathWithString(sketchbookPathField.getText()); } /** diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/preferences/PreferenceConstants.java b/editor/processing.plugin.ui/src/processing/plugin/ui/preferences/PreferenceConstants.java index 6e0f7ea66..da3bf7498 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/preferences/PreferenceConstants.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/preferences/PreferenceConstants.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.preferences; /** diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/preferences/PreferenceInitializer.java b/editor/processing.plugin.ui/src/processing/plugin/ui/preferences/PreferenceInitializer.java index 9f907eee0..2cb7a65e6 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/preferences/PreferenceInitializer.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/preferences/PreferenceInitializer.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.preferences; import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingAnnotationHover.java b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingAnnotationHover.java index 03eb6e7a4..c157a882c 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingAnnotationHover.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingAnnotationHover.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.processingeditor; //import org.eclipse.jface.text.BadLocationException; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingDocumentSetupParticipant.java b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingDocumentSetupParticipant.java index 27ae974f0..ef76e365a 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingDocumentSetupParticipant.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingDocumentSetupParticipant.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.processingeditor; import org.eclipse.core.filebuffers.IDocumentSetupParticipant; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingEditor.java b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingEditor.java index d46c64938..3a03b299d 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingEditor.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingEditor.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.processingeditor; import org.eclipse.jface.text.ITextViewerExtension5; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingPartitionScanner.java b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingPartitionScanner.java index 765290938..5856b46c3 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingPartitionScanner.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingPartitionScanner.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.processingeditor; import java.util.ArrayList; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingSourceViewerConfiguration.java b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingSourceViewerConfiguration.java index 71c45cfe9..6860496b0 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingSourceViewerConfiguration.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/ProcessingSourceViewerConfiguration.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.processingeditor; import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingAutoIndentStrategy.java b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingAutoIndentStrategy.java index eb2ebc562..1e23e7b73 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingAutoIndentStrategy.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingAutoIndentStrategy.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.processingeditor.language; import org.eclipse.jface.text.BadLocationException; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingCodeScanner.java b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingCodeScanner.java index ee7840349..bfc6fd3ee 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingCodeScanner.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingCodeScanner.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.processingeditor.language; import java.io.BufferedInputStream; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingCompletionProcessor.java b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingCompletionProcessor.java index 0c0c79408..f8c3f3d97 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingCompletionProcessor.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingCompletionProcessor.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.processingeditor.language; import java.text.MessageFormat; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingDoubleClickSelector.java b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingDoubleClickSelector.java index c2fd7ec8f..960f63462 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingDoubleClickSelector.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/language/ProcessingDoubleClickSelector.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.processingeditor.language; import org.eclipse.jface.text.BadLocationException; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/util/ProcessingColorProvider.java b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/util/ProcessingColorProvider.java index 962ffe08b..b2580d8d9 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/util/ProcessingColorProvider.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/util/ProcessingColorProvider.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.processingeditor.util; import java.util.HashMap; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/util/ProcessingWhitespaceDetector.java b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/util/ProcessingWhitespaceDetector.java index 16ddc66ed..635fc3483 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/util/ProcessingWhitespaceDetector.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/util/ProcessingWhitespaceDetector.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.processingeditor.util; import org.eclipse.jface.text.rules.IWhitespaceDetector; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/util/ProcessingWordDetector.java b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/util/ProcessingWordDetector.java index 49ac7cdd9..1859e80e1 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/util/ProcessingWordDetector.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/processingeditor/util/ProcessingWordDetector.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.processingeditor.util; import org.eclipse.jface.text.rules.IWordDetector; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/wizards/NewSketchWizard.java b/editor/processing.plugin.ui/src/processing/plugin/ui/wizards/NewSketchWizard.java index a9bc61052..3fefaf16f 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/wizards/NewSketchWizard.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/wizards/NewSketchWizard.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.wizards; import java.io.ByteArrayInputStream; diff --git a/editor/processing.plugin.ui/src/processing/plugin/ui/wizards/NewSketchWizardPage.java b/editor/processing.plugin.ui/src/processing/plugin/ui/wizards/NewSketchWizardPage.java index 0d89208b2..2e9dfba41 100644 --- a/editor/processing.plugin.ui/src/processing/plugin/ui/wizards/NewSketchWizardPage.java +++ b/editor/processing.plugin.ui/src/processing/plugin/ui/wizards/NewSketchWizardPage.java @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2010 Chris Lonnen. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.opensource.org/licenses/eclipse-1.0.php + * + * Contributors: + * Chris Lonnen - initial API and implementation + */ package processing.plugin.ui.wizards; import java.io.File;