DevFaqHowToReuseModules

I want to reuse some of my modules in several RCP applications. How to do it?

Assuming you are using version 6.8 or later, this is supported by the module development infrastructure:

  1. Open Suite B in the IDE
  2. Right-click on Suite B in the IDE
  3. Click properties
  4. Click libraries on the left of the suite properties dialog
  5. Click 'Add project...' at the bottom of the suite properties dialog
  6. Locate the directory containing the source code for Suite A

You can then select which modules from suite A you want to include in suite B.

Source: posting by Tom Wheeler

I want to use modules from update center in my RCP applications. How to do it?

It's possible to use non-netbeans.org modules (yours or 3rd party) directly in your suite and perform this configuration via the GUI. To do this, go to the Properties of your suite project, Libraries tab:

Image:reuse-modules-1_DevFaqHowToReuseModules.png

If you have sources of modules you want to reuse, click Add Project... button and browse for the suite or standalone module project you want to add.

If you want to use 3rd party binary modules, just unpack them into a cluster folder somewhere on your disk. Preferably put the cluster under your suite's root so that you can use relative paths, which makes setup in a team environment easier. Then click the Add Cluster... button and browse for the cluster folder:

Image:reuse-modules-2_DevFaqHowToReuseModules.png

You can also add sources and/or Javadoc for binary modules, just like for the whole NetBeans Platform.

Once projects and clusters are added to Libraries and checked, they behave just like part of the platform. They will appear in running platform application, will be included in binary distribution, modules from your suite can depend on them, etc.

I cannot use 6.7 or newer platform, what to do?

You can actually use older platform as long as you configure it to use newer harness (either via Tools -> NetBeans Platforms in IDE or by specifying harness.dir) and you develop in new enough IDE.

If you cannot even use new harness and/or IDE, you have to use suite chaining, build your own platform and depend on it. See harness/README file for details. See also HowToReuseModules.

I want to use modules installed in my IDE in my RCP applications. How to do it?

First make sure that you have the IDE to install the downloaded plugins into shared directories. To do this go to Tool>Plugins then the Settings tab. Enable the check box at the bottom in the advance section. You might be warned about not having permission to save files into a location. Just make sure to run NetBeans as an administrator.

Now install the plugins you are interested in (using the Update center or manual install). They'll be installed in a different place within the NetBeans platform depending on the classification of the plugin. Verify in the platform, you might have a new cluster named extra.

See also

Using an Update Center for a Stand Alone Module

This was suggested as a patch but rejected (https://netbeans.org/bugzilla/show_bug.cgi?id=185283)

Add the following to the module's build.xml file:

<target name="create-update-center" depends="harness.taskdefs, nbm">
        <mkdir dir="${update.dir}"/>
        <pathfileset id="updater.jar">
            <path refid="cluster.path.id"/>
            <filename name="modules/ext/updater.jar"/>
        </pathfileset>
        <makeupdatedesc desc="${update.dir}/updates.xml" distbase="."
automaticgrouping="true" uselicenseurl="${use.license.url.in.catalog}">
            <fileset dir="./build">
                <include name="*.nbm"/>
                <include name="*.jar"/>
            </fileset>
            <updaterjar>
                <resources refid="updater.jar"/>
            </updaterjar>
        </makeupdatedesc>
        <!--Copy the files to the folder-->
        <copy todir="${update.dir}">
            <fileset dir="./build">
                <include name="*.nbm"/>
                <include name="*.jar"/>
            </fileset>
        </copy>
    </target>

This will create an update center for the stand alone module!

Note: Nothing magic about it. Just used the Netbeans task makeupdatedesc. Feel free to change the target name and change ./build with something smarter (I couldn't find a pre-defined variable for that in the stand alone modules).

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo