Resource path in an extension [message #308114] |
Wed, 13 September 2006 08:00  |
Eclipse User |
|
|
|
Hi,
I'm writing a new extension point for my own purpose. In the .exsd file,
I've defined a icon attribute like that:
<attribute name="icon" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="resource"/>
</appInfo>
</annotation>
</attribute>
When i read the extenstions registry to get contributors of my extension i
can get the icon path with success:
IExtension[] extensions = extPoint.getExtensions();
for(int i = 0; i < extensions.length; i++ )
{
IExtension extension = extensions[i];
IConfigurationElement[] elements = extension.getConfigurationElements();
for(int j = 0 ; j < elements.length; j++)
{
IConfigurationElement element = elements[j];
String iconPath=element.getAttribute("icon");
}
}
My problem is that iconPath contains the path of the resource but it is
relative to the plugin path where is was defined (ex :
resources/icons/icon.gif)
How can i "translate" this path to an absolute path so i can use it from
anywhere, in a LabelProvider for an example.
Thanks,
Nico.
|
|
|
|
|
|
Re: Resource path in an extension [message #308153 is a reply to message #308134] |
Thu, 14 September 2006 11:21  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
Also, you want getContributor() instead of getNamespaceName(). In
general they are the same, but namespace has been expanded to allow
extensions from several different plugins to be in the same "namespace".
While contributor is the plugin/fragment that had the actual extension
in it.
Nico wrote:
>> This makes me think of another thing which concerns translatable
>> strings in extension-points, you know those beginning with %. Is there
>> a way to have them automatically translated, or must i manually look
>> in plugin fragments for the correct plugin_$nl.properties file and
>> then look for the translation ?
>
>
> I should have tried if before asking the questions.... %strings are
> automatically translated when reading IConfigurationElement.
>
> Thanks again.
>
|
|
|
Powered by
FUDForum. Page generated in 0.04576 seconds