Home » Eclipse Projects » Plugin Development Environment (PDE) » Programmatically add an extension to a plug-in
| | | | |
Re: Programmatically add an extension to a plug-in [message #510083 is a reply to message #510066] |
Tue, 26 January 2010 14:02 |
Louis Rose Messages: 440 Registered: July 2009 Location: York, United Kingdom |
Senior Member |
|
|
Great, thanks Steffen.
Steffen Zschaler wrote on Tue, 26 January 2010 07:55 | Hi,
That's what I've been doing in some project that generated plugin
projects. As long as you have the plugin manifest builder associated
with that plugin project, saving plugin.xml seems to lead to
recompilation and correct reconfiguration of the project's metadata.
Steffen
On 26/01/2010 09:09, Louis Rose wrote:
> Hi Steve,
>
> That'd be great, thanks. I'm tempted to simply generate a plugin.xml
> file, as we will always be generating a new project from scratch. If
> this would be helpful for you, I can share the code?
>
> Cheers,
> Louis.
|
|
|
| |
Re: Programmatically add an extension to a plug-in [message #510336 is a reply to message #510103] |
Wed, 27 January 2010 10:09 |
Steffen Zschaler Messages: 266 Registered: July 2009 |
Senior Member |
|
|
Hi Steve,
But you could parse the plugin.xml, extend the AST and print it back as
an XML file, couldn't you?
I'm assuming that we are talking about a project open in the workspace
here, rather than a plugin deployed into the system?
Steffen
On 26/01/2010 14:42, Steve wrote:
> Louis,
> Thanks, but my case is a bit different. I need to update an existing
> plug-in project. I am able to get the model and add the extension if
> it that extension does not already exist. But, if I try to add an
> element (IPluginElement) to an existing extension I get the read-only
> exception.
> Thanks,
> Steve
|
|
|
Re: Programmatically add an extension to a plug-in [message #513206 is a reply to message #510336] |
Tue, 09 February 2010 11:19 |
Vijay Raj Messages: 608 Registered: July 2009 |
Senior Member |
|
|
If Steve is talking about adding and extention in a project open in workspace...
Then it should be possible because PDE does that only...
But if steve is talkin about plugins deployed into the system
Then...
@Steve
Why do you need to add extensions programmatically??
There is somthing seriously wrong with your design or what ever you are trying to do....
(pardon me for being so vague)
If your info or what ever you are going to do is decided at runtime,
then creating extention points for the task and adding them at runtime is like touching your nose from all the way around your head....
Can you please explain your implemention a bit...
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
[Updated on: Wed, 10 February 2010 07:40] Report message to a moderator
|
|
|
Re: Programmatically add an extension to a plug-in [message #513535 is a reply to message #513206] |
Wed, 10 February 2010 14:14 |
Steve Messages: 16 Registered: July 2009 |
Junior Member |
|
|
I am adding some key bindings to an existing plug-in project in the workspace, not plug-ins deployed in the system. We have a Toolkit that enables a user to create plug-in projects. There are cases where you change something in your plug-in project and our Toolkit automatically updates yourplugin-in projects plugin.xml. I was able to get this working by using a WorkspacePluginModel. This model can be edited. But, when you create this model you do not get the extensions. I had to get the extensions using the model returned from a call to PluginRegistry.findModel(project). I then added all of those extensions to my WorkspacePluginModel model. Now, another gotcha was that if I tried to edit any extension returned by the call to PluginRegistry.findModel() I received a read-only exception. For any extension I needed to edit, I had to create a new extension, based on the original extension, and add that extension to my model. Because this is a new extension I was able to edit it. Finally, after making all of my changes, I saved my model. I tried using a straight XML approach, but ran in to some problems with that. This approach seems to work fine.
Thanks,
Steve
|
|
| | | |
Re: Programmatically add an extension to a plug-in [message #604383 is a reply to message #510066] |
Tue, 26 January 2010 14:02 |
Louis Rose Messages: 440 Registered: July 2009 Location: York, United Kingdom |
Senior Member |
|
|
Great, thanks Steffen.
Steffen Zschaler wrote on Tue, 26 January 2010 07:55
> Hi,
>
> That's what I've been doing in some project that generated plugin
> projects. As long as you have the plugin manifest builder associated
> with that plugin project, saving plugin.xml seems to lead to
> recompilation and correct reconfiguration of the project's metadata.
>
> Steffen
>
> On 26/01/2010 09:09, Louis Rose wrote:
> > Hi Steve,
> >
> > That'd be great, thanks. I'm tempted to simply generate a plugin.xml
> > file, as we will always be generating a new project from scratch. If
> > this would be helpful for you, I can share the code?
> >
> > Cheers,
> > Louis.
|
|
| |
Re: Programmatically add an extension to a plug-in [message #604403 is a reply to message #604387] |
Wed, 27 January 2010 10:09 |
Steffen Zschaler Messages: 266 Registered: July 2009 |
Senior Member |
|
|
Hi Steve,
But you could parse the plugin.xml, extend the AST and print it back as
an XML file, couldn't you?
I'm assuming that we are talking about a project open in the workspace
here, rather than a plugin deployed into the system?
Steffen
On 26/01/2010 14:42, Steve wrote:
> Louis,
> Thanks, but my case is a bit different. I need to update an existing
> plug-in project. I am able to get the model and add the extension if
> it that extension does not already exist. But, if I try to add an
> element (IPluginElement) to an existing extension I get the read-only
> exception.
> Thanks,
> Steve
|
|
|
Re: Programmatically add an extension to a plug-in [message #604544 is a reply to message #510336] |
Tue, 09 February 2010 11:19 |
Vijay Raj Messages: 608 Registered: July 2009 |
Senior Member |
|
|
Why do you guys require to add extensions programmatically??
There is somthing seriously wrong with your design....
(pardon me for being so vague)
If your info or what ever you are going to do is decided at runtime,
then creating extention points for the task and adding them at runtime is like touching your nose from all the way around your head....
Can you please explain your implemention a bit...
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
|
|
|
Re: Programmatically add an extension to a plug-in [message #604578 is a reply to message #604544] |
Wed, 10 February 2010 14:14 |
Steve Messages: 16 Registered: July 2009 |
Junior Member |
|
|
I am adding some key bindings to an existing plug-in project in the workspace, not plug-ins deployed in the system. We have a Toolkit that enables a user to create plug-in projects. There are cases where you change something in your plug-in project and our Toolkit automatically updates yourplugin-in projects plugin.xml. I was able to get this working by using a WorkspacePluginModel. This model can be edited. But, when you create this model you do not get the extensions. I had to get the extensions using the model returned from a call to PluginRegistry.findModel(project). I then added all of those extensions to my WorkspacePluginModel model. Now, another gotcha was that if I tried to edit any extension returned by the call to PluginRegistry.findModel() I received a read-only exception. For any extension I needed to edit, I had to create a new extension, based on the original extension, and add that extension to my model. Because this is a new extension I was able to edit it. Finally, after making all of my changes, I saved my model. I tried using a straight XML approach, but ran in to some problems with that. This approach seems to work fine.
Thanks,
Steve
|
|
|
Goto Forum:
Current Time: Fri Sep 27 00:54:50 GMT 2024
Powered by FUDForum. Page generated in 0.04817 seconds
|