Search in sources :

Example 1 with IWizardNode

use of org.eclipse.jface.wizard.IWizardNode in project bndtools by bndtools.

the class RunExportSelectionPage method createControl.

public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    setControl(container);
    container.setLayout(new GridLayout(1, false));
    table = new Table(container, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    viewer = new TableViewer(table);
    viewer.setContentProvider(ArrayContentProvider.getInstance());
    viewer.setLabelProvider(new ConfigElementLabelProvider(table.getDisplay(), null));
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            ISelection sel = viewer.getSelection();
            if (sel.isEmpty())
                setSelectedNode(null);
            else {
                IConfigurationElement elem = (IConfigurationElement) ((IStructuredSelection) sel).getFirstElement();
                IWizardNode node = nodeCache.get(elem);
                if (node == null) {
                    node = new RunExportWizardNode(getShell(), elem, model, bndProject);
                    nodeCache.put(elem, node);
                }
                setSelectedNode(node);
            }
        }
    });
    viewer.addOpenListener(new IOpenListener() {

        public void open(OpenEvent event) {
            IWizardPage nextPage = getNextPage();
            if (nextPage != null)
                getContainer().showPage(nextPage);
        }
    });
    viewer.setInput(elements);
}
Also used : Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IWizardNode(org.eclipse.jface.wizard.IWizardNode) GridLayout(org.eclipse.swt.layout.GridLayout) IOpenListener(org.eclipse.jface.viewers.IOpenListener) GridData(org.eclipse.swt.layout.GridData) ConfigElementLabelProvider(org.bndtools.core.ui.ConfigElementLabelProvider) ISelection(org.eclipse.jface.viewers.ISelection) IWizardPage(org.eclipse.jface.wizard.IWizardPage) TableViewer(org.eclipse.jface.viewers.TableViewer) OpenEvent(org.eclipse.jface.viewers.OpenEvent)

Aggregations

ConfigElementLabelProvider (org.bndtools.core.ui.ConfigElementLabelProvider)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 IOpenListener (org.eclipse.jface.viewers.IOpenListener)1 ISelection (org.eclipse.jface.viewers.ISelection)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 OpenEvent (org.eclipse.jface.viewers.OpenEvent)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 IWizardNode (org.eclipse.jface.wizard.IWizardNode)1 IWizardPage (org.eclipse.jface.wizard.IWizardPage)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Table (org.eclipse.swt.widgets.Table)1