Recent Changes - Search:

edit SideBar

JSEclipse

Eclipse includes a JavaScript facility.

Version of Eclipse

As of February 2016, I was able to install the JavaScript Development Tools, which allowed me to view .js files

However, the Problems window showed errors with the org/terraswarm/accessor/accessors/web/vendors directory that I was not able to exclude.

To install the JavaScript Development Tools:

  1. Click on Help -> Install New Software
  2. In the the Install Window
    1. Find the "Work With" entry and chose Mars - http://download.eclipse.org/releases/mars
    2. Search for JavaScript and select JavaScript Development Tools
    3. Click through the dialogs.

Ptolemy II

To set up Ptolemy II, see http://chess.eecs.berkeley.edu/ptexternal/nightly/doc/eclipse/index.htm

Note that if you are using TerraSwarm Accessors, you will need read access to the TerraSwarm accessor svn repo (available only to members of TerraSwarm universities and companies). In addition, you probably want to run cd $PTII; ./configure to set up the Eclipse .classpath file.

In Eclipse, use Window -> Open Perspective -> JavaScript to edit JavaScript files.

Excluding JavaScript Directories

Eclipse will warn about JavaScript problems in JavaScript files that are provided by third party libraries.

It turns out that JavaScript has a separate build path!

See http://stackoverflow.com/questions/4867885/how-to-exclude-a-javascript-file-from-javascript-validation-in-eclipse

  1. In the Project Explorer, right click on the project, select Properties
  2. In the properties window, select JavaScript->Editor->Include Path
  3. Select the Source path
  4. Select Exclude and add directories
**/apps/
**/codeDoc/
**/jsdoc/
**/vendors/
adm/
ptolemy/vergil/basic/export/html/javascript
RobotChase/

Unfortunately, these are saved in $PTII/.settings/.jsdtscope instead of .classpath

.jsdtscope looks like:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
        <classpathentry excluding="**/apps/|**/codeDoc/|**/jsdoc/|**/vendors/|RobotChase/|adm/|pt\
olemy/vergil/basic/export/html/javascript/"
kind="src" path=""/>
        <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="output" path=""/>
</classpath>

Eclipse Cleanup for JavaScript

The JavaScript Editor has a clean up facility.

To set up cleanup for the workspace under Mac OS X:

  1. Eclipse -> Preferences
  2. JavaScript -> CodeStyle -> Clean Up
  3. Click on "New", then enter the name of the cleanup style, such as ptII, Click OK.
  4. The Profile editor for the new Clean Up style will appear
    1. Under Code Style: Control Statements:
      1. Check "Use blocks in if/while/for/do statements
    2. Under Code Organizing: Formatter:
      1. Check "Format source code"
      2. Check "Remove trailing whitespace"
    3. Click OK all the way out.

Eclipse Formatter for JavaScript

The JavaScript Editor has a formatter facility

To set up the formatter for the workspace under Mac OS X:

  1. Eclipse -> Preferences
  2. Click on "New",
    1. Enter the name of the cleanup style, such as @@ptII""
    2. Under Initialize settings with the following profile, click on "JavaScript Conventions [built-in]"
    3. Click on OK
  3. In the profile editor for the formatter style
    1. Under Indentation
      1. Tab Policy: Change to Spaces Only
    2. Under New Lines
      1. Insert new line: Check at end of file
    3. Click OK all the way out.
Edit - History - Print - Recent Changes - Search
Page last modified on February 03, 2016, at 01:53 am