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:
One more Eclipse developer.
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.