The PbO Eclipse Plugin

The PbO Eclipse Plugin is an Eclipse plugin developed to help the PbO developer develop software in the Eclipse Indigo IDE. The plugin offers typical features that you would expect from an Eclipse IDE: syntax highlighting, source code folding and an outline view for PbO constructs.

The current supported languages are C and C++. The installation of the plugin occurs in four easy steps:

If the plugin is already installed and you just need to update the plugin, follow this easy step:

This guide will also show you how to set up an example hello world project which will go through the steps of

Skip to the FAQ

Installation

If you've already installed the plugin, and just need to do an update, click here

Downloading Eclipse Indigo

The only currently support version of Eclipse is Eclipse Indigo which can be found here

We are working towards supporting Eclipse Juno

Defining the PbO Eclipse p2 site

In the Eclipse IDE, go back to Help -> Install New Software. Click the Add... button to open the dialog to specify a new package site.

Under "Name", enter "PbO Plugin", and under "Location" enter "http://www.cs.ubc.ca/~hoos/PbO/Plugin" like shown and click OK

You should now have a new update site available from the drop down menu. Select the "PbO Plugin" update site

Installing the PbO Plugin

Check the "PbOPlugin" box under the PbOEclipsePlugin category and click Next

WARNING: Do NOT select both PbOPlugin and PbOPatch. This will lead to an awkward install state where both plugins will need to be uninstalled, and the process will need to be restarted from this step

Click Next on the Install Details screen

Click "I accept the terms of the license of the agreement" and click Finish

Click OK on the security warning

You will then have to restart Eclipse to load the plugin

Installing the PbO Patch

Once again, navigate to Help->Install New Software... and select the PbO Plugin update site

Open the PbOEclipsePlugin category and click the PbOPatch box and follow the installation steps just like above.

Once the plugin has installed successfully, you are now ready to write your very first PbO-C or PbO-C++ Program

Updating the plugin

Updating the plugin is a very simple process. From the Help menu, clicking on "Check for Updates" will start the process.

Unlike when installing the plugin for the first time, where both plugin features must be installed in separate steps, both plugin features can be installed at the same time

Click next and accept the agreement as before

Click next and click OK on the security warning

Restart Eclipse when the prompt appears and you're done

Setting up a Project

This tutorial assumes that you've decided to work in C. It will then guide you through the steps needed to create your very own Hello World PbO C project.

Creating a PbO C Hello World project

Creating a PbO C Project has the same first step as creating a normal C project

Name the project HelloWorld and click Finish

Adding a source folder

Create the "src" folder to hold the project's source files

Adding your first PbO-C source file

Once the src folder has been created, we can start adding PbO-C sources to the project

Create a file under src called "HelloWorld.pbo-c"

Open the new source file and enter:



//-------------------------------------------------------
// Example of how to use choices in PbO
// 
// Written by: Quinn Hsu
// Simply prints out 'Hello World' in various languages
//-------------------------------------------------------

#include <stdio.h>

int main(char** args, int argv) {

##BEGIN CHOICE language=en
	printf("%s","Hello World!");
##CHOICE language=ch
	printf("%s","Ni hao shi jie");
##CHOICE language=fr
	printf("%s","Bonjour le monde!");
##END CHOICE language

}

This is the Hello World C example from the PbO website. Once entered, your editor should look like this:

Building and running Hello World

NOTE: By default, Eclipse sets the project's default to "Build Automatically". This weaves the PbO sources, but does not compile or build the executable.

Building this simple project is easy, just click on the build button

If the project built successfully, then a new Debug folder should have been created. Inside the Debug folder should be the Hello World executable

Click on the Run dropdown menu and click "Run Configurations"

Double-click "C/C++ Application" and click on the "Arguments" tab

In the "Program arguments:" text book, enter "--language=en", "--language=fr", or "--language=ch" to specify the various values that the language CHOICE can take and click Run.

After building the project, you should get the output from the Hello World program!

FAQ