Today I decided to go hunting through the Eclipse preferences and I found exactly what I was looking for:
![]() |
| Naming Eclipse Workspaces |
After setting names for all my workspaces, their titles are now useful:
![]() |
| Naming Eclipse Workspaces |
[Edit Jan 3, 2012: Orion has evolved significantly since this post was first written a year ago. Please see this post written by Felipe for an update.]
Yesterday I wrote a blog post which contains a few snippets of Ant code. If you have java-script enabled, those snippets should be nicely formatted with line numbers and some basic syntax highlighting./*******************************************************************************
* Copyright (c) 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
function findOrionElements(tagName){
var elements = [];
var tags=document.getElementsByTagName(tagName);
for(var i=0;i<tags.length;i++) {
if(tags[i].getAttribute('name')==='orion') {
elements.push(tags[i]);
}
}
return elements;
}
function createEditors() {
//find all pre elements named 'orion'
var elements = findOrionElements('pre');
for(var i=0; i < elements.length; i++) {
var element = elements[i];
//extract the text from inside the pre
var text = "";
for( var j=0; j < element.childNodes.length; j++ ) {
var nodeName = element.childNodes[j].nodeName;
if (nodeName === "#text")
text += element.childNodes[j].nodeValue;
else if (nodeName === "BR" )
text += '\n';
}
/* Create the editor:
- parent is the containing div element
- readonly by default, but can specify class="writable"
- use the given stylesheet */
var parentNode = element.parentNode;
var elementClass = element.getAttribute('class');
var editor = new eclipse.Editor({
parent: parentNode,
readonly: !(elementClass && elementClass.indexOf('writable') > -1),
stylesheet: "http://download.eclipse.org/e4/orion/js/org.eclipse.orion.client.editor/editor.css"
});
// use javascript styler for now, there is no html/xml syntax highlighting yet
var styler = new eclipse.TextStyler(editor, "js");
// add a ruler with line numbers to the left side
var lines = new eclipse.LineNumberRuler("left", {styleClass: "ruler_lines"}, {styleClass: "ruler_lines_odd"}, {styleClass: "ruler_lines_even"});
editor.setText(text);
editor.addRuler(lines);
//fix the height of the containing div
parentNode.style.height = (editor.getLineHeight() * (editor.getModel().getLineCount() + 1)) + 2 + 'px';
}
}
<div><pre name="orion" class="writable"> var hello = "Hello World!"; alert(hello); </pre></div>
org.eclipse.orion.client.editor/web/js/editor.js org.eclipse.orion.client.editor/web/js/model.js org.eclipse.orion.client.editor/web/samples/rulers.js org.eclipse.orion.client.editor/web/samples/styler.jsand minified it all using the Google Closure compiler. I hosted the resulting .js file on download.eclipse.org and added the following lines to the bottom of my blog post:
<script type="text/javascript" src="http://download.eclipse.org/e4/orion/js/org.eclipse.orion.client.editor/orion-editor.js"></script> <script type="text/javascript">document.onload=createEditors();</script>
<project name="customTargets overrides" >
<import file="${eclipse.pdebuild.templates}/headless-build/customTargets.xml"/>
<target name="postFetch">
<replace dir="${buildDirectory}/plugins" value="${buildLabel}" token="@build@">
<include name="**/about.mappings" />
</replace>
</target>
</project>
package.org.eclipse.pde.build.container.feature.all.xml
package.org.eclipse.pde.build.container.feature.linux.gtk.x86.xml
package.org.eclipse.pde.build.container.feature.macosx.cocoa.x86.xml
package.org.eclipse.pde.build.container.feature.win32.win32.x86.xml
<target name="defaultAssemble">
<ant antfile="${builder}/packageOverride.xml" dir="${buildDirectory}">
<property name="assembleScriptName" value="${assembleScriptName}" />
<property name="archiveName" value="${archiveNamePrefix}-${config}.zip"/>
</ant>
</target>
<project name="package.override" default="main" >
<import file="${buildDirectory}/${assembleScriptName}" />
<target name="cleanup.assembly">
<condition property="doAssemblyCleanup" >
<or>
<not><isset property="runPackager" /></not>
<contains string="${assembleScriptName}" substring="package." />
</or>
</condition>
<antcall target="perform.cleanup.assembly" />
</target>
<target name="perform.cleanup.assembly" if="doAssemblyCleanup" >
<exec executable="mv" dir="${buildDirectory}" >
<arg value="${assemblyTempDir}" />
<arg value="${buildDirectory}/tmp.${os}.${ws}.${arch}" />
</exec>
<exec executable="rm" dir="${buildDirectory}" >
<arg line="-rf ${buildDirectory}/tmp.${os}.${ws}.${arch}" />
</exec>
</target>
</project>
git archive --format=tar --remote=/gitroot/e4/org.eclipse.orion.server.git master releng/org.eclipse.orion.releng | tar -xf -The build machine has local access to the git repository, if we were running from somewhere else, this would change to something like --remote=ssh://user@dev.eclipse.org/gitroot/...
<target name="getMapFiles" unless="skipMaps">
<mkdir dir="${buildDirectory}/maps" />
<exec executable="git" dir="${buildDirectory}/maps"
output="${buildDirectory}/maps/maps.tar">
<arg line="archive -format=tar" />
<arg line="--remote=/gitroot/e4/org.eclipse.orion.server.git" />
<arg line="master releng/org.eclipse.orion.releng/maps" />
</exec>
<untar src="${buildDirectory}/maps/maps.tar" dest="${buildDirectory}/maps" />
</target>
Because the "| tar -xf -" we used earlier is a redirection done by the shell, that doesn't work when we invoke git from ant. Here we specify a file to hold the output of the archive command, this ends up being a tar file which we can just untar.plugin@org.eclipse.orion.client.core=GIT,tag=v20110125-1800,\
repo=dev.eclipse.org:/gitroot/e4/org.eclipse.orion.client.git,\
path=bundles/org.eclipse.orion.client.core
Some notes:
<project name="CustomAssemble.overrides" default="noDefault">
<import file="${eclipse.pdebuild.templates}/headless-build/customAssembly.xml" />
<!-- every time gather.bin.parts is called, we will record the project being built -->
<target name="gather.bin.parts" >
<echo append="true" file="${buildDirectory}/built.list"
message="**/${projectName}.jar${line.separator}" />
</target>
<target name="post.gather.bin.parts" >
<property name="signingArchive" value="${buildDirectory}/${buildLabel}/sign-${buildId}.zip" />
<zip zipfile="${signingArchive}" basedir="${p2.build.repo}"
includesFile="${buildDirectory}/built.list" />
<!-- sign! -->
<ant antfile="${builder}/sign.xml" dir="${basedir}" target="signMasterFeature" >
<property name="signingArchive" value="${signingArchive}" />
</ant>
<!--unzip signed archive over top of the repository -->
<unzip dest="${p2.build.repo}" src="${signingArchive}" />
<!--update repository with new checksums for signed bundles -->
<p2.process.artifacts repositoryPath="file://${p2.build.repo}" />
</target>
</project>
Unhandled event loop exceptionAs indicated in the Eclipse FAQ, there is a simple workaround for this problem, edit your eclipse.ini file and add -XX:MaxPermSize=256m below the -vmargs line:
PermGen space
-startup
plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-XX:MaxPermSize=256m
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
eclipse --launcher.openFile myFile.txt
This tells the launcher that if it is called with a command line that only contains arguments that don't start with "-", then those arguments should be treated as if they followed "--launcher.openFile"....
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
-vmargs
-Xms256m
-Xmx768m
eclipse myFile.txt
Relative paths will be resolved first against the current working directory, and second against the eclipse program directory.
<target name="postBuild">
<antcall target="gatherLogs" />
<!-- mirror from build results, comparing against previous builds that are in the composite repo -->
<p2.mirror>
<source location="file:${assemblyTempDir}/${buildLabel}"/>
<destination location="file:${builder}/composite/${buildLabel}"/>
<comparator comparator="org.eclipse.equinox.p2.repository.tools.jar.comparator" comparatorLog="${buildDirectory}/comparator.log">
<repository location="file:${builder}/composite" />
</comparator>
</p2.mirror>
<!-- add the new build to the composite -->
<p2.composite.repository destination="file:${builder}/composite">
<add>
<repository location="file:${builder}/composite/${buildLabel}"/>
</add>
</p2.composite.repository>
</target>
public void doSomething(List o) {
for (Iterator iterator = o.iterator(); iterator.hasNext();) {
super.doSomething(iterator.next());
}
}
public class B {
public void method() {
ArrayList list = new ArrayList();
list.add(this);
Sub d = new Sub();
d.doSomething(list);
}
}
[p2.mirror] Messages while mirroring artifact descriptors.
[p2.mirror] Compare and download of canonical: osgi.bundle,org.example.b,1.0.0 from baseline.
[p2.mirror] Difference found for org/example/b/B.class within [canonical: osgi.bundle,org.example.b,1.0.0]
from file:/C:/workspace/example.Builder/composite/I20090806060019/
<extension id="product" point="org.eclipse.core.runtime.products">
<product application="org.eclipse.ui.ide.workbench" name="ADT Product">
<property name="aboutText" value="Andrew's Development Tools"/>
<property name="windowImages" value="icons/icon.gif"/>
<property name="aboutImage" value="product.gif"/>
</product>
</extension>
requires.1.namespace = org.eclipse.equinox.p2.iu requires.1.name = org.eclipse.cvs.feature.group requires.1.range = [1.1.100, 1.2.0) requires.2.namespace = org.eclipse.equinox.p2.iu requires.2.name = org.eclipse.mylyn_feature.feature.group requires.2.range = [3.2.0, 3.3.0) ...
<target name="pre.archive">
<ant antfile="${genericTargets}" target="runDirector" inheritAll="true">
<property name="p2.repo" value="${p2.build.repo}"/>
<property name="p2.director.iu" value="org.eclipse.cvs.feature.group"/>
<property name="p2.director.installPath" value="${eclipse.base}"/>
</ant>
...
</target>
We make director calls for each of the sub components we allow to be updated. In the example we do CVS, Mylyn, CDT, and the CDT-Mylyn bridge.The delta pack is required if you want to do headless product builds, or to export products from the UI:

