use of eu.esdihumboldt.hale.ui.service.align.AlignmentService 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.service.align.AlignmentService in project hale by halestudio.
the class TransformDataWizard method performFinish.
/**
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
@Override
public boolean performFinish() {
InstanceCollection rawSources = new MultiInstanceCollection(sourceSelectionPage.getSourceInstances());
// Create a copy of the current alignment to be independent and run
// everything in a job.
AlignmentService alignmentService = PlatformUI.getWorkbench().getService(AlignmentService.class);
Alignment alignment = new DefaultAlignment(alignmentService.getAlignment());
// schema service for getting source schema
SchemaService ss = PlatformUI.getWorkbench().getService(SchemaService.class);
Transformation.transform(rawSources, targetSink, sourceSelectionPage.getExportJob(), sourceSelectionPage.getValidationJob(), alignment, ss.getSchemas(SchemaSpaceID.SOURCE), DefaultReportHandler.getInstance(), HaleUI.getServiceProvider(), null, new DefaultTransformationSettings());
return true;
}
use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.
the class CellMessageTaskProvider method doActivate.
@Override
protected void doActivate(TaskService taskService) {
alignmentService = HaleUI.getServiceProvider().getService(AlignmentService.class);
// create tasks from the current schema
addTasks(generateTasks(), taskService);
// create tasks when cells have been removed
alignmentService.addListener(new AlignmentServiceAdapter() {
@Override
public void alignmentChanged() {
addTasks(generateTasks(), taskService);
}
@Override
public void alignmentCleared() {
taskService.clearTasks();
}
@Override
public void cellsRemoved(Iterable<Cell> cells) {
taskService.clearTasks();
addTasks(generateTasks(), taskService);
}
@Override
public void cellsAdded(Iterable<Cell> cells) {
List<Task<Cell>> tasks = new ArrayList<>();
for (Cell cell : cells) {
tasks.addAll(generateTasks(cell));
}
addTasks(tasks, taskService);
}
});
}
Aggregations