Launching a Wizard from the toolbar [message #632253] |
Tue, 12 October 2010 10:09 |
Chris Messages: 44 Registered: April 2010 |
Member |
|
|
Hi,
because my users wanted an easier way to create a new diagram with my plug-in, than searching for the corresponding Wizard in the New-Dialog, I wanted to add an icon to the toolbar to open the Wizard. However, my current implementation does nothing and throws a NullPointer exception at " org.eclipse.ui.dialogs.WizardNewFileCreationPage.initialPopu lateContainerNameField(WizardNewFileCreationPage.java:688) "
This is my plugin.xml code:
<extension
point="org.eclipse.ui.actionSets">
<actionSet
id="edu.rwth.hci.codegestalt.NewActionSet"
label="Code Gestalt Diagram Creation"
visible="false">
<action
class="edu.rwth.hci.codegestalt.wizard.RunCgtWizardAction"
icon="icons/CgtNew16.png"
id="edu.rwth.hci.codegestalt.CgtNewAction"
label="New Code Gestalt Diagram"
style="push"
toolbarPath="Normal/JavaWizards"
tooltip="New Code Gestalt Diagram">
</action>
</actionSet>
</extension>
and this is RunCgtWizardAction:
public class RunCgtWizardAction extends Action implements
IWorkbenchWindowActionDelegate {
IWorkbenchWindow window;
@Override
public void dispose() {
// noop
}
@Override
public void init(IWorkbenchWindow window) {
this.window = window;
}
@Override
public void run(IAction action) {
CgtWizard wizard = new CgtWizard();
wizard.init(window.getWorkbench(), null);
Shell shell = window.getShell();
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.create();
dialog.open();
}
@Override
public void selectionChanged(IAction action, ISelection selection) {
// noop
}
}
I based it on this tutorial, since I didn't knew/know any better.
Thanks a lot.
Regards,
Chris
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03723 seconds