[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.platform] Re: Extension points: get attributes info from definition
|
- From: deam_38@xxxxxxxx (deam)
- Date: Thu, 19 Apr 2007 07:14:29 +0000 (UTC)
- Newsgroups: eclipse.platform
- Organization: Eclipse
- User-agent: NewsPortal/0.36 (http://florian-amrhein.de/newsportal)
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