Java – add Export Wizard to eclipse RCP standalone application

Hello

<extension
     id="exportScript"
     point="org.eclipse.ui.exportWizards">
  <wizard
        class="com.myApplication.scriptGenerator.ExportWizard"
        id="com.myApplication.scriptGenerator.exid"
        name="Export as Script">
  </wizard>

However, you do not see any wizards in the file menu entry What did I miss?

Thank you:)

Solution

You must do two things:

>Use org eclipse. ui. Exportwizards extension point (you have already done it)

>In the application action bar advisor class, first create a standard workbench action for export, and then add it to any menu

code snippet

// Creating and registering the action 
IWorkbenchAction export = ActionFactory.EXPORT.create(window);
register(export);

 // adding it to standard file menu
fileMenu.add(export);

>>Full code – applicationactionbar Advisor

package wiztest;

import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.ICoolBarManager;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;

public class ApplicationActionBarAdvisor extends ActionBarAdvisor {

    private IWorkbenchAction exitAction;
    private IWorkbenchAction export;

    public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
        super(configurer);
    }

    protected void makeActions(final IWorkbenchWindow window) {

        exitAction = ActionFactory.QUIT.create(window);
        register(exitAction);


        export = ActionFactory.EXPORT.create(window);
        register(export);
    }

    protected void fillMenuBar(IMenuManager menuBar) {
        MenuManager fileMenu = new MenuManager("&File",IWorkbenchActionConstants.M_FILE);

        menuBar.add(fileMenu);
        menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
        fileMenu.add(export);
        fileMenu.add(exitAction);        
    }

    protected void fillCoolBar(ICoolBarManager coolBar) {

    }
}

>>Menu item

>>Export Wizard

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>