'. '

NetbinoxTutorial

From APIDesign

(Difference between revisions)
Jump to: navigation, search
(Develop!)
(Setup Development!)
Line 23: Line 23:
or, you can extract the [[ZIP]] file and start '''bin/netbeans'''. [[NetBeans]] IDE optimized for development against [[Equinox]] is started.
or, you can extract the [[ZIP]] file and start '''bin/netbeans'''. [[NetBeans]] IDE optimized for development against [[Equinox]] is started.
-
==== Setup Development! ====
+
==== Clusterize [[Mylyn]] ====
-
First thing to do is to create a platform based application. Choose from menu ''File/New Project''. Select NetBeans Modules/NetBeans Platform Application''. Select root node of the created project, invoke pop-up menu and choose ''Properties''. There is a button ''Add Cluster'' in the ''Libraries'' category, we will use it to add [[Eclipse]] as a cluster (e.g. bunch of modules or bundles ready for development).
+
Download our [http://source.apidesign.org/hg/netbinox-mylyn-sample sample application] that uses [[Mylyn]] (written as set of [[OSGi]] bundles) to connect to [[Bugzilla]].
-
First of all you need to ''clusterize'' your [[Eclipse]] installation. Go to command line, change your current directory to root folder of such installation and invoke:
+
<source lang="bash">
 +
hg clone http://source.apidesign.org/hg/netbinox-mylyn-sample
 +
</source>
-
{{{
+
The root of the sources contains folder eclipse which contains some [[OSGi]] [[JAR]] libraries in raw form - e.g. just copied from [[Eclipse]] installation. The first thing to help [[Netbinox]] to use them is is to ''clusterize'' them. Invoke:
-
/space/eclipse$ ant -f $netbinox/harness/suite.xml clusterize -Dcluster=`pwd` -Dincludes=plugins/*
+
-
}}}
+
-
Notice that a bunch of [[XML]] configuration files has been created in ''config/Modules'' directory. These help [[Netbinox]] recognize bundles present in each cluster. Now you can return back to the IDE's configuration dialog and invoke ''Add Cluster'' and provide path to your clusterize [[Eclipse]] installation. Once the cluster is provided, finish the dialog.
+
<source lang="bash">
 +
$ ant convert -Dharness.dir=$NETBINOX/harness
 +
 
 +
clusterize:
 +
[mkdir] Created dir: /netbinox-mylyn-sample/eclipse/config/Modules
 +
[createmodulexml] Autoload modules: [org.apache.commons.codec, org.apache.commons.httpclient, org.apache.commons.lang, org.apache.commons.logging, org.eclipse.core.contenttype, org.eclipse.core.jobs, org.eclipse.core.net, org.eclipse.core.runtime, org.eclipse.equinox.app, org.eclipse.equinox.common, org.eclipse.equinox.preferences, org.eclipse.equinox.registry, org.eclipse.equinox.security, org.eclipse.mylyn.bugzilla.core, org.eclipse.mylyn.commons.core, org.eclipse.mylyn.commons.net, org.eclipse.mylyn.tasks.core]
 +
</source>
 +
 
 +
The ''$NETBINOX'' variable shall point to the location where you unzipped the [[Netbinox]] [[ZIP]].
 +
 
 +
Notice that a bunch of [[XML]] configuration files has been created in ''config/Modules'' directory. These help [[Netbinox]] recognize bundles present in each cluster.
 +
 
 +
==== Develop with [[Mylyn]] ====
 +
 
 +
The next step is to start the [[Netbinox]] IDE and open ''mylyn-suite'' project (which is the next directory in the sample along the eclipse one). If you open project customizer you can verify that there is a cluster called ''eclipse'' which enlists all the modules prepared in the previous step.
==== Develop! ====
==== Develop! ====

Revision as of 04:08, 20 October 2009

Contents

It is easy to start!

Here is a quick tutorial to get you up to the speed using Netbinox. You can either build the GPL sources of the bridge between NetBeans and Equinox yourself or download the binaries.

Get the bits!

To build from the sources:

  1. hg clone http://source.apidesign.org/hg/netbinox
  2. cd netbinox
  3. ant

This will create a ZIP file in dist directory with Netbinox IDE - e.g. NetBeans platform and IDE ready to empower Equinox. Alternatively you can download the binaries directly from the daily builder.

Warning and TBD: right now download the ZIP from the builder!

Execute!

Now it is time to start the system. You can do it via ant by running

ant run

or, you can extract the ZIP file and start bin/netbeans. NetBeans IDE optimized for development against Equinox is started.

Clusterize Mylyn

Download our sample application that uses Mylyn (written as set of OSGi bundles) to connect to Bugzilla.

hg clone http://source.apidesign.org/hg/netbinox-mylyn-sample

The root of the sources contains folder eclipse which contains some OSGi JAR libraries in raw form - e.g. just copied from Eclipse installation. The first thing to help Netbinox to use them is is to clusterize them. Invoke:

$ ant convert -Dharness.dir=$NETBINOX/harness
 
clusterize:
    [mkdir] Created dir: /netbinox-mylyn-sample/eclipse/config/Modules
[createmodulexml] Autoload modules: [org.apache.commons.codec, org.apache.commons.httpclient, org.apache.commons.lang, org.apache.commons.logging, org.eclipse.core.contenttype, org.eclipse.core.jobs, org.eclipse.core.net, org.eclipse.core.runtime, org.eclipse.equinox.app, org.eclipse.equinox.common, org.eclipse.equinox.preferences, org.eclipse.equinox.registry, org.eclipse.equinox.security, org.eclipse.mylyn.bugzilla.core, org.eclipse.mylyn.commons.core, org.eclipse.mylyn.commons.net, org.eclipse.mylyn.tasks.core]

The $NETBINOX variable shall point to the location where you unzipped the Netbinox ZIP.

Notice that a bunch of XML configuration files has been created in config/Modules directory. These help Netbinox recognize bundles present in each cluster.

Develop with Mylyn

The next step is to start the Netbinox IDE and open mylyn-suite project (which is the next directory in the sample along the eclipse one). If you open project customizer you can verify that there is a cluster called eclipse which enlists all the modules prepared in the previous step.

Develop!

Time to create your first bundle or module! Choose from menu File/New Project and select OSGi bundle. New project is created and added into the already existing suite. Choose its Properties and select Libraries category. There is a button Add Dependency. Invoke it and choose your favorite Eclipse bundle.

My favourite one is org.eclipse.mylyn.bugzilla.core. Add it into the list of dependencies of your bundle. Finish the dialog, select package in your project and create a class. Start to code and you can find classes from the bugzilla.core bundle. Refer to them, use them. Small example:

public class Installer implements BundleActivator {
  public void start(BundleContext c) throws Exception {
    System.err.println("before");
    try {
        org.eclipse.mylyn.internal.bugzilla.core.BugzillaClientFactory.createClient(null);
    } catch (NullPointerException ex) {}
    System.err.println("after");
  }
}

Deploy!

Just choose Run/Run Main Project from the menu and your application is started. The system launches both the traditional NetBeans Runtime Container as well as Equinox and both cooperate with each other having their usual environment around themselves (more about that is explained in Netigso article).

Personal tools