44 | A tool by ##author.name## for the Processing programming environment.
45 | Last update, ##date##.
46 |
47 |
48 | ##tool.sentence##
49 | ##tool.paragraph##
50 | Feel free to replace this paragraph with a description of the tool.
51 | Contributed libraries are developed, documented, and maintained by members of the Processing community. Further directions are included with each tool. For feedback and support, please post to the Discourse. We strongly encourage all libraries to be open source, but not all of them are.
52 |
53 |
54 |
55 |
56 |
57 |
58 |
Download
59 |
60 | Download ##tool.name## version ##tool.prettyVersion## (##tool.version##) in
61 | .zip format.
62 |
63 |
Installation
64 |
65 | Unzip and put the extracted ##project.name## folder into the tools folder of your Processing sketches. Reference and examples are included in the ##project.name## folder.
66 |
67 |
68 |
69 |
70 |
71 |
Keywords. ##tool.keywords##
72 |
Reference. Have a look at the javadoc reference here. A copy of the reference is included in the .zip as well.
73 |
Source. The source code of ##tool.name## is available at ##source.host##, and its repository can be browsed here.
74 |
75 |
76 |
77 |
78 |
Examples
79 |
Find a list of examples in the current distribution of ##tool.name##, or have a look at them by following the links below.
136 |
137 |
--------------------------------------------------------------------------------
/resources/build.properties:
--------------------------------------------------------------------------------
1 | # Create a Tool for the Processing open source programming language and
2 | # environment (http://www.processing.org)
3 | #
4 | # Customize the build properties to make the ant-build-process work for your
5 | # environment. How? Please read the comments below.
6 | #
7 | # The default properties are set for OS X. Please refer to comments for Windows
8 | # settings.
9 |
10 |
11 | # Where is your Processing sketchbook located?
12 | # If you are not sure, check the sketchbook location in your Processing
13 | # application preferences.
14 | # ${user.home} points the compiler to your home directory.
15 | # For windows the default path to your sketchbook would be
16 | # ${user.home}/My Documents/Processing (make adjustments below).
17 |
18 | #sketchbook.location=${user.home}/My Documents/Processing
19 | sketchbook.location=${user.home}/Documents/Processing
20 |
21 |
22 | # Where are the jar files located that are required for compiling your Tool such
23 | # as e.g. core.jar?
24 | # By default the local classpath location points to folder libs inside Eclipse's
25 | # workspace (by default found in your home directory).
26 | # For Windows, the default path would be
27 | # ${user.home}/Documents/workspace/libs (make adjustments below)
28 | # For OS X,the following path will direct you into Processing's application
29 | # package, in case you put Processing inside your Applications folder.
30 |
31 | #classpath.local.location=${user.home}/Documents/workspace/libs
32 | classpath.local.location=/Applications/Processing.app/Contents/Java
33 |
34 |
35 | # Add all jar files that are required for compiling your project to the local
36 | # and project classpath. Use a comma as delimiter. These jar files must be
37 | # inside your classpath.local.location folder.
38 | # For creating a Tool, both pde.jar and core.jar are required.
39 |
40 | classpath.local.include=core.jar,pde.jar
41 |
42 |
43 | # Add Processing's libraries folder to the classpath.
44 | # If you don't need to include the libraries folder to your classpath, comment
45 | # out the following line.
46 |
47 | classpath.libraries.location=${sketchbook.location}/libraries
48 |
49 |
50 | # Set the java version that should be used to compile your Tool.
51 |
52 | java.target.version=1.7
53 |
54 |
55 | # Set the description of the Ant build.xml file.
56 |
57 | ant.description=Processing Tool Ant build file.
58 |
59 |
60 | # Give your Tool a name. The name must not contain spaces or special characters.
61 | # When creating a tool, the name of the main class which implements Tool must be
62 | # the same as the value defined for project.name in your build.properties.
63 |
64 | project.name=HelloTool
65 |
66 |
67 | # The name as the user will see it. This can contain spaces and special
68 | # characters.
69 |
70 | project.prettyName=Hello Tool
71 |
72 |
73 | # Use 'normal' or 'fast' as value for project.compile.
74 | # 'fast' will only compile the project into your sketchbook.
75 | # 'normal' will compile the distribution including the javadoc-reference and all
76 | # web-files (the compile process here takes longer).
77 | # All files compiled with project.compile=normal are stored
78 | # in the distribution folder.
79 |
80 | project.compile=normal
81 |
82 |
83 | # Set your name and URL, used for the web page and properties file.
84 |
85 | author.name=Your Name
86 | author.url=http://yoururl.com
87 |
88 |
89 | # Set the web page for your Tool.
90 | # This is NOT a direct link to where to download it.
91 |
92 | tool.url=http://yourtoolname.com
93 |
94 |
95 | # Set the category (or categories) of your Tool from the following list:
96 | # "3D" "Animation" "Compilations" "Data"
97 | # "Fabrication" "Geometry" "GUI" "Hardware"
98 | # "I/O" "Language" "Math" "Simulation"
99 | # "Sound" "Utilities" "Typography" "Video & Vision"
100 | #
101 | # If a value other than those listed is used, your library will listed as
102 | # "Other". Many categories must be comma-separated.
103 |
104 | tool.categories=Other
105 |
106 |
107 | # A short sentence (or fragment) to summarize the Tool's function. This will be
108 | # shown from inside the PDE when the Tool is being installed. Avoid repeating
109 | # the name of your Tool here. Also, avoid saying anything redundant like
110 | # mentioning that it's a Tool. This should start with a capitalized letter, and
111 | # end with a period.
112 |
113 | tool.sentence=A collection of utilities for solving this and that problem.
114 |
115 |
116 | # Additional information suitable for the Processing website. The value of
117 | # 'sentence' always will be prepended, so you should start by writing the
118 | # second sentence here. If your Tool only works on certain operating systems,
119 | # mention it here.
120 |
121 | tool.paragraph=
122 |
123 |
124 | # Set the source code repository for your project.
125 | # We recommend Bitbucket (https://bitbucket.org) or GitHub (https://github.com).
126 |
127 | source.host=GitHub
128 | source.url=https://github.com/YourName/YourProject
129 | source.repository=https://github.com/YourName/YourProject.git
130 |
131 |
132 | # The current version of your Tool.
133 | # This number must be parsable as an int. It increments once with each release.
134 | # This is used to compare different versions of the same Tool, and check if an
135 | # update is available.
136 |
137 | tool.version=1
138 |
139 |
140 | # The version as the user will see it.
141 |
142 | tool.prettyVersion=1.0.0
143 |
144 |
145 | # The min and max revision of Processing compatible with your Tool.
146 | # Note that these fields use the revision and not the version of Processing,
147 | # parsable as an int. For example, the revision number for 2.2.1 is 227.
148 | # You can find the revision numbers in the change log: https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt
149 | # Only use maxRevision (or minRevision), when your Tool is known to break in a
150 | # later (or earlier) release. Otherwise, use the default value 0.
151 |
152 | compatible.minRevision=0
153 | compatible.maxRevision=0
154 |
155 |
156 | # The platforms and Processing version that the Tool has been tested
157 | # against. This information is only used in the generated webpage.
158 |
159 | tested.platform=osx,windows
160 | tested.processingVersion=3.0
161 |
162 |
163 | # Additional information for the generated webpage.
164 |
165 | tool.copyright=(c) 2015
166 | tool.dependencies=?
167 | tool.keywords=?
168 |
169 |
170 | # Include javadoc references into your project's javadocs.
171 |
172 | javadoc.java.href=http://docs.oracle.com/javase/7/docs/api/
173 | javadoc.processing.href=http://processing.org/reference/javadoc/everything/
174 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | The following describes how to set up a Processing tool project in Eclipse and build it successfully, and to make your tool ready for distribution.
2 |
3 | ## Import to Eclipse
4 |
5 | There are two options to import the template project into Eclipse: using a Git [fork](https://help.github.com/articles/fork-a-repo) or using a downloaded package. If you are not familiar with Git or GitHub, you should opt for the downloaded package.
6 |
7 | ### Option A: GitHub
8 |
9 | 1. Fork the template repository to use as a starting point.
10 | * Navigate to https://github.com/processing/processing-tool-template in your browser.
11 | * Click the "Fork" button in the top-right of the page.
12 | * Once your fork is ready, open the new repository's "Settings" by clicking the link in the menu bar on the right.
13 | * Change the repository name to the name of your tool and save your changes.
14 | * NOTE: GitHub only allows you to fork a project once. If you need to create multiple forks, you can follow these [instructions](http://adrianshort.org/2011/11/08/create-multiple-forks-of-a-github-repo/).
15 | 1. Clone your new repository to your Eclipse workspace.
16 | * Open Eclipse and select the File → Import... menu item.
17 | * Select Git → Projects from Git, and click "Next >".
18 | * Select "URI" and click "Next >".
19 | * Enter your repository's clone URL in the "URI" field. The remaining fields in the "Location" and "Connection" groups will get automatically filled in.
20 | * Enter your GitHub credentials in the "Authentication" group, and click "Next >".
21 | * Select the `master` branch on the next screen, and click "Next >".
22 | * The default settings on the "Local Configuration" screen should work fine, click "Next >".
23 | * Make sure "Import existing projects" is selected, and click "Next >".
24 | * Eclipse should find and select the `processing-tool-template` automatically, click "Finish".
25 | 1. Rename your Eclipse project.
26 | * In the Package Explorer, right-click (ctrl-click) on the folder icon of the `processing-tool-template` project, and select Refactor → Rename... from the menu that pops up.
27 | * Give the project the name of your tool, and click "OK".
28 |
29 | ### Option B: Downloaded Package
30 |
31 | 1. Download the latest Eclipse template from [here](https://github.com/processing/processing-tool-template/releases). **Don't unzip the ZIP file yet.**
32 | 1. Create a new Java project in Eclipse.
33 | * From the menubar choose File → New → Java Project.
34 | * Give the project the name of your tool.
35 | * Click "Finish".
36 | 1. Import the template source files.
37 | * Right-click (ctrl-click) onto the folder icon of your newly created project in the Package Explorer and select "Import..."`" from the menu that pops up.
38 | * Select General → Archive File, and click "Next >".
39 | * Navigate to the ZIP file you downloaded earlier in step 1, and click "Finish".
40 |
41 | ## Set Up and Compile
42 |
43 | 1. Add Processing to the project build path.
44 | * Open your project's "Properties" window.
45 | * Under "Java Build Path", select the "Libraries" tab and then "Add External JARs...".
46 | * Locate and add Processing's `pde.jar` to your build path. If you're planning on using features of Processing's `PApplet` class, you'll need to add `core.jar` to the project's build path as well. It is recommended to make copies of `core.jar` and `pde.jar` in your Eclipse workspace in a `libs` folder. If this folder does not exist yet, create it. Read the [section below](#AddingJARs) regarding where to find the `core.jar` and `pde.jar` files.
47 | * Confirm the setup with "OK".
48 | 1. Edit the tool properties.
49 | * Open the `resources` folder inside of your Java project and double-click the `build.properties` file. You should see its contents in the Eclipse editor.
50 | * Edit the properties file, making changes to items 1-4 so that the values and paths are properly set for your project to compile. A path can be relative or absolute.
51 | * Make changes to items under 5. These are metadata used in the automatically generated HTML, README, and properties documents.
52 | 1. Compile your tool using Ant.
53 | * From the menu bar, choose Window → Show View → Ant. A tab with the title "Ant" will pop up on the right side of your Eclipse editor.
54 | * Drag the `resources/build.xml` file in there, and a new item "ProcessingTools" will appear.
55 | * Press the "Play" button inside the "Ant" tab.
56 | 1. BUILD SUCCESSFUL. The tool template will start to compile, control messages will appear in the console window, warnings can be ignored. When finished it should say BUILD SUCCESSFUL. Congratulations, you are set and you can start writing your own tool by making changes to the source code in folder `src`.
57 | 1. BUILD FAILED. In case the compile process fails, check the output in the console which will give you a closer idea of what went wrong. Errors may have been caused by
58 | * Incorrect path settings in the `build.properties` file. Things are most likely to go wrong at item 2, where you specify the path to `pde.jar` and other included JARs.
59 | * Error "Javadoc failed". If you are on Windows, make sure you are using a JDK instead of a JRE in order to be able to create the Javadoc for your tool. JRE does not come with the Javadoc application, but it is required to create tools from this template.
60 |
61 | After having compiled and built your project successfully, you should be able to find your tool in Processing's sketchbook folder, examples will be listed in Processing's sketchbook menu. Files that have been created for the distribution of the tool are located in your Eclipse's `workspace/yourProject/distribution` folder. In there you will also find the `web` folder which contains the documentation, a ZIP file for downloading your tool, a folder with examples as well as the `index.html` and CSS file.
62 |
63 | To distribute your tool please refer to the [Tool Guidelines](https://github.com/processing/processing/wiki/Tool-Guidelines).
64 |
65 | ## Source code
66 |
67 | If you want to share your tool's source code (and we know you do), we recommend using an online repository available for free at [GitHub](http://github.com).
68 |
69 | ## Adding pde.jar and other .jar files to your classpath
70 |
71 | The `pde.jar` file contains classes responsible for creating the Processing Development Environment itself. It must be part of your classpath when building a tool. The `core.jar` file does not necessarily need to be added to your classpath, however, you will need to include it if you plan on creating any external tool windows based on `PApplet`. On Windows and Linux, these files are located in the Processing distribution folder inside a folder named "lib". On Mac OS X, right-click `Processing.app` and use `Show Package Contents` to see the guts. The `lib` folder is at `Contents` → `Resources` → `Java` → `lib`. For further information about the classes in `pde.jar`, you can see the source [here](http://code.google.com/p/processing/source/browse/trunk/processing#processing/app) and the developer documentation [here](http://processing.googlecode.com/svn/trunk/processing/build/javadoc/everything/index.html).
72 |
73 | If you created a `libs` folder as described above, put the libraries you need to add to your classpath in there. In the `Properties` of your Java project, navigate to `Java Build Path` → `Libraries`, and click `Add External JARs`. Select the `.jar` files from the `libs` folder that are required for compiling you project. Adjust the `build.properties` file accordingly.
74 |
75 | The `libs` folder is recommended but not a requirement, nevertheless you need to specify where your `jar` files are located in your system in order to add them to the classpath.
76 |
77 | In case a tool depends on systems libraries, put these dependencies next to the `jar` file. For example processing's `opengl.jar` library depends on JOGL hence the DLLs (for Windows) or jnilibs (for OS X) have to be located next to the `opengl.jar` file.
78 |
79 | ## The JDK, the JRE, Ant, & javadoc
80 |
81 | For more information about these, see the relevant sections in the [Eclipse Library Template](https://github.com/processing/processing-library-template) README.
82 |
--------------------------------------------------------------------------------
/resources/code/ExampleTaglet.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or
5 | * without modification, are permitted provided that the following
6 | * conditions are met:
7 | *
8 | * -Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | *
11 | * -Redistribution in binary form must reproduce the above copyright
12 | * notice, this list of conditions and the following disclaimer in
13 | * the documentation and/or other materials provided with the
14 | * distribution.
15 | *
16 | * Neither the name of Sun Microsystems, Inc. or the names of
17 | * contributors may be used to endorse or promote products derived
18 | * from this software without specific prior written permission.
19 | *
20 | * This software is provided "AS IS," without a warranty of any
21 | * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
22 | * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
23 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
24 | * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY
25 | * DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT OF OR
26 | * RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR
27 | * ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE
28 | * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT,
29 | * SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
30 | * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF
31 | * THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN
32 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
33 | *
34 | * You acknowledge that Software is not designed, licensed or
35 | * intended for use in the design, construction, operation or
36 | * maintenance of any nuclear facility.
37 | */
38 |
39 | import com.sun.tools.doclets.Taglet;
40 | import com.sun.javadoc.*;
41 | import java.util.Map;
42 | import java.io.*;
43 | /**
44 | * A sample Taglet representing @example. This tag can be used in any kind of
45 | * {@link com.sun.javadoc.Doc}. It is not an inline tag. The text is displayed
46 | * in yellow to remind the developer to perform a task. For
47 | * example, "@example Hello" would be shown as:
48 | *
49 | *
50 | * To Do:
51 | *
Fix this!
52 | *
53 | *
54 | *
55 | * @author Jamie Ho
56 | * @since 1.4
57 | */
58 |
59 | public class ExampleTaglet implements Taglet {
60 |
61 | private static final String NAME = "example";
62 | private static final String HEADER = "example To Do:";
63 |
64 | /**
65 | * Return the name of this custom tag.
66 | */
67 | public String getName() {
68 | return NAME;
69 | }
70 |
71 | /**
72 | * Will return true since @example
73 | * can be used in field documentation.
74 | * @return true since @example
75 | * can be used in field documentation and false
76 | * otherwise.
77 | */
78 | public boolean inField() {
79 | return true;
80 | }
81 |
82 | /**
83 | * Will return true since @example
84 | * can be used in constructor documentation.
85 | * @return true since @example
86 | * can be used in constructor documentation and false
87 | * otherwise.
88 | */
89 | public boolean inConstructor() {
90 | return true;
91 | }
92 |
93 | /**
94 | * Will return true since @example
95 | * can be used in method documentation.
96 | * @return true since @example
97 | * can be used in method documentation and false
98 | * otherwise.
99 | */
100 | public boolean inMethod() {
101 | return true;
102 | }
103 |
104 | /**
105 | * Will return true since @example
106 | * can be used in method documentation.
107 | * @return true since @example
108 | * can be used in overview documentation and false
109 | * otherwise.
110 | */
111 | public boolean inOverview() {
112 | return true;
113 | }
114 |
115 | /**
116 | * Will return true since @example
117 | * can be used in package documentation.
118 | * @return true since @example
119 | * can be used in package documentation and false
120 | * otherwise.
121 | */
122 | public boolean inPackage() {
123 | return true;
124 | }
125 |
126 | /**
127 | * Will return true since @example
128 | * can be used in type documentation (classes or interfaces).
129 | * @return true since @example
130 | * can be used in type documentation and false
131 | * otherwise.
132 | */
133 | public boolean inType() {
134 | return true;
135 | }
136 |
137 | /**
138 | * Will return false since @example
139 | * is not an inline tag.
140 | * @return false since @example
141 | * is not an inline tag.
142 | */
143 |
144 | public boolean isInlineTag() {
145 | return false;
146 | }
147 |
148 | /**
149 | * Register this Taglet.
150 | * @param tagletMap the map to register this tag to.
151 | */
152 | public static void register(Map tagletMap) {
153 | ExampleTaglet tag = new ExampleTaglet();
154 | Taglet t = (Taglet) tagletMap.get(tag.getName());
155 | if (t != null) {
156 | tagletMap.remove(tag.getName());
157 | }
158 | tagletMap.put(tag.getName(), tag);
159 | }
160 |
161 | /**
162 | * Given the Tag representation of this custom
163 | * tag, return its string representation.
164 | * @param tag the Tag representation of this custom tag.
165 | */
166 | public String toString(Tag tag) {
167 | return createHTML(readFile(tag.text()));
168 | }
169 |
170 |
171 | /**
172 | * Given an array of Tags representing this custom
173 | * tag, return its string representation.
174 | * @param tags the array of Tags representing of this custom tag.
175 | */
176 | public String toString(Tag[] tags) {
177 | if (tags.length == 0) {
178 | return null;
179 | }
180 | return createHTML(readFile(tags[0].text()));
181 | }
182 |
183 |
184 |
185 | String createHTML(String theString) {
186 | if(theString!=null) {
187 | String dd = "";
193 |
194 | return dd+"\n