Search in sources :

Example 1 with SchemaImportWizard

use of eu.esdihumboldt.hale.ui.io.schema.SchemaImportWizard in project hale by halestudio.

the class SchemaUpdateComponent method updateSelectedSchema.

/**
 */
protected void updateSelectedSchema() {
    ISelection sel = tableViewer.getSelection();
    if (!sel.isEmpty() && sel instanceof IStructuredSelection) {
        final IOConfiguration selected = (IOConfiguration) ((IStructuredSelection) sel).getFirstElement();
        SchemaImportWizard wizard = new SchemaImportWizard() {

            @Override
            public boolean performFinish() {
                if (!applyConfiguration()) {
                    return false;
                }
                IOConfiguration configuration = new IOConfiguration();
                configuration.setActionId(getActionId());
                configuration.setProviderId(getProviderFactory().getIdentifier());
                getProvider().storeConfiguration(configuration.getProviderConfiguration());
                // replace the previously selected I/O configuration
                int index = configurations.indexOf(selected);
                configurations.set(index, configuration);
                // refresh table viewer to reflect the changes
                tableViewer.refresh(true);
                return true;
            }
        };
        // configure advisor
        // FIXME
        SchemaImportAdvisor advisor = new SchemaImportAdvisor(SchemaSpaceID.TARGET);
        advisor.setServiceProvider(HaleUI.getServiceProvider());
        advisor.setActionId(SchemaIO.ACTION_LOAD_TARGET_SCHEMA);
        wizard.setAdvisor(advisor, actionId);
        // open wizard
        Shell shell = Display.getCurrent().getActiveShell();
        HaleWizardDialog dialog = new HaleWizardDialog(shell, wizard);
        dialog.open();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) SchemaImportAdvisor(eu.esdihumboldt.hale.ui.io.schema.SchemaImportAdvisor) IOConfiguration(eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration) ISelection(org.eclipse.jface.viewers.ISelection) SchemaImportWizard(eu.esdihumboldt.hale.ui.io.schema.SchemaImportWizard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) HaleWizardDialog(eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog)

Aggregations

IOConfiguration (eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration)1 SchemaImportAdvisor (eu.esdihumboldt.hale.ui.io.schema.SchemaImportAdvisor)1 SchemaImportWizard (eu.esdihumboldt.hale.ui.io.schema.SchemaImportWizard)1 HaleWizardDialog (eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog)1 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 Shell (org.eclipse.swt.widgets.Shell)1