Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Overriding the value of an attribute in plugin.xml(Overriding the value of an attribute in plugin.xml)
Overriding the value of an attribute in plugin.xml [message #702749] Tue, 26 July 2011 18:55 Go to next message
eclipsefan  is currently offline eclipsefan Friend
Messages: 11
Registered: June 2011
Junior Member
Hello Teachers!

I have defined a new extension point for example: com.test.ui.example.

In a plugin project called plugin_base, I have the following defined.

<extension point="com.test.ui.example">
<table name="Employee">
<field name="employee_name" value="John"></field>
</table>
</extension>

There is some piece of java code in this plugin_base project that will read this kind of an extension point and generate a SWT Text widget whose text value will be set to "John".

My requirement is to override this value ("John") in another plugin say plugin_child that depends on the plugin_base plugin. So basically what I want to do is, in the plugin_child project I would like to add the following :

<extension point="com.test.ui.example">
<table name="Employee">
<field name="employee_name" value="Mike"></field>
</table>
</extension>

and I expect the same java code to populate the SWT Text widget with "Mike" now.

Can this be achieved ? I did the following in my java code:

IConfigurationElement elements[] =
Platform.getExtensionRegistry().getConfigurationElementsFor("com.test.ui.example");

for(IConfigurationElement element:elements)
{
IConfigurationElement children[] = element.getChildren("field");

for(IConfigurationElement child:children)
{
System.out.println("Name:" + child.getAttribute("name") +
" Value: " + child.getAttribute("value"));
}
}

The result that I see during the SOP call is as below:

Name:employee_name Value: John
Name:employee_name Value: Mike

My expectation is only the following:
Name:employee_name Value: Mike

Please suggest if there is way to achieve this. I

Thanks & Regards.
(no subject) [message #703768 is a reply to message #702749] Wed, 27 July 2011 21:38 Go to previous messageGo to next message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 423
Registered: July 2009
Senior Member
Hi ??,

You just get all the contributions to your extension point but you have to
figure out yourself what is overriding what. How would the extension point
know that plugin_base is the base and plugin_child is the child. And even if
you could figure that out: What if you have two plugin_children? What will be
happening then?

Regards,

Wim


> Hello Teachers!
>
> I have defined a new extension point for example: com.test.ui.example.
>
> In a plugin project called plugin_base, I have the following defined.
>
> <extension point="com.test.ui.example">
> <table name="Employee">
> <field name="employee_name" value="John"></field>
> </table>
> </extension>
>
> There is some piece of java code in this plugin_base project that will read
this kind of an extension point and generate a SWT Text widget whose text
value will be set to "John".
>
> My requirement is to override this value ("John") in another plugin say
plugin_child that depends on the plugin_base plugin. So basically what I want
to do is, in the plugin_child project I would like to add the following :
>
> <extension point="com.test.ui.example">
> <table name="Employee">
> <field name="employee_name" value="Mike"></field>
> </table>
> </extension>
>
> and I expect the same java code to populate the SWT Text widget with "Mike"
now.
>
> Can this be achieved ? I did the following in my java code:
>
> IConfigurationElement elements[] =
>
Platform.getExtensionRegistry().getConfigurationElementsFor("com.test.ui.example");
>
> for(IConfigurationElement element:elements)
> {
> IConfigurationElement children[] = element.getChildren("field");
>
> for(IConfigurationElement child:children)
> {
> System.out.println("Name:" + child.getAttribute("name") +
> " Value: " + child.getAttribute("value"));
> }
> }
>
> The result that I see during the SOP call is as below:
>
> Name:employee_name Value: John
> Name:employee_name Value: Mike
>
> My expectation is only the following:
> Name:employee_name Value: Mike
>
> Please suggest if there is way to achieve this. I
>
> Thanks & Regards.
Re: (no subject) [message #704143 is a reply to message #703768] Thu, 28 July 2011 10:19 Go to previous messageGo to next message
eclipsefan  is currently offline eclipsefan Friend
Messages: 11
Registered: June 2011
Junior Member
Hi Wim -

That is exactly my case. I need to build something that can be customizable by the end user community and hence the question. I am unable to think as of now how to achieve it through plugin.xml or if it is really the right away. I think it is not, but I want to get second opinion from the teachers.

Thanks and Regards.
Re: (no subject) [message #704150 is a reply to message #704143] Thu, 28 July 2011 10:23 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Because OSGi is dynamic you can create an OSGi-Bundle on the fly and
install it into your running application.

If you use DS instead of plugin.xml you'll get the contributed services
injected and can update your UI. If a reconfiguration happens you can
update your bundle and get everything reinjected.

Tom

Am 28.07.11 12:19, schrieb eclipsefan:
> Hi Wim -
>
> That is exactly my case. I need to build something that can be
> customizable by the end user community and hence the question. I am
> unable to think as of now how to achieve it through plugin.xml or if it
> is really the right away. I think it is not, but I want to get second
> opinion from the teachers.
>
> Thanks and Regards.
Re: (no subject) [message #704445 is a reply to message #704150] Thu, 28 July 2011 16:26 Go to previous message
eclipsefan  is currently offline eclipsefan Friend
Messages: 11
Registered: June 2011
Junior Member
Tom - Thank you so much. I will try to follow the instructions and post my queries in case I face issues.

Basically I have a view. The content of this view is a driven by a model called "Employee". The employee has three fields namely: Name, ID and Address. When I ship my product I give it with the view having three labels each followed by a text widgets in the following manner:

Name :
ID:
Address:

However at the customer's end, they would want to add their own model to the same view instance. For example: They would want to inject "Person" to this view such that the following field appears:

PName :
PID:
SSN:

Thanks and Regards.
Previous Topic:Error:Transfer RCP project with Multi Page editor
Next Topic:OpenOffice in Eclipse RCP
Goto Forum:
  


Current Time: Thu Apr 25 09:33:12 GMT 2024

Powered by FUDForum. Page generated in 0.03518 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top