Posts

Showing posts from 2011

No error dialogs in eclipse headless test

Here's a small funny thing I learned a while ago while running GUI tests of Eclipse application and now stumbled upon it again. When running Eclipse tests headlessly, certain dialogs don't show up as they would normally (e.g. when writing/recording the test). This is because of flags: org.eclipse.jface.dialogsErrorDialog.AUTOMATED_MODE = false; org.eclipse.jface.util.SafeRunnable.setIgnoreErrors(true); So if you for example have a test scenario that DOES expect an error dialog to show up, make sure you have above flags set correctly, or find out a different assertion than waiting for an error dialog.

Orion PHP Support demo

Image
If you're following Eclipse planet , you couldn't have missed Karol Gusak's weekly status reports about PHP support that's being built for Orion. If you still haven't tried PHP in Orion yourself, here's a little demo now on YouTube that nicely shows syntax highlighting, content-assist as well as overall PHP experience in Orion. Click below to check it now.

Making extensible GUI with org.eclipse.ui.menus

Image
It's actually first time I had to make a custom part of GUI extensible. In an Eclipse forms editor like following, we wanted custom actions to come from various plugins: Since eclipse APIs provides this sort of extensibility with their org.eclipse.ui.menus extension point, I looked at how to reuse that mechanism. It turns simple. All you need to do is, while creating the editable area, add: final Composite parent = ... // that's the area we want to make extensible ContributionManager contributionManager = new ContributionManager() { public void update(boolean force) { for (IContributionItem item : items) { item.fill(parent); } } }; IMenuService service = (IMenuService) getSite().getService(IMenuService.class); contributionManager.add(new GroupMarker("testing")); service.populateContributionManager(contributionManager, "toolbar:org.zend.editor1?after=testing"); contributionManager.update(false); Now to contribute something to that area, you

Starting and immediately using OSGi bundle: possible?

Lately I had this little thing to do: an OSGi bundle (SuperTool) comes with some other OSGi bundle (GreatSdk) included. SuperTool depends on logic in GreatSdk so the first thing it needs to do during activation is to install GreatSdk and immediately after that start loading classes from GreatSdk. At first thought it seems logical to make SuperTool-GreatSdk dependency optional, to let SuperTool install and start safely without GreatSdk. Once installed, during startup SuperTool should install GreatSdk and start using it, for example: BundleActivator.start(BundleContext context) { greatSdk = context.installBundle("file:///path/to/great.sdk_1.0.0.jar"); greatSdk.start(); GreatSdkStarter gss = new GreatSdkStarter(); // separate class in SuperTool that references some classes from GreatSdk gss.start(); // creates some GreatSdk classes } Unfortunately this fails in gss.start() with ClassNotFoundException: java.lang.ClassNotFoundException: greatSdk.Sdk at org.eclipse.osgi.internal.lo

Installing V8Cgi on Mac

V8CGI is a very thin Apache module encapsulating V8 - Google's JavaScript engine that's used e.g. in Google Chrome. Those concerned with NodeJS stability may consider V8CGI a better choice, thanks to stability provided by Apache base. A short while ago, on DevMeetings.pl DevCamp we've been playing with V8CGI, RingoJS and Node. Thanks to good performance , intuitive and high quality APIs , V8CGI turned out to be the black horse of the whole event, although installing it on Macs was little tricky. Readers with Windows and Linux should follow to V8CGI home page , where they can get precompiled Windows binary and learn how to install binary on Ubuntu . Mac users, let's open terminal and try to build the V8 apache module ourselves. Getting V8CGI to work is four steps: 1. Getting the source code 2. Building it 3. Configuration 4. Test drive 1. Getting the source code When checking out sources from SVN, we actually need two packages V8 and V8CGI: a) svn checkout http://v8cgi

Search by multiple keys in CouchDB

While developing a simple Twitter clone on V8CGi + CouchDB stack, we faced an interesting problem. We have a CouchDB database with users and messages. Each user has many followers and he'd like to see messages from all these followers. So we need to query tweets database for all documents that have author belonging to the list. In SQL it's something as simple as: SELECT * FROM tweets WHERE author IN ("szymon", "wiktor", "marek") SORT BY timestamp; In CouchDB it turned out to be an open issue https://issues.apache.org/jira/browse/COUCHDB-523 As far as I remember we ended up with running two separate queries. I'd be happy to hear how others solved this!

Signing firefox extensions

Signing FF extensions is pretty straightforward. Lately I've been going through some strains related to them, so I thought I'd share lesson learned. You have two sides that need to match with each other: online update URL and extension itself. Online update URL is a single file - update.rdf. Extension is an XPI file, with install.rdf file inside. Update.rdf contains a list of available extensions. Each extension should have checksum information, e.g. in sha1 algorithm. Once update.rdf is complete with all information and checksums, it must be signed with signer key. Note that, every time you change any of extension, it's checksum will likely change and so you need to update and re-sign update.rdf as well. On the other side, the install.rdf included in our XPI file needs to have our public key. Once you create install.rdf and put public key there, you can forget about it. XPI file does not have any checksum or signing. This all sounds nice and well but sometimes it doesn'

Building Windows installer with WiX

WiX is Windows Installer XML (WIX) Toolset. It's an open source project coming from Microsoft. Actually, it was the first project that Microsoft has officially published under Open Source license. Initially it appeared on SF.NET, but recently has moved to Microsoft's owned CodePlex.com. Half of the internet still points to SF though. This tool let's you pack a bunch of files into a user-friendly MSI installer, including GUI, silent install, repair, windows registry editing and Start menu customizations. WiX is a bunch of cool ideas. The first one goes with the each tools names. There's Heat, Candle and Light. They act as preprocessor, linker and compiler. So no matter whether you know everything about compilers, or you always left it to the IDE - tools seem friendly from the very first look. As name says it, the spine of the toolset is XML. To turn on the heat, developer needs to specify files to install, user interface, user interactions, install steps, resources and c

Two Eclipse p2 repository operations to make you happy

On the integrations side of the Eclipse business I often happen to need two things: 1. add a random OSGi jar to repository 2. copy from one repository to another Looking thru p2 manual it's not always entirely obvious how to do it, so here goes my take on the subject. All my automation uses Ant, so I'll speak a bit of Ant now: 1. Add a random OSGi jar to repository <p2.publish.featuresAndBundles repository="file:/path/to/destination/repository" e.g. ${buildDirectory}/repo publishArtifacts="true" compress="true" append="true" source="/absolute/path/to/folder/with/jar" /> Few notes: 1. source attribute must be an absolute path. 2. source path must contain "features" and "plugins" directories. So if you have only one bundle, make sure to put it under plugins dir first. 3. make sure repository attribute is a URL, not plain path 2. Copy from one repository to another <p2.mirror verbose=&quo

Extending Eclipse Orion

Image
Yesterday Eclipse E4 team announced Orion - an experimental Eclipse Web IDE. There's plenty of information about the project on Orion wiki . Orion is a set of JavaScript and HTTP APIs that simplify common development part of rich applications, like file storage, preferences, authentication, dialogs, selection. Since it's coming from Eclipse, Orion is skewed towards IDE development, so from start it also includes text editor with some decent features, like JavaScript syntax highlighting and JSLint integration. The project may go towards strengthening it's JS IDE feature set, as well as enhancing it's core side - extensibility, client APIs ...or do it all at once. In any case it's going to be fascinating journey! So how to extend Orion? One can re-implement existing HTTP API in language other than Java; add more HTTP APIs, e.g. for task management, calendar, etc. Same with JavaScript API - it seems fairly easy to add more. Looking at this from classic Eclipse adopter