Version 22, last updated by Iulian Dragos at Dec 15 18:15 2011 UTC
Hacking and Testing
If you've followed the steps in the Initial Set Up section, you should be ready to start hacking on the Scala IDE sources.
In order to run and test the Scala IDE, you need to launch another instance of Eclipse, which contains your changes to the Scala IDE (most likely, to the org.scala-ide.sdt.core project). Since we rely on weaving, the spawned instance has to have weaving enabled, which is not the case by default.
Using the Equinox Weaving Launcher (Recommended)
Please install the Weaving Launcher from the following update site:
http://download.scala-ide.org/equinox-weaving-launcher
This adds two more launch configurations: Eclipse Application with Equinox Weaving, and JUnit plugin test with Equinox Weaving. To create a run configuration, follow the usual steps, but instead of the plain Eclipse Application/JUnit Plugin test configuration choose the one with Equinox Weaving. This makes the launched Eclipse instance use weaving.
This is all there is to it: you can configure the launcher using the normal tab (check the Plugins section to make sure it uses the sdt.core bundle from your workspace, and the necessary dependencies (usually org.scala-ide.scala.library and org.scala-ide.scala.compiler are also enabled).
Manually Enabling Weaving (still works, but it is a lot more cumbersome).
As of April 2010 creating an Eclipse run configuration that works with Equinox Aspects is a partly manual process.
Locate your installed Equinox Aspects bundles
You will need to find the absolute filesystem location of the following Equinox Aspects bundles which were installed when you installed the Scala IDE nightly build. If you have installed the nightly build directly into your main Eclipse installation, these will be in the "plugins" subdirectory of you Eclipse installation. If instead you created a separate Eclipse configuration area they will be in its "plugins" subdirectory.
org.eclipse.equinox.weaving.aspectj_*.jar
org.eclipse.equinox.weaving.hook_*.jar
where the "*" will actually be a version number of the form x.x.x.yyyymmddtttt. These locations will be used in step 7 below.
Creating a Run configuration
1. Select Run → Run Configurations...
2. Select "Eclipse Application", click the New button and name your run Configuration "Scala-IDE"
3. Switch to the "Arguments" tab and:
3a. Add "-clean -consoleLog" to the end of the "Program arguments" list, or "-clean -console" if you want the interactive Equinox console.
3b. Add "-Xms256m -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=256m -Xss1M -server -XX:+UseConcMarkSweepGC" to the "VM arguments list".
- For the "-server" parameter to work, ensure that the JRE installed and used under Preferences → Java → Installed JREs is actually a JDK.
- Try to set the maximum memory as high as possible for your platform. "-Xmx2048" won't work on Windows 32bit, for example, because there, the limit is somewhere between 1.3 and 1.6 gb.
4. Switch to the "Configuration" tab and:
4a. Confirm that "Use default location" is selected. Make a note of this location, it will be required in step 6.
4b. Confirm that "Generate a config.ini file with default content" is selected.
5. Click run
This will start a new Eclipse instance and workspace, but it will not yet function correctly and fully reflect your changes. However it will have created a default config.ini file which is appropriate for your installation. Close this Eclipse instance immediately.
Creating a config.ini file:
6. Copy the config.ini file that will have been created in step 5 from the location you noted in step 4a to the root of the scala-plugin project in your workspace.
7. Modify this file as follows using the locations of the Equinox Aspects bundles that were noted earlier,
7a. Find the line that begins "osgi.framework=". Rename "osgi.framework" to "osgi.frameworkClassPath" and append ",file\:<location of org.eclipse.equinox.weaving.hook>"
7b. Find the line that begins "osgi.bundles=" and insert after the '=' "reference\:file\:<location of org.eclipse.equinox.weaving.aspectj bundle>@2\:start,".
7c. Append the following lines to the file:
osgi.framework.extensions=org.eclipse.equinox.weaving.hook
aj.weaving.verbose=true
org.aspectj.weaver.showWeaveInfo=true
org.aspectj.osgi.verbose=true
As an end result you should have a config.init which looks similar to this:
#Configuration File
#Thu Feb 05 12:48:28 GMT 2009
org.eclipse.update.reconcile=false
osgi.install.area=file\:/opt/eclipse-3.4.1
eclipse.p2.profile=SDKProfile
osgi.instance.area.default=@user.home/workspace
osgi.frameworkClassPath=file\:/opt/eclipse-3.4.1/plugins/org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar,file\:/home/miles/projects/eclipse/trunk-3.4.1/plugins/org.eclipse.equinox.weaving.hook_1.0.0.200901261628.jar
eclipse.buildId=M20080911-1700
osgi.bundles=reference\:file\:/home/miles/projects/eclipse/trunk-3.4.1/plugins/org.eclipse.equinox.weaving.aspectj_1.0.0.200901241853.jar@2\:start,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.0.0.v20080604.jar@1\:start
org.eclipse.equinox.simpleconfigurator.configUrl=file\:/home/miles/projects/eclipse/trunk-3.4.1/workspace/.metadata/.plugins/org.eclipse.pde.core/Scala-Plugin/org.eclipse.equinox.simpleconfigurator/bundles.info
osgi.configuration.cascaded=false
eclipse.product=org.eclipse.sdk.ide
osgi.splashPath=file\:/opt/eclipse-3.4.1/plugins/org.eclipse.platform_3.3.101.v200809111700
osgi.bundles.defaultStartLevel=4
eclipse.p2.data.area=@config.dir/../p2
osgi.ws=gtk
# Aspects
osgi.framework.extensions=org.eclipse.equinox.weaving.hook
aj.weaving.verbose=true
org.aspectj.weaver.showWeaveInfo=true
org.aspectj.osgi.verbose=true
Note that this example contains absolute paths that will be different for your installation.
Updating your Run Configuration and launching
8. Select Run → Run Configurations...
9. Select the "Scala-IDE" run configuration you created in step 2.
10. Switch to the "Configuration" tab and
10a. Select "Using an existing config.ini file as a template"
10b. Enter "${workspace_loc:scala-plugin/config.ini}" in the "Location" field.
11. Click Run.
You should now have a new Eclipse instance and workspace which reflects your changes. Note that this Eclipse/Scala IDE instance is running from the code compiled incrementally in your development time workspace, so any errors might prevent the Scala IDE from loading or functioning correctly.
If you get errors on launch
Try doing a Project → Clean ... for the scala and scala-plugin projects in your development time workspace, as the projects in the development time workspace may not have built automatically.
If that's the case (in Error Log view of your runtime workspace) you might see an error message similar to:
Unable to create editor ID scala.tools.eclipse.Editor: The editor class could not be instantiated.
This usually indicates that the editor's class name was mistyped in plugin.xml.
Other users have seen messages about a "Missing View Filter".