Sure, there is the description of different launchers in the Information center, but it only explains how to use urlLaunchItem, nativeProgramLaunchItem and perspectiveLaunchItem in detail.
So this article is for you out there searching Google for a how-to.
First define the Launcher in your plugin.xml:
(sorry Blogger didn't let me input XML here...)
Now this registers a new item (launchItem) and defines a launch item type (launchItemType) which gets invoked when clicking on it (see type attribute of launchItem and name atttribute of launchItemType).
The launchItemType invokes a class (see class attribute of launchItemType) which needs to be a subclass of com.ibm.rcp.ui.launcher.LauncherContributionItem (attention:
The referenced class in launchItemType itself should look like this:
package com.xyz;
public class MyLaunchItemTypeClass extends com.ibm.rcp.ui.launcher.LauncherContributionItem {
@Override
public void launch(int arg0) {
super.launch(arg0);
System.out.println("LAUNCHED!");
}
}
public class MyLaunchItemTypeClass extends com.ibm.rcp.ui.launcher.LauncherContributionItem {
@Override
public void launch(int arg0) {
super.launch(arg0);
System.out.println("LAUNCHED!");
}
}
also don't forget to put com.ibm.rcp.swtex and com.ibm.rcp.ui on your required bundles list in MANIFEST.MF.



By Far the Easiest help for Custom Launch Items, it was so much easier than the documentation.
AntwortenLöschenHave you thought about adding it to the Expeditor Wiki?
Paul Bastide