Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Launching a Wizard from the toolbar(What am I doing wrong?)
Launching a Wizard from the toolbar [message #632253] Tue, 12 October 2010 10:09 Go to next message
Chris  is currently offline Chris Friend
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
Re: Launching a Wizard from the toolbar [message #632389 is a reply to message #632253] Tue, 12 October 2010 18:00 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
On 12/10/10 3:39 PM, Chris wrote:
> 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) "

You are passing null as the selection. You can pass an empty selection
to the wizard.

On a related note, Platform UI provides you standard commands to invoke
these wizards. You don't have to write any code :-)

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Re: Launching a Wizard from the toolbar [message #632491 is a reply to message #632389] Wed, 13 October 2010 07:48 Go to previous message
Chris  is currently offline Chris Friend
Messages: 44
Registered: April 2010
Member
Thanks a lot! passing an empty Selection fixed it.

How would I do this "right" using premade platform components?

Regards,
Chris

[Updated on: Wed, 13 October 2010 08:18]

Report message to a moderator

Previous Topic:Headless build failure with Eclipse 3.6.1
Next Topic:"New" Sub Menu entries
Goto Forum:
  


Current Time: Thu Apr 25 21:53:48 GMT 2024

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

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

Back to the top