[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [pde-ui-dev] Extracting information from plugin.xml
|
Here is an example (using all internal classes):
WorkspaceModelManager manager =
PDECore.getDefault().getWorkspaceModelManager();
// Given a project in the workspace, get its corresponding model.
IModel model = manger.getWorkspaceModel(project);
// if the project was a plugin/fragment project
if (model != null && model instanceof IPluginModelBase) {
// get the object representing the content of the
plugin.xml/fragment.xml
IPluginBase plugin = ((IPluginModelBase)model).getPluginBase();
// get the extensions
IPluginExtension[] extensions = plugin.getExtensions();
for (int i = 0; i < extensions.length; i++) {
// how to get the name of the extension point it corresponds to
String point = extensions[i].getPoint();
// Content of extensions is arbitrary as it varies from
extension to extension depending on extension point schema
// Use generic methods to access the XML children
IPluginObject[] children = extensions[i].getChildren();
// loop through the children.
}
}
Wassim Melhem
(Embedded image moved to file: pic30247.gif) Wassim Melhem
Staff Software Developer, The Eclipse Project
IBM Toronto Laboratory
8200 Warden Ave, Markham, ON L6G 1C7
Internal Mail: D2/R0Q/8200/MKM PWA: 343
Phone: 905-413-2620 T/L: 969-2620 Fax: 905-413-4854
email: wassimm@xxxxxxxxxx
Rajeev Sikka
<sikkar@xxxxxxxxx
m> To
Sent by: pde-ui-dev@xxxxxxxxxxx
pde-ui-dev-admin@ cc
eclipse.org
Subject
Re: [pde-ui-dev] Extracting
03/02/2004 09:22 information from plugin.xml
PM
Please respond to
pde-ui-dev
Hi Dejan,
I tried a couple of appraches using some functionality (internal) in PDE
core:
Approach 1:
===========
I got all the models (plugin.xmls in the workspace) and then got a pointer
(IPluginExtension) to the particular extension that I am interested in.
However, I cannot find any functionality to get information from inside the
<extension ... </extension> tag.
Approach 2
===========
I got the WorkspacePluginModel corresponding to the plugin.xml. There is a
function - getContents() on WorkspacePluginModel that I thought I would
return me the full plugin.xml in String format from which I could extract
info that I needed using String manipulation functions. But getContents()
returned "".
Could you give me any pointers as to how to go about from this point to get
information about the class.
Thanks
Rajeev
Dejan Glozic
<dejan@xxxxxxxxxx> To: pde-ui-dev@xxxxxxxxxxx
Sent by: cc:
pde-ui-dev-admin@eclipse.o Subject: Re: [pde-ui-dev]
rg Extracting information from plugin.xml
03/02/2004 04:25 PM
Please respond to
pde-ui-dev
Rajeev,
PDE does have a model of the world in the workspace, but it is not public
(note that 'internal API' do not exist in Eclipse - things are either API
or internal :-).
Regards,
Dejan Glozic, Ph.D.
Manager, Eclipse Development 1A
D2/R0Q/8200/MKM
IBM Canada Ltd.
Tel. 905 413-2745 T/L 969-2745
Fax. 905 413-4854
Rajeev Sikka
<sikkar@xxxxxxxxx
m> To
Sent by: pde-ui-dev@xxxxxxxxxxx
pde-ui-dev-admin@ cc
eclipse.org
Subject
[pde-ui-dev] Extracting information
03/02/2004 02:50 from plugin.xml
PM
Please respond to
pde-ui-dev
Hi,
I have a requirement where I need to extract information from thr
plugin.xml corresponding to a plugin project thats still being developed
i.e. a plugin thats in the workspace and has NOT been deployed yet.
The situation is similar to the Hello World plugin. When you create the
HelloWorld plugin the user provides the name and location of the action
class. Here is a snippet of the plugin.xml:
<action
label="&Sample Action"
icon="icons/sample.gif"
class="hello.actions.SampleAction"
tooltip="Hello, Eclipse world"
menubarPath="sampleMenu/sampleGroup"
toolbarPath="sampleGroup"
id="hello.actions.SampleAction">
</action>
I want to extract the string corresponding to the class tag i.e.
"hello.actions.SampleAction" in this case.
Are there any public (or internal) APIs in the PDE that can be used to do
this (or is there any alternate way to do this) ?
Thanks,
Rajeev
_______________________________________________
pde-ui-dev mailing list
pde-ui-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/pde-ui-dev
Attachment:
pic30247.gif
Description: GIF image