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;
}
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;
}
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();
}
});
}
}
Aggregations