Setting up Ptolemy II and Eclipse

Please see http://chess.eecs.berkeley.edu/ptexternal/nightly/doc/eclipse/index.htm for updated Eclipse instructions.

The instructions below include how to set up Subversion so that it is possible to update the Ptolemy II tree. If you would like to work from a static source tree, such as what is shipped with the release, see the Simple Eclipse Instructions.

These instructions assume you are using Eclipse Helios under Windows or Mac OS X. Other ways of setting up and building Ptolemy II are described on the Ptolemy II install page.

Contents of this page:

  • Install Eclipse
  • Eclipse Preferences for Ptolemy II
  • Set up Eclipse for Ptolemy II
  • Simple Debugging Session
  • Optional Extensions
  • Troubleshooting
  • Other local pages:
  • Profiling using TPTP
  • Install Eclipse

    1. Download the latest version of Eclipse from http://www.eclipse.org.
      In October, 2010, we chose Eclipse for RCP and RAP Developers, which is 190Mb. The Eclipse for RCP and RAP Developers version includes the plug-in development environment (PDE), which is needed by the backtrack facility, which is an optional part of Ptolemy II that allows models to restore their old state. If the version of Eclipse that you install does not have the PDE, then there will be build errors, which can be fixed by excluding ptolemy/backtrack/ from the build.

      Eclipse is available as both 32-bit and 64-bit binaries. Deciding which one to download can be complex.

      The basic idea is that to use a 64-bit version of Eclipse, you must have a 64-bit JVM and an operating system that will support 64-bit applications. When in doubt, choose the 32-bit version of Eclipse, it is more likely to work than the 64-bit version.

      See below for details.

      32-bit or 64-bit?

    2. (All Platforms): Finish the installation by double clicking on /Applications/eclipse/Eclipse.app or eclipse/eclipse.exe.
      The first time this is run it will complete the installation process.

    Eclipse Preferences for Ptolemy II

    Eclipse has the notion of a workspace, which is a collection of one or more projects. Ptolemy II is a project.
    When the "Workspace Launcher" window comes up, either stick with the default or choose a new directory. Note that the projects can be located outside of the workspace directory. One caveat is that Eclipse will not permit the project directory to be a parent of the workspace directory, so placing the workspace in a subdirectory such as the default location is best.
    Click "OK" to create the workspace and open Eclipse.
    Below is the Workspace Launcher Window:

    Eclipse Workspace Launcher

    The default configuration of Eclipse has some difficulties with Ptolemy II, so a few changes are necessary.
    1. (Optional): Shortcuts and Memory Size
    2. Eclipse requires some customization to build Ptolemy II and to keep the Ptolemy II coding style. In the steps below, we outline changes to be made in the Eclipse Preferences window.
      Under Windows the Eclipse Preferences window is invoked via Window | Preferences.
      Under Mac OS X the Eclipse Preferences window is invoked via Eclipse | Preferences.
      For each of the changes, hit Apply. When all the changes are done, hit OK, which will close the Eclipse Preferences Window.
    3. By default, Eclipse rebuilds a project when any change is made to a file. This will result in thousands of errors when Ptolemy II is first checked out, and during normal usage, can be annoying because of the pauses it creates. We suggest disabling this feature as follows:
      1. While still in the preferences window
        (Mac OS X: Eclipse | Preferences)
        (Windows: Window | Preferences)
      2. Select General | Workspace
      3. Deselect Build automatically.
      4. Click Apply.
      Below is the General | Workspace window:

      Eclipse Preferemces General Workspace

    4. Ptolemy II source files are worked on by many people with different editors. Unfortunately, different text editors interpret tab characters differently, so it is best to use spaces rather than tabs.
      Sadly, the Eclipse developers have chosen to use tabs as spaces, so you must adjust the Eclipse Java Formatter if you plan on contributing code to the Ptolemy II tree.
      Also, it is best if files end with new line characters, so that we can run line oriented scripts on them.
      In addition, we currently do not want the Eclipse Formatter to format comments. We hope to change this policy in the future.
      We handle these changes together:
      1. While still in the preferences window
        (Mac OS X: Eclipse | Preferences)
        (Windows: Window | Preferences)
      2. Go to Java | Code Style | Formatter and click New
      3. In the "New Profile" Window, for the Profile name, enter "Ptolemy II" Under "Initialize settings with the following profile", select "Java Conventions [built-in]" (We use Java Conventions over the "Eclipse" setting because the Eclipse style uses tabs.) Then hit OK
      4. Under the "Indentation" tab, change the Tab policy to "Spaces only".
      5. Under the "New Lines" tab, select "at end of file"
      6. Under the "Comments" tab,
        unselect "Enable Javadoc comment formatting"
        unselect "Enable block comment formatting", otherwise the block comments that have <pre> ... <pre> get changed.
        unselect "Enable line comment formatting", otherwise the headers for public methods etc. get changed.
      7. Click OK.
      8. In the Preferences Window, click Apply.
    5. Ptolemy II 8.0 uses some features of Java 1.5, which is also known as Java 5.0. In particular, ptolemy/actor/ptalon uses generics, which require Java 1.5 (aka Java 5.0) or later.

      However, the Ptolemy II development trunk that includes changes after Ptolemy II 8.0 uses some features of Java 1.6 (aka Java 6.0). In particular, ptdb to uses javax.swing.GroupLayout. which requires Java 1.6 (also known as 6.0) or later.

      1. While still in the preferences window
        (Mac OS X: Eclipse | Preferences)
        (Windows: Window | Preferences)
        expand Java | Compiler
      2. Make sure that Set "Compiler compliance level":
        • (Mac OS X): "1.5" or "5.0"
        • (Windows): "1.6" or "6.0"
        Note that Java 1.5 is the same as Java 5.0 and Java 1.6 is the same as Java 6.0. What we don't want is "1.4" or "4.0". If you plan on using the the Ptolemy II development tree after Ptolemy II 8.0. then you don't want "1.5" or "5.0".
      3. Click Apply.
    6. Eclipse has very good compiler error/warning. One of the warnings complains if a Serializable class does not have serialVersionUID declared. Since this warning is only useful if you are tightly managing serialization, we turn it off:
      1. While still in the preferences window
        (Mac OS X: Eclipse | Preferences)
        (Windows: Window | Preferences)
        Expand Java | Compiler | Errors/Warning
      2. Under "Potential programming problems", change "Serializable class without serialVersionUID" to "Ignore"
      3. Under "Generic Types", change "Unchecked generic type operation" to "Ignore".
      4. Under "Generic Types", change "Usage of a raw type" to "Ignore".
      5. Click Apply. If you are prompted for a full rebuild, click Yes.
    7. (Windows:) The PtDoc Doclet in $PTII/doc/doclets/PtDoclet.java requires tools.jar, which is only in the Java Development Kit (JDK), not the Java Runtime Environment (JRE). So, be sure that a JDK is selected for building, not a JRE.
      While still in the preferences window:
      (Mac OS X: Eclipse | Preferences)
      (Windows: Window | Preferences)
      1. Select Java | Installed JREs
        (Mac OS X): select JVM 1.5.0.
        (Windows): select JVM 1.6.0.
      2. Verify that the checked line corresponds with a JDK, not a JRE.
    8. (Windows): While in the "Installed JREs" window, under Java 1.6, tools.jar must be added the external jars:
      1. Select the default JRE | Edit | Add External Jars.
      2. Browse to the path of your JDK for example c:\Program Files\Java JDK1.6.0_22\lib
      3. Hit Open, select tools.jar and then finish.
    9. Click OK in the Preferences window to apply all of the above changes.

    Setting up Eclipse to manage your Ptolemy II development environment

    Eclipse will manage your ptII code tree as a project called the ptII project. There several ways to set up the ptII project,

    1. Eclipse is unaware of the version control aspects of the project.
      If you are downloading the source from major Ptolemy release, and don't want to update regularly, then use this choice.
      (No Eclipse Subversion plug-in (Subversive), No Subversion (svn) from the command line).
    2. Eclipse is unaware of the version control aspects of the project, use the shell version of Subversion to update the tree.
      (No Eclipse Subversion plug-in (Subversive), use Subversion (svn) from the command line).
    3. Eclipse is aware of the Subversion aspects of the project. You can use both Eclipse and shell version of Subversion to update the tree.
      (Use both the Eclipse Subversion plug-in (Subversive) and the shell svn command).
    Without Subversive, you'll need to manage the Subversion aspects in the usual way, i.e. with Subversion commands being submitted to a bash shell. With Subversive, Eclipse will do all sorts of things to "help" you. Most of these things are good, but there is a learning curve.

    Please choose one of the methods below to set up Eclipse for Ptolemy II.

    1. Eclipse is unaware of the version control aspects of the project. (No Subversion)

    If you are downloading the source from major Ptolemy release, and don't want to update regularly
    1. Download a ptII source tree from http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIlatest
      The Windows and Mac OS X installers include the source, or you may install a separate source-only download.
    2. Eclipse uses the .classpath file to set paths and exclude files. There are two choices:
      1. In the Ptolemy II source tree, copy .classpath.default to .classpath. This choice is the simpler choice, but might exclude optional third party packages.
      2. Run ./configure. This choice is more complex, especially for Windows users. However, this choice will include optional third party software that is already installed on your machine.
      Choose one of the options below

      A. Copy .classpath to .classpath.default

      OR

      B. Run ./configure

      Ptolemy II includes a number of packages that rely on software that you may or may not have installed, such as MATLAB, the rxtx package (for serial port connections), joystick support, Java Advanced Imaging (JAI), the Java Media Framework (JMF), and Java 3D. If you wish to use or extend these features, you will need to perform a few extra steps. These steps require execution of a script called configureThe procedure below will modify the .classpath file that is provided in the version control repository to customize it for the software that you have installed.

      • (Mac OS X): Using the Terminal to run configure
        1. Start up the Terminal application, which may be found as /Utilities/Terminal.app
        2. In the Terminal, change to the directory where the Ptolemy II source code was installed. For example:
          	   cd /Applications/Ptolemy/ptII8.0.1
          	 
        3. Set $PTII to the location of the source tree:
          	   export PTII=`pwd`  
          	 
        4. Make configure executable.
          	   chmod a+x configure
          	 
                 
        5. Run ./configure
          	   ./configure
                   
      • (Windows): Install Cygwin and run configure Unfortunately Windows does not ship with Unix shell commands like make. The workaround is to install Cygwin, see http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIlatest/cygwin.htm
        1. Start up the Cygwin Bash shell: Start | Run | Cygwin
        2. Change to the directory where the Ptolemy II source code was installed. For example:
          	    cd c:/Ptolemy/ptII8.0.1
                    
          Note that if there are spaces in the path name to the directory where your Ptolemy installation is located, then you should use double quotes around the path: cd "c:/Documents and Settings/yourLogin/workspace/ptII"
        3. Set $PTII to the location of the Ptolemy II source tree:
          	    export PTII=c:/Ptolemy/ptII8.0.1
          	  
          Again, if there are spaces in the path, use double quotes: export PTII="c:/Documents and Settings/yourLogin/workspace/ptII"
        4. Run:
          	    ./configure
          	  
          This will create $PTII/.classpath
    3. If Eclipse is not running, start up Eclipse
    4. In Eclipse, do File | New | Project.
    5. In the "New Project" window, select "Java" > "Java project", Click Next.

      Eclipse New Project

    6. In the "New Java Project" window:
      In "Project Name", enter any project name, ptII is a common choice.
      Uncheck "Use default location" and browse to the location of the source tree.
      (Mac OS X): For example, browse to /Applications/Ptolemy/ptII8.0.1
      Press "Next". There might be a delay as Eclipse scans your ptII tree.
      Below is the New Java Project window:

      Eclipse New Java Project

      Warning: If the "Setting Build Paths" window comes up with a message "The output folder has changed. Do you want to remove all generated resources from the old location ptII/bin", then the problem is that the .classpath file was not found. It is best if you exit Eclipse, create the .classpath file and redo the above steps.
    7. In the "New Java Project" window, select "Allow output folders for source folder", then click "Finish"
      Below is the second New Java Project window:

      Eclipse New Java Project

    8. When asked if you want to shift to the Java perspective, click on Yes.
    9. Under the "Project" menu choice, select "Build All", "Run in background" and then "Build Automatically"
    10. The workspace will take a few minutes to build.
    11. Go to Running Ptolemy II below.

    OR

    2. Eclipse is unaware of the version control aspects of the project, use the shell version of Subversion to update the tree.

    1. Install Subversion:
      • (Mac OS X): Mac OS X already has Subversion installed. To test this, start up a Terminal window and run svn help.
      • (Windows): Windows does not have Subversion installed.
        • Tortoise SVN - Windows GUI Client
          If you are not installing the Eclipse Subversive plugin, then choose TortoiseSVN
        • Cygwin - Windows command line client
          If you are more comfortable with a command line, then choose Cygwin. Make sure that you also install Cygwin's Subversion package.
    2. To check out the ptII svn repository with read-only access:
           svn co svn://source.eecs.berkeley.edu/chess/ptII/trunk ptII
           

      Note: Most users will select svn:// because they will be accessing the tree with read-only Subversion access.
      If you have an ssh account on source.eecs.berkeley.edu, then check out ptII with read/write access:
          svn co svn+ssh://source.eecs.berkeley.edu/chess/ptII/trunk ptII
          
      Or, if your user id on source.eecs is different than your current user id on your machine:
          svn co svn+ssh://yourID@source.eecs.berkeley.edu/chess/ptII/trunk ptII
          
    3. Configure the .classpath and .project files. See .classpath.default. below.
    4. Create the ptII project
      1. In File | New | Project, select 'Java project'. In the 'Contents' box, click on 'Create project from existing source' and browse to the PTII directory. Finish.
      2. When asked if you want to shift to the Java perspective, click on Yes.
    5. Go to Setup the Subversion Configuration to Sane Settings below.

    OR

    3. Setting up Eclipse for use with Subversion: Installing Subversive

    There are at least two Subversion plugins for Eclipse, Subversive and Subclipse. Either will work, for a brief comparison, see Subclipse vs. Subversion. The instructions below are for Subversive. To use Subclipse, see Installing Subversion (SVN) into Eclipse.

    The Subversive Eclipse plug-in adds Subversion to Eclipse. After installation, you can use either Eclipse to manage your project, or the svn from the command line.

    Follow the Subversive installation instructions or these instructions below

    1. To download Subversive, in Eclipse, follow these menus
      Mac OS X:
      The first time software is to be added the menu will be: Help | Install New Software
      Windows: Help | Software Updates | Available Software.
    2. In the "Work with" field, select "Helios - http://download.eclipse.org/releases/helios" from the drop down.
      Expand the "Collaboration" tab and check the box next to "Subversive SVN Team Provider (Incubation)"
    3. Then click Next, Next again and click through the license agreement and hit Finish When the "Software Updates" window appears and asks about a restart, select "Restart Now" and restart.
    4. When Eclipse restarts, bring up the preferences window:
      (Mac OS X: Eclipse | Preferences)
      (Windows: Window | Preferences)
      Then do Team | SVN. When you click on the SVN, the "Subversion Connector Discovery" window will pop up. (See http://www.polarion.com/products/svn/subversive/connector_discovery.php
      for details.)
    5. In the "Subversion Connector Discovery" window, what version you select depends on what version of svn is installed on your machine.
      If svn --version returns 1.4, then install SVN Kit 1.1.7
      If svn --version returns 1.5, then install SVN Kit 1.2.3
      If svn --version returns 1.5, then install SVN Kit 1.3.0

      Note: if you install a more recent version of the plugin than the version of the command line svn tool, then you will not be able to use the command line svn to update or modify the tree that is checked out by Eclipse.
      If you run svn on a tree checked out by Eclipse and get a message svn: This client is too old to work with working copy '.'; please get a newer Subversion client, then the solution is to update svn.

      Then do "Finish", "Next", "Next", Accept the license and then "Finish".

    6. If you get a security warning about unsigned software, click "OK".
    7. When prompted for a restart, select "Restart Now".

    Setup the Subversion Configuration to Sane setting

    Sadly, Subversion is by default configured with nonsense initial default values for commit times and end of line settings.

    Tell Subversion to use commit times

    In the default settings, if you check out files with subversion, then they will have their modification times set to the current time. This is incorrect:
    1. The ptII tree includes derived files that are generated by Autoconf, JavaCC and Antlr. If the commit times are not preserved, then the source file might have a mod time later than the derived file which means that either the tool must be run or else the build system must touch the derived file.
    2. If the commit times are preserved, the ls -ltr will quickly show which files were changed when

    To change the Subversion configuration, hunt for the .subversion/config file.

    Under Windows with Cygwin, you might find it as $HOME/.subversion/config. Another place to look is c:/Documents and Settings/yourlogin/Application Data/Subversion/config.

    On the Mac, try /Users/yourlogin/.subversion.

    If the directory does not exist, try running svn --version to create the directory.

    Make this change to .subversion/config

    ### Set use-commit-times to make checkout/update/switch/revert
    ### put last-committed timestamps on every file touched.
    use-commit-times = yes
    

    Tell Subversion to automatically set the eol style

    With the default settings, if you use Subversion to add a makefile, then the file will be checked in with binary settings. When the file is checked on out non-Windows platforms, then the file will have \r\n characters, which will break Solaris /usr/ccs/bin/make and cause other problems.

    In addition, we would like keyword strings like $Id: eclipse.htm 59655 2010-10-22 23:48:15Z cxh $ to be automatically expanded and updated.

    Find the .subversion/config file and uncomment the enable-auto-props line so that it looks like:

    enable-auto-props = yes 
    
    Also, uncomment the [auto-props] and the section below that sets the properties for the files. Also, set props for at least makefile, *.tcl and *.mk files. See
    $PTII/doc/coding/svn-config-auto-props.txt for a more complete set of properties. The bottom of the .subversion/config file should look like:
    ### Settings for your ~/.subversion/config file.  To use this:
    ### 1) Edit your ~/.subversion/config file
    ### 2) Insert the contents of this file into your
    ###    ~/.subversion/config file
    ### 3) You must set "enable-auto-props" to yes
    ###    BEFORE the [auto-props] line.
    ###    _BE_SURE_ to check that [auto-props] does NOT appear twice
    ###    If you append the contents of this file at the end
    ###    Of your config file, you will need to comment out
    ###    the preexisting [auto-props] line.
    
    ### Set enable-auto-props to 'yes' to enable automatic properties
    ### for 'svn add' and 'svn import', it defaults to 'no'.
    ### Automatic properties are defined in the section 'auto-props'.
    ### For this to work, the "enable-auto-props = yes" line should
    ### be before the "[auto-props]" line.
    enable-auto-props	 = yes
    
    [auto-props]
    
    ### Section for configuring automatic properties.
    ### The format of the entries is:
    ###   file-name-pattern = propname[=value][;propname[=value]...]
    ### The file-name-pattern can contain wildcards (such as '*' and
    ### '?').  All entries which match will be applied to the file.
    ### Note that auto-props functionality must be enabled, which
    ### is typically done by setting the 'enable-auto-props' option.
    ###
    ### NOTE: There is a bug in svn-1.5 and earlier where lines
    ### that differ only in case cause problems - only the first
    ### line is read.  See
    ### http://subversion.tigris.org/issues/show_bug.cgi?id=2036
    ### 
    *.MF = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.aart = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.ac = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.am = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.apt = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.avi = svn:mime-type=video/avi
    *.bat = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.bsh = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.c = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.cat = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.cgi = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.classpath = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.cmd = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.cnd = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.conf = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.config = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.cpp = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.css = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.cwiki = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.data = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.dcl = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.doc = svn:mime-type=application/msword
    *.dsp = svn:eol-style=CRLF
    *.dsw = svn:eol-style=CRLF
    *.dtd = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.egrm = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.ent = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.fn = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.ft = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.fv = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.g = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.gif = svn:mime-type=image/gif
    *.grm = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.gz = svn:mime-type=application/x-gzip
    *.h = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.handlers = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.htc = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.html = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.ico = svn:mime-type=image/x-icon
    *.ihtml = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.in = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.java = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.jmx = svn:eol-style=LF
    *.jpg = svn:mime-type=image/jpeg
    *.jpg= svn:mime-type=image/jpeg
    *.js = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.jsp = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.junit = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.jx = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.m = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.m4 = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.manifest = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.mdo = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.meta = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.mf = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.mk = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.mod = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.mov = svn:mime-type=video/quicktime
    *.mpg = svn:mime-type=video/mpeg
    *.ms = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.n3 = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.nroff = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.patch = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.pdf = svn:mime-type=application/pdf
    *.pen = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.php = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.pl = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.pm = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.png = svn:mime-type=image/png
    *.pod = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.pom = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.ppt = svn:mime-type=application/powerpoint
    *.project = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.properties = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.py = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.rb = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.rdf = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.rnc = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.rng = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.rnx = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.roles = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.rss = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.schemas = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.sh = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.sh = svn:eol-style=native;svn:executable
    *.sql = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.svg = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.tcl = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.tgz = svn:mime-type=application/x-compressed
    *.tif = svn:mime-type=image/tiff
    *.tiff = svn:mime-type=image/tiff
    *.tld = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.txt = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.types = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.vm = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.vsl = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.wsdd = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.wsdl = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xargs = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xcat = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xconf = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xegrm = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xgrm = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xhtml = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xhtml2 = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xlex = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xlog = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xls = svn:mime-type=application/excel
    *.xmap = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xml = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xroles = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xsamples = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xsd = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xsl = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xslt = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xsp = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xtest = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xul = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xweb = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.xwelcome = svn:eol-style=native;svn:keywords=Author Date Id Revision
    *.zip = svn:mime-type=application/zip
    .htaccess = svn:eol-style=native;svn:keywords=Author Date Id Revision
    INSTALL = svn:eol-style=native;svn:keywords=Author Date Id Revision
    KEYS = svn:eol-style=native;svn:keywords=Author Date Id Revision
    LICENSE = svn:eol-style=native;svn:keywords=Author Date Id Revision
    makefile = svn:eol-style=native;svn:keywords=Author Date Id Revision
    Makefile = svn:eol-style=native;svn:keywords=Author Date Id Revision
    NOTICE = svn:eol-style=native;svn:keywords=Author Date Id Revision
    README = svn:eol-style=native;svn:keywords=Author Date Id Revision
    abs-linkmap = svn:eol-style=native;svn:keywords=Author Date Id Revision
    abs-menulinks = svn:eol-style=native;svn:keywords=Author Date Id Revision
    
    
    

    See Subversion Users: Re: Setting svn:eol-style and http://maven.apache.org/developers/svn-eol-style.txt

    BTW - To set the style on already checked in file, run:

    svn propset svn:eol-style native filename
    
    To set the keywords on an alredy checked in file, run: svn propset svn:keywords "Author Date Id Revision" filename Then run svn commit to commit the change.

    SSH Configuration.

    If you will be accessing the ptII repository with read/write access, then you will need to do a little more configuration concerning passwords.

    Note: Most users will not need to do this configuration because they will be accessing the tree with read-only Subversion access. Read-only users can skip to Check Out Ptolemy II from the Subversion repository

    To access the ptII repository with read/write access, you will need configure Subversive to use your password. If don't do this step and you leave the default settings, and have Cygwin ssh installed, then c:/cygwin/bin/ssh.exe window will pop up each time ssh is called.

    The fix is to set Subversive to use SVNKit Window | Preferences | Team | SVN | SVN interface | SVNKit (Pure Java) | OK

    Check Out Ptolemy II from the Subversion repository

    Below we describe how to set up Eclipse so Eclipse manages the Subversion interaction.

    Eclipse will manage your ptII code tree as a project called the ptII project. Assuming Eclipse is running:

    1. Install Subversive by following the instructions above.
    2. In Eclipse, add the ptII SVN Repository: Window | Show View | Other | SVN | SVN Repositories
    3. In the SVN Repository view, right click, select New and set the url.
      To check out the ptII svn repository with read-only access:
      https://source.eecs.berkeley.edu/svn/chess/ptII
      
      or
      svn://source.eecs.berkeley.edu/chess/ptII
      

      Note: Most users will select https:// or svn:// because they will be accessing the tree with read-only Subversion access.
      If you have an ssh account on source.eecs.berkeley.edu, then check out ptII with read/write access:

      svn+ssh://source.eecs.berkeley.edu/home/svn/chess/ptII
      
      Or, if your user id on source.eecs is different than your current user id on your machine:
      svn co svn+ssh://yourID@source.eecs.berkeley.edu/chess/ptII
      
      Read/write users will be prompted for their source.eecs.berkeley.edu username and password. This typically happens more than once since in case the svn+ssh protocol is being used passwords are not cached.
    4. If you get a "Certificate Problem" window, then select Trust or Trust Always. For details and a workaround, see Certificate is not issued by a trusted authority.
    5. In the SVN Repository view, right click on trunk and select Find/Check out As
      Be sure to check out the trunk not the entire tree, which include all the branches and the trunk.
      Follow the wizard, creating selections as follows:
      • In the "Check Out As" window, use the default, Check out as a project configured using the New Project Wizard, then hit Finish.
      • In the "Select a wizard" window, select Java | Java Project, then hit Next.
      • In the "Create a Java Project" window,
        set "Project Name" to: ptII
        set "Project Layout" to Use project folder as root for sources and class files. This is done so that $PTII/bin will contain the Ptolemy II command line scripts instead of the *.class files created by Eclipse.
      • Click Finish.
      • If you see a Confirm Overwrite Window that says:
        The project you created, ptII, contains resources other than the standard .project file. If any of those resources have the same name and relative location of a resource you are checking out, the local resource will be replaced with the resource from the repository
        then you probably did not change "Project Layout" as per above. Click cancel and recreate the Java Project.
      • In the "Open Associated Perspective?" window, click "Yes".

    6. Wait for the checkout to finish. Go get coffee.
      Note:If you did not disable build automatically, as suggested above, then Eclipse will build the project and produce thousands of errors. This is not really a problem. You will fix the errors below with the .classpath.default file.

    7. You will want to view the project in the Java perspective. If you aren't already in the Java perspective, select Window | Open Perspective | Java in the menu. By default, Eclipse offers a "Package Explorer" as the main navigation mechanism for the source files. Many developers much prefer to use the "Navigator." To get the Navigator, select Window | Show View | Navigator in the menu. You can now browse the source files.

    8. Find the file in the ptII home directory called .classpath.default and copy it into a new file called .classpath.
      Note that you can use the Eclipse Navigator browse to the .classpath.default file, open the file, copy the contents, open .classpath, paste the contents and save .classpath.
      Or, you can use Windows Explorer or the shell.
    9. In Eclipse, perform a Refresh on the ptII project by Window | Open Perspective | Java    Go to the Package Explorer or the Navigator.
         Right mouse click on the ptII icon and select Refresh.
      Note:If you do not do copy .classpath.default and select "Refresh", then Eclipse will produce thousands of errors. This is not really a problem. It reflects that you probably don't have installed many optional packages that are needed to build subsets of Ptolemy II. You can ignore the errors (not advised, since they will mask errors you make), or you can copy the .classpath.default file and rebuild.

      Running configure

      Alternatively, you can run ./configure, which searches your environment for 3rd party packages and updates .classpath.
      • If, after running configure$PTII/bin on the command line, you will probably want to run the following commands within Cygwin bash:
        cd $PTII/bin
        make
        
      • In Eclipse, after running configure, perform a Refresh on the ptII project by Window| Open Perspective | Java
           Go to the Package Explorer or the Navigator.
           Right mouse click on the ptII icon and select Refresh.
        This will cause Eclipse to see the new ptII/.classpath and to build the project (or you may have to manually rebuild if you turned off automatic rebuild).

  • Build Ptolemy II by selecting Project | Build All. (If Build All is greyed out, then perhaps "Build Automatically" was not disabled and Ptolemy has been built. See above for more about Build Automatically.) You will get many warnings that you can ignore, but hopefully no errors.

    Running Ptolemy II

    1. In the Run menu, select "Run Configurations...".

    2. In the resulting dialog, select "Java Application" and click "New".

    3. In the dialog, fill in the boxes as follows:
      • Name: Vergil
      • Project: ptII
      • Main class: ptolemy.vergil.VergilApplication

    4. Press the Run button.
    The Ptolemy II welcome window should appear.

    You may now wish to read the Using Vergil tutorial.

    Simple Debugging Session

    1. Locate ptolemy/vergil/VergilApplication in the Explorer and double click. Place a breakpoint on the first line of main() by using Run | Add/Remove Breakpoint
    2. Tell Eclipse which class to run with Run | Run. On the Main tab, select the Ptolemy II package and enter ptolemy.vergil.VergilApplication as Main class.
    3. Press the Run button
    4. To debug, quit Vergil, and place a breakpoint in, say, the fire() method of ptolemy.domains.ct.kernel.CTBaseIntegrator. Then Run | Debug, and as above. Open the Lorenz CT demo from the Quick Tour and run it.

    Synchronizing with the repository

    1. In the Navigator view scroll/open until you see the resource (directory or file) to be synchronized.
    2. Right click that resource and select Team->Synchronize With Repository...
    3. The Synchronize view should then be visible.
    4. Select the Incoming, Outgoing, or Incoming/Outgoing menu bar icon as appropriate

    Restoring a file from the repository

    1. In the Navigator view scroll/open until you see the resource (directory or file) to be restored.
    2. Right click that resource and select Replace With->Latest From Head.

    Copying Files

    Usually, it is better to extend Java classes than to copy them, but sometimes copying files under Subversion is useful. To copy files, use the svn cp command. Do not drag and drop directories as the directories contain a .svn directory that will have settings for the source location. Instead, use svn cp. See also svn mv.

    Debugging Tcl Tests

    See Testing Ptolemy II for details.
    1. In Eclipse, go to Run -> Debug Configurations
    2. Select Java Application and then click the New icon in the upper tool bar of the window.
    3. In the Main tab, set the "Name:" to ptjacl, in "Main class:", enter tcl.lang.Shell.
    4. Optional: In the Arguments tab, under "Program arguments", enter alljtests.tcl or any individual test tcl file. (E.g. SimpleDelay.tcl). Or, leave the "Program arguments" field blank and when ptjacl is running (see below), enter text in to the Eclipse console.
    5. Optional: In the Arguments tab, under "VM arguments", enter -Dptolemy.ptII.dir=your PtII directory
      (E.g. -Dptolemy.ptII.dir=c:/hyzheng/ptII).
      In case your directory path contains spaces, you need to use quotes. (E.g. -Dptolemy.ptII.dir="c:/my workspace/ptII").
    6. In the "Working directory:" pane, select "Other:", browse to the directory containing the tcl tests.
      (E.g. C:\hyzheng\ptII\ptolemy\domains\de\lib\test)
    7. Select Debug.
    The nice thing of using Eclipse is that you can very easily locate where the exception is thrown by clicking the classes listed in the stack trace. You may further register a breakpoint to do more diagnosis.

    Troubleshooting

    Preferences

    If you have already used Eclipse and you would like to start over with new projects and preferences, remove the workspace directory in the Eclipse directory. The workspace directory will only appear if you have already run Eclipse. Note that removing the workspace directory will cause Eclipse to 'forget' about any projects that you may have set up

    Build Error: Assert cannot be resolved

    If, when building, the Problem tab shows "Assert cannot be resolved", then the problem is that Junit is not being found.

    Rebuilding Briefly flashes a window

    If you have problems where clicking on build briefly flashes up a window, look in $PTII/.classpath for and empty exclusion that looks like ||

    If you have problems with the classpath, look in the workspace/.metadata/log file that is in the directory where eclipse is installed. For more information about the .metadata directory, see below.

    Eclipse takes a long time to start up

    If Eclipse takes a long time to start up, then the problem could be a problem in your .metadata file.

    Basically, when eclipse starts up, it might try to update H:/workspace/.metadata . The solution is covered in http://www.eclipse.org/documentation/html/plugins/org.eclipse.platform.doc.user/doc/tasks/running_eclipse.htm: The way I figured this out was by running Norton Antivirus and doing View -> File System Realtime Scan Statistics and then I noticed that my machine was updating H:/workspace/.metadata

    I think I introduced the problem by clicking on the Eclipse.exe binary and selecting Pin to Start Menu. My solution was to remove the Eclipse bogus entry in the start menu and then create a shortcut, change Start in property and then pin that shortcut to my start menu.

    Instructions for adding an actor in Eclipse

    Based on text by Mehran Meschian.

    In this example, we copy ptolemy/actor/lib/Ramp.java and create a new actor called Ramp2

    1. Open Eclipse and choose the work space that you have your Ptolemy project there (mine is PtII 8.0.1)
    2. Open the PtII8.0.1 folder in eclipse and then open Ptolemy -> actor -> lib -> string
    3. In string folder copy the java class (our simple actor)
    4. Rename the java file to Bmh and debug the errors that come because of this renaming.
    5. At the first line of the Java code add: package ptolemy.actor.lib.string;
    6. When there is no more error Run the java file and you should see a Bmh.class file in the tree as well (In the string branch). For now close the GUI window that opened after running.
    7. In the same place that Bmh.java and Bmh.class files exist, there is a string.xml file. Open it.
    8. At the top of the eclipse console, you should see two options: Design & Source. Click on Source to see the content of the xml
    9. Add the following bold and red text to the location in the xml file. Then save and run the xml file:
      <property name="_icon" class="ptolemy.vergil.icon.AttributeValueIcon">
                <property name="attributeName" value="function"/>
                <property name="displayWidth" value="11"/>
              </property>
            </entity>
      
            <entity name="Bmh" class="ptolemy.actor.lib.string.Bmh">
             <doc>Boyer Moore Horspool</doc>
            </entity>
      
            <entity name="StringIndexOf" class="ptolemy.actor.lib.string.StringIndexOf">
             <doc>Output the length of an input string</doc>
            </entity>
      
    10. Again in the same tree there is makefile. Open and add the following bold and red text to the location and save and run:
      PTDIST =        $(PTPACKAGE)$(PTVERSION)
      PTCLASSJAR = 	$(PTPACKAGE).jar
      
      # Keep this list alphabetized.
      JSRCS = \
              Bmh.java \
      	StringCompare.java \
      	StringFunction.java \
      	StringIndexOf.java \
      	StringLength.java \
      	StringMatches.java \
      
    11. Now, back to your Bmh.java and run it again. You should see the welcome window of Vergil.
    12. Now in the window, go to file- > New -> Graph editor. You should see a new window of graph editor.
    13. Go to Graph -> instantiate Entity. Then type Ptolemy.actor.lib.string.Bmh in the class name and you will see our Bmh actor in the window.
    14. Right click on the actor and choose Save Actor in Library. Now if you open the User Library (left side) you can see the Bmh actor there.
    15. In the case after all of these steps it doesn't work, restart your eclipse and make sure you have saved your xml file and there are Bmh.java and Bmh.class there. If again it doesn't work, there should be something wrong regarding your Ptolemy installation in eclipse. Hope not!!