Package bndtools.wizards.bndfile

Source Code of bndtools.wizards.bndfile.NewBndFileActionDelegate

package bndtools.wizards.bndfile;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;

public class NewBndFileActionDelegate implements IWorkbenchWindowActionDelegate {

    private IWorkbenchWindow window;
    private IStructuredSelection selection;

    public void run(IAction action) {
        EmptyBndFileWizard wizard = new EmptyBndFileWizard();
        wizard.init(window.getWorkbench(), selection);

        WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
        dialog.open();
    }

    public void selectionChanged(IAction action, ISelection selection) {
        if (selection instanceof IStructuredSelection) {
            this.selection = (IStructuredSelection) selection;
        } else {
            this.selection = null;
        }
    }

    public void dispose() {}

    public void init(IWorkbenchWindow window) {
        this.window = window;
    }
}
TOP

Related Classes of bndtools.wizards.bndfile.NewBndFileActionDelegate

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.