[resolved] Create custom action for a button on the component

Five Stars

[resolved] Create custom action for a button on the component

Hello,
So there was this old thread: http://www.talendforge.org/forum/viewtopic.php?id=9439 That I managed to answer yesterday.
Since I feel that my post was just a beginning of something bigger I'd like to open a new topic, where I can post my additional findings.
Here's my original answer to that topic: (feel free to make it nicer)

So far the following seems to work:
This is based on the ssps extension, that I used as a base. Why? because it has 2 parameters on the GUI, and it "just" parses a file into talend metadata.

Getting started:

First of all we need an eclipse development environment. The following guide is accurate and okay. (Don't worry, we won't run Talend from SVN)
Then we need to create our own extension.
Same apply as for the components: Use an existing one as a base.
Without going into deep techincal details: We have an interface and a java program. The java program has a main( String args) function that is triggered from the gui.
Setting up the component:
you need to add the following entries int your component:
To the HEADER  tag insert: EXTENSION="org.talend.designer.plsap"
So it will look like: <HEADER EXTENSION="org.talend.designer.plsap" PLATEFORM="ALL" .... >
Also we need a custom button in the component XML:
<PARAMETER NAME="MAP" FIELD="EXTERNAL" NUM_ROW="89">
<DEFAULT />
</PARAMETER>

Creating the extension JAR!

Before we start we need to edit the manifest file:
A custom ID is a must, as well as the right configuration of the Extension tab.
Now lets install it, for this we need a JAR file. This was the tricky part for me (I've spent a total like 4-5 hours to get the whole working, this includes the SVN checkout as well):
When you export your extension don't go straight to the finish.
Click Next-Next until you reach the manifest part:
Here you need to add the components manifest file, not a file that was generated by eclipse.

Installing the extension JAR!

Go to the talend installation where you want to apply this "extension".
The exported jar should go under the plugins folder.
Locate the following file:
features\org.talend.tos.components-feature_5.4.1.r111943\features.xml
Here I added the following entry:
   <plugin
         id="org.talend.designer.plsap"
         download-size="0"
         install-size="0"
         version="5.4.1.r111943"
         unpack="false"/>
In case of Talend Enterprise, create an extrabundles.info file under:<studio>\configuration\org.talend.configurator
Content should be:    org.talend.designer.plsap,5.4.1.r111943,plugins/org.talend.designer.plsap_5.4.1.r111943.jar,4,false
 Delete the following folders:
a.  <studio>\configuration\org.eclipse.core.runtime
b.  <studio>\configuration\org.eclipse.equinox.app
c.  <studio>\configuration\org.eclipse.osgi
d.  <studio>\configuration\org.eclipse.update
You're done!

Whenever you click that button on the GUI the java program will be called, and it can get / set the parameters of your component.
I still have a few to do / check:

I'm not sure if the parameter NAME= value is passed or not.
I'm not sure if we can start any kind of external java program.

Troubleshooting:

Talend fails to load the component: Make sure you use the same version in the features.xml that you used in the plugin.xml

Happy Coding Smiley Wink
#20150325 Edit: Added the required steps for Talend Enterprise! Credit goes for Irshad Burtally.
Seventeen Stars

Re: [resolved] Create custom action for a button on the component

Well done! Thanks for sharing this!
One Star

Re: [resolved] Create custom action for a button on the component

Hi,
Is it possible to have two buttons? I did not found an example which has 2 extensions added in the HEADER tag.
Did you manage to get the parameter name?
Thanks,
Mada
One Star

Re: [resolved] Create custom action for a button on the component

Hi,
I am trying to create a custom component by extending the functionality of the tESBConsumer component. I am able to create the component and it is visible on the design palette as well but when I drag the component to the design area and double click on it or click the service configuration button (the button which pops up the web service configuration settings to specify the WSDL) nothing happens. I see the engine initialization message in the bottom right corner of the design studio but nothing happens after that. I see no errors.
As I created this new component reusing the existing one (tESBConsumer), do I still need to follow this procedure and add a new extension? Or it is not needed as the original component is already linked to required plugin.
Is there any documentation somewhere which explains the concept of Plugins, External Field Type and the Header Extension property?
Thanks,
Dhruv