Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Register a "New Wizard" programmatically?
Register a "New Wizard" programmatically? [message #335206] Thu, 26 March 2009 00:43 Go to next message
Eclipse UserFriend
Originally posted by: anders.opendev.se

Hi!

I want to know if it is possible to register "New Wizards"
programmatically or if one has to go through the extension point for
doing this?

The reason is that I would like to instantiate a bunch of parametrized
"New Wizards". The parameters for these are not known beforehand.

TIA,
Anders
Re: Register a "New Wizard" programmatically? [message #335258 is a reply to message #335206] Fri, 27 March 2009 22:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: francis.oaklandsoftware.com

Last I looked into it there was no API for it, so I did it like using the
code below.


I created the XML in a string (for the new wizards) and then fed it to
this method.


// Add XML as a contribution as if it were present in the plugin.xml
file
public static void addContribution(AppEditor editor, String
contribution)
{
ByteArrayInputStream is = new ByteArrayInputStream(contribution
.toString().getBytes());

IExtensionRegistry reg = Platform.getExtensionRegistry();
Object ut = ((ExtensionRegistry)reg).getTemporaryUserToken();

IContributor cont =
ContributorFactoryOSGi.createContributor(Platform
.getBundle(editor.getPluginId()));

if (false)
System.out.println(contribution);
if (!reg.addContribution(is, cont, false, null, null, ut))
Util.impossible("Contribution not added due to error");
//$NON-NLS-1$

}


On Wed, 25 Mar 2009 17:43:27 -0700, Anders Hansson <anders@opendev.se>
wrote:

> Hi!
>
> I want to know if it is possible to register "New Wizards"
> programmatically or if one has to go through the extension point for
> doing this?
>
> The reason is that I would like to instantiate a bunch of parametrized
> "New Wizards". The parameters for these are not known beforehand.
>
> TIA,
> Anders



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Re: Register a "New Wizard" programmatically? [message #335296 is a reply to message #335258] Tue, 31 March 2009 11:22 Go to previous message
Eclipse UserFriend
Originally posted by: anders.opendev.se

Den Fri, 27 Mar 2009 15:34:06 -0700 skrev Francis Upton:

> I created the XML in a string (for the new wizards) and then fed it to
> this method.

Thanks! I was thinking along those lines as well, but I eventually made a
decision to make a "wrapper" wizard that encapsulated all the other "new
wizards" dynamically. That way they could be even more flexible in their
presentation to the end user - even though they would not appear
"natively" in the new wizard dialog...

I find it somewhat strange that there is so little support in general in
Eclipse for extending extension points programmatically (I could be wrong
but this is not the first time I encountered this type of problem).

Anyway, thanks for you input!

BR,
Anders
Previous Topic:[CNF] Tabbed Properties in Common Navigator
Next Topic:Fragments contributions behaving inconsistently
Goto Forum:
  


Current Time: Fri Apr 26 16:02:20 GMT 2024

Powered by FUDForum. Page generated in 0.03703 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top