Reputation: 61
I use HTML file for my welcome page. I want to open Eclipse Wizard from intro page using
href="http://org.eclipse.ui.intro/runAction?pluginId=MobileTalk&class=mobiletalk.intro.ShowPerspectiveIntroAction"
In the class ShowPerspectiveIntroAction
, my code as follows:
Class c = Class.forName("tttt.ddt.plugin.project.NewTtttProjectWizard");
Wizard wizard = (Wizard) c.newInstance();
WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),wizard);
dialog.open();
But I get the error: classnotfound:tttt.ddt.plugin.project.NewTtttProjectWizard
how can I open any Eclipse Wizard from intro page correctly?
Upvotes: 0
Views: 534
Reputation: 3502
From looking at your code I suspect it is a class loader issue. Using Class.forName is not a safe practice in Eclipse/OSGI because each plugin/bundle uses their own class loader and as a result a lot of times Class Not Found Exceptions happen. A better approach is to get the Bundle/Plugin that contains your wizard class by doing this: Platform.getBundle("com.stackoverflow.myplugindId"), that returns an instance of Bundle. Then on the instance of bundle call the .loadClass("tttt.ddt.plugin.project.NewTtttProjectWizard") which will use the correct class loader and then once you have an instance of the Class you can call the newInstance() method which will resolve your Class not found issue. Hope that helps, class loading is more complex in an OSGI environment because every plugin has its own class loader for security reasons so I advise against using Class.forName in your code. - Duncan
Upvotes: 2