Extension points: get attributes info from definition [message #314514] |
Mon, 16 April 2007 11:35  |
Eclipse User |
|
|
|
Originally posted by: deam_38.yahoo.fr
Hi,
If I define an extension point like this (Extension Point Creation Wizard):
- extension
'----- sequence
' '-----myPoint (1-*)
'----- point
'----- id
'----- name
- myPoint
'----- id (type = string)
'----- class (type = java)
'----- icon (type = resource)
'----- info (type = string)
If class is the user defined class (name) which extends an abstract class
(MyClass) that I defined.
I would like to know how can I get the informations entered by the user of
my extension point (id, icon, info) from the source code of the abstract
class (MyClass).
Thank you for any help.
And if you have links to any interresting documents about extension
points...
|
|
|
|
Re: Extension points: get attributes info from definition [message #314648 is a reply to message #314584] |
Thu, 19 April 2007 03:14  |
Eclipse User |
|
|
|
Originally posted by: deam_38.yahoo.fr
deam wrote:
> deam wrote:
>> Hi,
>> If I define an extension point like this (Extension Point Creation Wizard):
>> - extension
>> '----- sequence
>> ' '-----myPoint (1-*)
>> '----- point
>> '----- id
>> '----- name
>> - myPoint
>> '----- id (type = string)
>> '----- class (type = java)
>> '----- icon (type = resource)
>> '----- info (type = string)
>> If class is the user defined class (name) which extends an abstract class
>> (MyClass) that I defined.
>> I would like to know how can I get the informations entered by the user of
>> my extension point (id, icon, info) from the source code of the abstract
>> class (MyClass).
>> Thank you for any help.
>> And if you have links to any interresting documents about extension
>> points...
> I did find a way to answer to my problem but it musn't be THE good way
> since I use internal / deprecated methods. I've added the following piece
> of code in the start() method of my plugin Activator.
> ***********************************
> IExtensionPoint[] extensionPoints = getDescriptor().getExtensionPoints();
> ViewRegistry viewRegistry =
> (ViewRegistry)getWorkbench().getViewRegistry();
> for(IExtensionPoint extensionPoint : extensionPoints){
> IConfigurationElement[] configurationElements =
> extensionPoint.getConfigurationElements();
> for(int i=0; i<configurationElements.length; i++){
> String[] attributeNames = configurationElements[i].getAttributeNames();
> String class = configurationElements[i].getAttribute("class");
> String icon = configurationElements[i].getAttribute("icon");
> String info = configurationElements[i].getAttribute("info");
> }
> }
> ***********************************
> After that, the 3 variables (class, icon, info) have the value that the
> user which implements my extension point did enter in its plugin.xml file
The following article explains just what I was looking for :
http://www.eclipse.org/articles/Article-Plug-in-architecture /plugin_architecture.html
esspecialy in the following section:
3.1. Obtaining References to the Extensions of an Extension-Point
|
|
|
Powered by
FUDForum. Page generated in 0.11373 seconds