Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » IExecutableExtension data parameters
IExecutableExtension data parameters [message #495146] Tue, 03 November 2009 17:12 Go to next message
Howard Burgett is currently offline Howard Burgett
Messages: 12
Registered: November 2009
Junior Member
Hi,

I'm trying to develop a custom extension point such that the extension based upon the extension point can pass parameters at creation. I've implemented IExecutableExtension and I've been successful at getting a string passed as the data of the IExecutableExtension.setInitializationData(..), but I have not been successful getting a Map passed as data.

The Javadoc for IExecutableExtension.setInitializationData(..) describes how to do this as:

(2) by converting the attribute used to specify the executable extension to a child element of the original configuration element, and specifying the adapter data in the form of xml markup. Using this form, the example above would become

<action>
<run class="com.xyz.ExternalAdapter">
<parameter name="exec" value="./cmds/util.exe"/>
<parameter name="opt" value="3"/>
</run>
</action>

My custom extension point has been defined using this pattern, and the extension provides the data like above, but my data never gets passed. Am I missing something here? Is there some magic not mentioned in the Javadoc that must be defined for this to work? Does com.xyz.ExternalAdapter (in the example above) need to implement something else besides IExecutableExtension? Or do the <parameter> elements need to be defined in a special way?

Any help is appreciated Smile

Re: IExecutableExtension data parameters [message #495603 is a reply to message #495146] Thu, 05 November 2009 08:50 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

If one form is <run class="com.example.MyClass:what"/> then the other form would be:

<run>
<class class="com.example.MyClass">
<parameter name="why" value="what"/>
</class>
</run>

The class (not literally "class" though) attribute must become a child element. For more clarity, imagine that it was:

<run defaultHandler="com.example.MyClass:what"/>

becomes:

<run>
<defaultHandler class="com.example.MyClass">
<parameter name="why" value="what"/>
</defaultHandler>
</run>


PW


Re: IExecutableExtension data parameters [message #495618 is a reply to message #495603] Thu, 05 November 2009 09:19 Go to previous messageGo to next message
Howard Burgett is currently offline Howard Burgett
Messages: 12
Registered: November 2009
Junior Member
Thanks for the response!

What you described is exactly what I've done (sorry if this wasn't clear from my post).

The form: <run class="com.example.MyClass:what"/> works just fine, but the second form does not work for me. It's as if the <parameter> element is just ignored, and no data is sent in the ExecutableExtension.setInitializationData(..) call. That's what leads me to wonder if there is something about the construct missing.
Re: IExecutableExtension data parameters [message #495620 is a reply to message #495618] Thu, 05 November 2009 09:20 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Please show me the second form you've used, then.

PW


Re: IExecutableExtension data parameters [message #495657 is a reply to message #495620] Thu, 05 November 2009 11:20 Go to previous messageGo to next message
Howard Burgett is currently offline Howard Burgett
Messages: 12
Registered: November 2009
Junior Member
Here's what I have in my plugin.xml:

<extension  point="com.objectnexus.swtview.hello">
    <hello>
        <datamodel class="com.objectnexus.swtview.extensions.MyHello">
            <parameter
                  name="p1"
                  value="This">
            </parameter>
            <parameter
                  name="p2"
                  value="is">
            </parameter>
            <parameter
                  name="p3"
                  value="fun!!!">
            </parameter>
         </datamodel>
      </hello>
   </extension>

Re: IExecutableExtension data parameters [message #495704 is a reply to message #495657] Thu, 05 November 2009 14:36 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

And what's the short form that worked/still works?

PW


Re: IExecutableExtension data parameters [message #495741 is a reply to message #495146] Thu, 05 November 2009 16:27 Go to previous messageGo to next message
Howard Burgett is currently offline Howard Burgett
Messages: 12
Registered: November 2009
Junior Member
Here's the short form that works fine:

   <extension
         point="com.objectnexus.swtview.hello">
      <hello>
         <datamodel
               class="com.objectnexus.swtview.extensions.MyHello:This is fun!!">
         </datamodel>
      </hello>
   </extension>
Re: IExecutableExtension data parameters [message #495935 is a reply to message #495741] Fri, 06 November 2009 12:39 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Right, so you're not following my example:

<datamodel
class="com.objectnexus.swtview.extensions.MyHello:This is fun!!"/>

would become

<datamodel>
<class class="com.objectnexus.swtview.extensions.MyHello">
<parameter name="whatever" value="again"/>
</class>
</datamodel>

The attribute in the short form becomes a child element with an attribute class in the long form.

PW


Re: IExecutableExtension data parameters [message #496066 is a reply to message #495146] Sat, 07 November 2009 14:56 Go to previous message
Howard Burgett is currently offline Howard Burgett
Messages: 12
Registered: November 2009
Junior Member
Ahh, I see now. Thanks! That works.
Previous Topic:Version compatibility of plugin
Next Topic:change .metadata location
Goto Forum:
  


Current Time: Fri Jul 25 12:15:27 EDT 2014

Powered by FUDForum. Page generated in 0.01838 seconds