<patchScope>
<scope>
<requires size='1'>
<required namespace='org.eclipse.equinox.p2.iu'
name='org.eclipse.equinox.p2.user.ui.feature.group'
range='[1.1.0.v20090605-1440-7u6Fb3FbPbJP5MiKiZgpdl,1.1.0.v20090605-1440-7u6Fb3FbPbJP5MiKiZgpdl]'/>
</requires>
</scope>
</patchScope>
<changes>
<change>
<from>
<required namespace='org.eclipse.equinox.p2.iu'
name='org.eclipse.equinox.p2.touchpoint.eclipse'
range='0.0.0'/>
</from>
<to>
<required namespace='org.eclipse.equinox.p2.iu'
name='org.eclipse.equinox.p2.touchpoint.eclipse'
range='[1.0.101.v20090611,1.0.101.v20090611]'/>
</to>
</change>
</changes>
Say I have a feature that I build, it runs on top of the Eclipse Platform. I know Eclipse Galileo is coming out soon, so I download it and try it out with my feature.
Oh No! It doesn't work! I've found a bug in the platform, and its a major blocker for me. (Oops, maybe I should have tried this a couple of months ago when there still would have been time to fix the bug.)
Meta-Comment: The Eclipse Platform Project has a reputation for shipping on time (even if that means there are unresolved bugs). There is a strict end game plan that is followed for the release, lock down started back at the beginning of May. The further we are along in the plan, the harder it is to get a fix approved for release. A lot of people don't seem to relealize this happens, and perhaps wonder why their important bugs are defered with the comment "Its too late".
Ok, I need to patch the platform. How do I do this?
To work through the steps of patching the platform, I created my own example feature:
<feature id="org.example.feature" label="Feature" version="1.0.0.qualifier">
<includes id="org.example.patch" version="0.0.0" />
<plugin id="org.example.plugin" version="0.0.0" unpack="false"/>
</feature>
<feature id="org.example.patch" label="Patch" version="1.0.0">
<requires>
<import feature="org.eclipse.equinox.p2.user.ui" version="1.1.0.v20090605-1440-7u6Fb3FbPbJP5MiKiZgpdl" patch="true"/>
</requires>
<plugin id="org.eclipse.equinox.p2.touchpoint.eclipse" version="1.0.101.v20090611" unpack="false"/>
</feature>
<unit id='org.example.patch.feature.group' version='1.0.0' singleton='false'>
<patchScope>
<scope>
<requires size='1'>
<required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.equinox.p2.user.ui.feature.group' range='[1.1.0.v20090605-1440-7u6Fb3FbPbJP5MiKiZgpdl,1.1.0.v20090605-1440-7u6Fb3FbPbJP5MiKiZgpdl]'/>
</requires>
</scope>
</patchScope>
<changes>
<change>
<from>
<required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.equinox.p2.touchpoint.eclipse' range='0.0.0'/>
</from>
<to>
<required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.equinox.p2.touchpoint.eclipse' range='[1.0.101.v20090611,1.0.101.v20090611]'/>
</to>
</change>
</changes>
...
<requires size='2'>
<required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.equinox.p2.user.ui.feature.group' range='[1.1.0.v20090605-1440-7u6Fb3FbPbJP5MiKiZgpdl,1.1.0.v20090605-1440-7u6Fb3FbPbJP5MiKiZgpdl]' greedy='false'/>
...
<URL | simple bundle location>[@ [<start-level>] [":start"]]
configs = *,*,*If we had read the documentation, we would have seen that the archivesFormat is ignored for groups. However, this is not strictly true, and we can instead set a format for the group directly:
archivesFormat = *,*,*-zip
groupConfigurations = true
configs=*,*,*This results in the zip format as desired.
archivesFormat = group,group,group-zip
groupConfigurations = true
/builds/src/assemble.org.eclipse.sdk.tests.group.group.group.xml:257: The directoryThis turns out to be a rather old bug. The problem is that when features gather together the rootfiles they contribute, they copy them into platform specific folders. In this case, building the *,*,* configuration, the rootfiles were copied into tmp/ANY.ANY.ANY. However, because of the way the grouped configurations feature is implemented, the assembly scripts end up looking for the rootfiles in the group.group.group folder.
/builds/src/tmp/eclipse/group.group.group does not exist
<target name="pre.archive">
<!-- for each config being built -->
<move file="${eclipse.base}/ANY.ANY.ANY/${collectingFolder}"
todir="${rootFolder}" failonerror="false"/>
<move file="${eclipse.base}/win32.win32.x86/${collectingFolder}"
todir="${rootFolder}" failonerror="false" />
<move file="${eclipse.base}/linux.gtk.x86/${collectingFolder}"
todir="${rootFolder}" failonerror="false" />
</target>