Search in sources :

Example 16 with HaleWizardDialog

use of eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog in project hale by halestudio.

the class AbstractWizardHandler method execute.

/**
 * @see IHandler#execute(ExecutionEvent)
 */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    W wizard = createWizard();
    Shell shell = Display.getCurrent().getActiveShell();
    HaleWizardDialog dialog = new HaleWizardDialog(shell, wizard);
    if (dialog.open() == HaleWizardDialog.OK) {
        onComplete(wizard);
    }
    return null;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) HaleWizardDialog(eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog)

Example 17 with HaleWizardDialog

use of eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog in project hale by halestudio.

the class FunctionWizardUtil method createNewWizard.

/**
 * Open a wizard that creates a new relation with the given ID and adds the
 * result to the alignment.
 *
 * @param functionId the function identifier
 * @param elements the schema selection defining the initial selection or
 *            <code>null</code>
 * @return the created cell or <code>null</code>
 */
public static Cell createNewWizard(String functionId, SchemaSelection elements) {
    FunctionWizardDescriptor<?> desc = FunctionWizardExtension.getInstance().getWizardDescriptor(functionId);
    FunctionWizard wizard = desc.createNewWizard(elements);
    if (wizard != null) {
        // initialize the wizard
        wizard.init();
        HaleWizardDialog dialog = new HaleWizardDialog(Display.getCurrent().getActiveShell(), wizard);
        if (dialog.open() == WizardDialog.OK) {
            MutableCell cell = wizard.getResult();
            AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
            as.addCell(cell);
            return cell;
        }
    }
    return null;
}
Also used : MutableCell(eu.esdihumboldt.hale.common.align.model.MutableCell) AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService) HaleWizardDialog(eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog)

Example 18 with HaleWizardDialog

use of eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog in project hale by halestudio.

the class AbstractGenericFunctionWizard method setContainer.

/**
 * @see Wizard#setContainer(IWizardContainer)
 */
@Override
public void setContainer(IWizardContainer wizardContainer) {
    super.setContainer(wizardContainer);
    if (wizardContainer instanceof HaleWizardDialog) {
        final HaleWizardDialog container = (HaleWizardDialog) wizardContainer;
        // has to be pageChanging, because closing the tray in page changed
        // leads to an exception
        ((HaleWizardDialog) wizardContainer).addPageChangingListener(new IPageChangingListener() {

            @Override
            public void handlePageChanging(PageChangingEvent event) {
                boolean helpAvailable = false;
                if (event.getTargetPage() instanceof HaleWizardPage<?>) {
                    HaleWizardPage<?> page = (HaleWizardPage<?>) event.getTargetPage();
                    helpAvailable = page.getHelpContext() != null;
                }
                container.setHelpButtonEnabled(helpAvailable);
                if (container.getTray() != null)
                    container.closeTray();
            }
        });
    }
}
Also used : HaleWizardPage(eu.esdihumboldt.hale.ui.HaleWizardPage) PageChangingEvent(org.eclipse.jface.dialogs.PageChangingEvent) IPageChangingListener(org.eclipse.jface.dialogs.IPageChangingListener) HaleWizardDialog(eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog)

Aggregations

HaleWizardDialog (eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog)18 Shell (org.eclipse.swt.widgets.Shell)6 MutableCell (eu.esdihumboldt.hale.common.align.model.MutableCell)3 ISelection (org.eclipse.jface.viewers.ISelection)3 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 Composite (org.eclipse.swt.widgets.Composite)3 IOConfiguration (eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration)2 HaleWizardPage (eu.esdihumboldt.hale.ui.HaleWizardPage)2 FunctionWizard (eu.esdihumboldt.hale.ui.function.FunctionWizard)2 AlignmentService (eu.esdihumboldt.hale.ui.service.align.AlignmentService)2 ProjectService (eu.esdihumboldt.hale.ui.service.project.ProjectService)2 IPageChangingListener (org.eclipse.jface.dialogs.IPageChangingListener)2 PageChangingEvent (org.eclipse.jface.dialogs.PageChangingEvent)2 TypeFunction (eu.esdihumboldt.hale.common.align.extension.function.TypeFunction)1 Cell (eu.esdihumboldt.hale.common.align.model.Cell)1 EntityDefinition (eu.esdihumboldt.hale.common.align.model.EntityDefinition)1