Search in sources :

Example 11 with AlignmentService

use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.

the class AlignmentExportAdvisor method prepareProvider.

/**
 * @see AbstractIOAdvisor#prepareProvider(IOProvider)
 */
@Override
public void prepareProvider(AlignmentWriter provider) {
    super.prepareProvider(provider);
    AlignmentService as = getService(AlignmentService.class);
    provider.setAlignment(as.getAlignment());
    SchemaService ss = getService(SchemaService.class);
    provider.setSourceSchema(ss.getSchemas(SchemaSpaceID.SOURCE));
    provider.setTargetSchema(ss.getSchemas(SchemaSpaceID.TARGET));
}
Also used : SchemaService(eu.esdihumboldt.hale.ui.service.schema.SchemaService) AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService)

Example 12 with AlignmentService

use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.

the class IndexStartup method earlyStartup.

@Override
public void earlyStartup() {
    final InstanceIndexUpdateService indexUpdater = PlatformUI.getWorkbench().getService(InstanceIndexUpdateService.class);
    final AlignmentService alignmentService = PlatformUI.getWorkbench().getService(AlignmentService.class);
    alignmentService.addListener(indexUpdater);
}
Also used : InstanceIndexUpdateService(eu.esdihumboldt.hale.ui.index.InstanceIndexUpdateService) AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService)

Example 13 with AlignmentService

use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.

the class RemoveCellHandler method execute.

/**
 * @see IHandler#execute(ExecutionEvent)
 */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    // collect cells from selection
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    if (MessageDialog.openQuestion(HandlerUtil.getActiveShell(event), "Delete cells", "Do you really want to delete the selected cells?")) {
        AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
        if (selection instanceof IStructuredSelection) {
            List<?> list = ((IStructuredSelection) selection).toList();
            List<Cell> cells = new ArrayList<Cell>();
            for (Object object : list) {
                if (object instanceof Cell) {
                    // FIXME sanity checks for cell deletion? (e.g. don't
                    // allow remove type mapping if there are properties
                    // mapped?) where to do it?
                    // For now only done in activeWhen defined for handler
                    cells.add((Cell) object);
                }
            }
            as.removeCells(cells.toArray(new Cell[cells.size()]));
        }
    }
    return null;
}
Also used : AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService) ISelection(org.eclipse.jface.viewers.ISelection) ArrayList(java.util.ArrayList) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Cell(eu.esdihumboldt.hale.common.align.model.Cell)

Example 14 with AlignmentService

use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.

the class AlignmentServiceSource method getCurrentState.

/**
 * @see ISourceProvider#getCurrentState()
 */
@Override
public Map<String, Object> getCurrentState() {
    AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
    Map<String, Object> result = new HashMap<String, Object>();
    result.put(HAS_CELLS, hasCells(as));
    return result;
}
Also used : HashMap(java.util.HashMap) AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService)

Example 15 with AlignmentService

use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.

the class AlignmentServiceSource method dispose.

/**
 * @see ISourceProvider#dispose()
 */
@Override
public void dispose() {
    AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
    as.removeListener(alignmentListener);
}
Also used : AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService)

Aggregations

AlignmentService (eu.esdihumboldt.hale.ui.service.align.AlignmentService)43 Cell (eu.esdihumboldt.hale.common.align.model.Cell)16 Alignment (eu.esdihumboldt.hale.common.align.model.Alignment)11 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 ArrayList (java.util.ArrayList)8 DefaultCell (eu.esdihumboldt.hale.common.align.model.impl.DefaultCell)6 ISelection (org.eclipse.jface.viewers.ISelection)6 EntityDefinition (eu.esdihumboldt.hale.common.align.model.EntityDefinition)5 MutableCell (eu.esdihumboldt.hale.common.align.model.MutableCell)5 AlignmentServiceAdapter (eu.esdihumboldt.hale.ui.service.align.AlignmentServiceAdapter)5 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)5 IContributionItem (org.eclipse.jface.action.IContributionItem)5 TypeEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition)4 CompatibilityService (eu.esdihumboldt.hale.ui.common.service.compatibility.CompatibilityService)4 HashSet (java.util.HashSet)4 Display (org.eclipse.swt.widgets.Display)4 BaseAlignmentCell (eu.esdihumboldt.hale.common.align.model.BaseAlignmentCell)3 IAction (org.eclipse.jface.action.IAction)3 ControlAdapter (org.eclipse.swt.events.ControlAdapter)3 ControlEvent (org.eclipse.swt.events.ControlEvent)3