Eclipse Plug In

From Processing

Jump to: navigation, search

The Processing Plug-in for Eclipse aspires to provide native support for the language in the popular, cross-platform Eclipse IDE. At the moment lacks some of the features you're used to having in the Processing Development Environment (PDE), but the two play nicely together. Sketches made with one can be worked on with the other. If you're feeling adventurous, please give the plug-in a whirl and provide us feedback. Bugs reports are encouraged, and can be submitted here.

Contents

Installation

First you will need to download and install Eclipse, which can be done here. This page can be pretty intimidating, since there are many flavors of the IDE. The Processing plug-in requires the Eclipse Java development tools (JDT) to function, which should be included with most versions of the Eclipse IDE. If in doubt, you can check the details link of any particular flavor and verify that 'org.eclipse.jdt' is in the Feature List.

If you already have Eclipse installed, make sure the JDT is installed and that you're running at least Platform version 3.5.2 (Galileo) or newer. This can be verified from the 'About Eclipse' screen by selecting 'Installation Details' and checking under the 'Features' tab. You can find and install the JDT with the internal plug-in installer.

Once you have Eclipse installed and running you should select 'Help' -> 'Install New Software...' from the menu bar. Click the 'Add...' button in the upper-right hand corner of the dialog box. Fill in the fields as follows:

Name: Processing Plug-in
Location: http://eclipse.processing.org/plugin/site.xml https://raw.github.com/processing/processing-eclipse/master/processing.plugin.updateSite/site.xml

and click 'OK'. Eclipse will present you with a check box labelled "Processing Plug-in for Eclipse" with an expandable tree next to it containing a single plug-in of the same name. Select it and choose "Next" at the bottom of the screen.

The new screen will let you review installation details. Choose "Next" again and you will be provided with a License statement. The plug-in code itself is released under the EPL, while the included Processing code and resources retain their original licenses. If you accept the terms, select the appropriate radio button and click "Finish" to begin installing.

A security warning will pop up informing you that the plug-in is unsigned and cannot be verified. Selecting "Ok" will let the installation progress and if everything goes smoothly you'll be prompted to restart Eclipse.

You can keep the plug-in up-to-date using Eclipse's internal 'Help' -> 'Check for Updates' system.

Setup the Environment

The first thing you'll want to do, once Eclipse has restarted, is open up the 'Preferences' menu and select Processing on the left. You'll be asked to specify a Sketchbook Folder, which is where you sketches will be stored and where the platform will look for user contributed libraries. Browse to the directory you want, preferably the same one you use in the Processing Development Environment, and choose 'OK' to save the preference.

From the menubar, select 'Window' -> 'Open Perspective' -> 'Other' and choose 'Processing' to open a customized set of windows for Processing development. On the left is a "Sketch Navigator" that shows only Processing sketch projects that Eclipse knows about. This should be empty right now. The main window is a standard editor, and at the bottom is a "Problems" window and a "Console" window which will be useful later. The toolbar will contain whatever a default toolbar contains for your installation, the Processing plug-in does not contribute to it at this time. To see non-sketch projects or use Eclipse for other languages you can change the perspective again with the Window menu.

Your First Sketch (in Eclipse)

You can create a new Sketch by selecting 'File' -> 'New' -> 'Processing Sketch' in the Processing perspective. If you don't see it, select 'other' and look for it in the Processing folder. A wizard will open prompting you for a sketch name and sketch book folder. If you provided a sketch book location in the preferences it will be the default location for the sketch. The wizard will check to make sure you're not going to overwrite anything existing in the file system before allowing you to proceed. Select finish to create the sketch.

If, instead, you've got an existing sketch you would like to work on, you can use 'File' -> 'Import' to select the 'Import Sketch Wizard' and indicate the sketch folder you would like to import. Your sketch book is provided as the default to make importing existing sketch projects easier, but you will still have to navigate to the root folder of the sketch you would like to import. The 'Finish' button will enable when you've selected a proper folder. Importing a sketch just makes Eclipse aware of it, it does not move the files around in the underlying file system.

A basic sketch contains a single file, along with empty 'code' and 'data' folders. Adding new sketch files can be done with the 'New' -> 'File' wizard by appending the extension .pde to the file name you indicate. Other resources can be added by dragging and dropping the file from your file system into the appropriate place in the 'Sketch Navigator'.

Editing and Error Checking

Double click on <sketch name>.pde and start hacking away. The editor supports PDE-like syntax highlighting and some smart highlighting and indentation. It will also try to do some error checking as you type. This is the same error detection that occurs in the PDE when you run a sketch, but it is happening very frequently as you work. Errors will appear in the 'Problems' window, indicating what file they occur in and what line. They are also indicated as red markers on the scroll bar and to the left of the line they are reported against. Some errors are not resolved to a line, and are instead indicated against a document only.

Just like the PDE, you can write sketches in basic, continuous, or Java mode, though the default file sets up a skeletal, continuous mode sketch.

Running

To run a sketch you can right click on the project or the *.pde file, in the 'Sketch Navigator' or open in the editor, and choose 'Run As' -> "Processing Sketch (Applet)". If there are outstanding problems against the sketch, the runner will fail and you'll get a message in the 'Console' pane reporting a ClassNotFoundException. Fix the outstanding error and try again.

Exporting

While the UI for an export wizard is in place, it doesn't fully function. A partial export will take place, and log a bunch of messages to the console but nothing functional will have happened. For now, you'll have to use the PDE as an external editor. See Using an External Editor for more details.

Personal tools