Search in sources :

Example 1 with TransformationMessage

use of eu.esdihumboldt.hale.common.align.transformation.report.TransformationMessage in project hale by halestudio.

the class DefaultTransformationReporter method importMessages.

/**
 * Add all messages of the given report to this report. They may the logged
 * (again) with a call to {@link #setSuccess(boolean)}.
 *
 * @see ReportLog#importMessages(Report)
 */
@Override
public void importMessages(Report<? extends TransformationMessage> report) {
    for (TransformationMessage message : report.getErrors()) {
        error.add(message);
    }
    int errorMore = report.getTotalErrors() - report.getErrors().size();
    if (errorMore > 0) {
        error.addMore(errorMore);
    }
    for (TransformationMessage message : report.getWarnings()) {
        warn.add(message);
    }
    int warnMore = report.getTotalWarnings() - report.getWarnings().size();
    if (warnMore > 0) {
        warn.addMore(warnMore);
    }
    for (TransformationMessage message : report.getInfos()) {
        info.add(message);
    }
    int infoMore = report.getTotalInfos() - report.getInfos().size();
    if (infoMore > 0) {
        info.addMore(infoMore);
    }
}
Also used : TransformationMessage(eu.esdihumboldt.hale.common.align.transformation.report.TransformationMessage)

Example 2 with TransformationMessage

use of eu.esdihumboldt.hale.common.align.transformation.report.TransformationMessage in project hale by halestudio.

the class TransformationReportPage method onDoubleClick.

@Override
protected void onDoubleClick(Message m) {
    if (m instanceof TransformationMessage) {
        TransformationMessage tm = (TransformationMessage) m;
        AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
        if (as != null && as.getAlignment().getCell(tm.getCellId()) != null) {
            IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            // pin the property sheet if possible
            IViewReference ref = activeWindow.getActivePage().findViewReference(IPageLayout.ID_PROP_SHEET);
            if (ref != null) {
                IViewPart part = ref.getView(false);
                if (part instanceof PropertySheet) {
                    PropertySheet sheet = (PropertySheet) part;
                    if (!sheet.isPinned()) {
                        sheet.setPinned(true);
                    }
                }
            }
            // show cell in mapping view
            try {
                IViewPart part = activeWindow.getActivePage().showView(MappingView.ID);
                if (part instanceof MappingView) {
                    ((MappingView) part).selectCell(tm.getCellId());
                }
            } catch (PartInitException e) {
            // ignore
            }
        }
    }
    super.onDoubleClick(m);
}
Also used : TransformationMessage(eu.esdihumboldt.hale.common.align.transformation.report.TransformationMessage) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IViewPart(org.eclipse.ui.IViewPart) PropertySheet(org.eclipse.ui.views.properties.PropertySheet) AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService) IViewReference(org.eclipse.ui.IViewReference) MappingView(eu.esdihumboldt.hale.ui.views.mapping.MappingView) PartInitException(org.eclipse.ui.PartInitException)

Example 3 with TransformationMessage

use of eu.esdihumboldt.hale.common.align.transformation.report.TransformationMessage in project hale by halestudio.

the class TransformationTreeContentProvider method createInstanceTree.

/**
 * Create a transformation tree based on a source instance.
 *
 * @param instance the source instance
 * @param typeCell the type cell
 * @param alignment the alignment
 * @return the transformation tree or <code>null</code>
 */
private TransformationTree createInstanceTree(Instance instance, Cell typeCell, Alignment alignment) {
    TransformationTree tree = new TransformationTreeImpl(alignment, typeCell);
    ReportLog<TransformationMessage> reporter = new DefaultTransformationReporter("Transformation tree", true);
    TransformationLog log = new CellLog(reporter, typeCell);
    // context matching
    // XXX instead through service/extension point?
    ContextMatcher matcher = new AsDeepAsPossible(null);
    matcher.findMatches(tree);
    // process and annotate the tree
    InstanceVisitor visitor = new InstanceVisitor(new FamilyInstanceImpl(instance), tree, log);
    tree.accept(visitor);
    // duplicate subtree as necessary
    DuplicationVisitor duplicationVisitor = new DuplicationVisitor(tree, log);
    tree.accept(duplicationVisitor);
    duplicationVisitor.doAugmentationTrackback();
    return tree;
}
Also used : TransformationTreeImpl(eu.esdihumboldt.hale.common.align.model.transformation.tree.impl.TransformationTreeImpl) TransformationMessage(eu.esdihumboldt.hale.common.align.transformation.report.TransformationMessage) FamilyInstanceImpl(eu.esdihumboldt.hale.common.align.transformation.function.impl.FamilyInstanceImpl) AsDeepAsPossible(eu.esdihumboldt.hale.common.align.model.transformation.tree.context.impl.matcher.AsDeepAsPossible) DefaultTransformationReporter(eu.esdihumboldt.hale.common.align.transformation.report.impl.DefaultTransformationReporter) TransformationTree(eu.esdihumboldt.hale.common.align.model.transformation.tree.TransformationTree) TransformationLog(eu.esdihumboldt.hale.common.align.transformation.report.TransformationLog) CellLog(eu.esdihumboldt.hale.common.align.transformation.report.impl.CellLog) ContextMatcher(eu.esdihumboldt.hale.common.align.model.transformation.tree.context.ContextMatcher) InstanceVisitor(eu.esdihumboldt.hale.common.align.model.transformation.tree.visitor.InstanceVisitor) DuplicationVisitor(eu.esdihumboldt.hale.common.align.model.transformation.tree.visitor.DuplicationVisitor)

Aggregations

TransformationMessage (eu.esdihumboldt.hale.common.align.transformation.report.TransformationMessage)3 TransformationTree (eu.esdihumboldt.hale.common.align.model.transformation.tree.TransformationTree)1 ContextMatcher (eu.esdihumboldt.hale.common.align.model.transformation.tree.context.ContextMatcher)1 AsDeepAsPossible (eu.esdihumboldt.hale.common.align.model.transformation.tree.context.impl.matcher.AsDeepAsPossible)1 TransformationTreeImpl (eu.esdihumboldt.hale.common.align.model.transformation.tree.impl.TransformationTreeImpl)1 DuplicationVisitor (eu.esdihumboldt.hale.common.align.model.transformation.tree.visitor.DuplicationVisitor)1 InstanceVisitor (eu.esdihumboldt.hale.common.align.model.transformation.tree.visitor.InstanceVisitor)1 FamilyInstanceImpl (eu.esdihumboldt.hale.common.align.transformation.function.impl.FamilyInstanceImpl)1 TransformationLog (eu.esdihumboldt.hale.common.align.transformation.report.TransformationLog)1 CellLog (eu.esdihumboldt.hale.common.align.transformation.report.impl.CellLog)1 DefaultTransformationReporter (eu.esdihumboldt.hale.common.align.transformation.report.impl.DefaultTransformationReporter)1 AlignmentService (eu.esdihumboldt.hale.ui.service.align.AlignmentService)1 MappingView (eu.esdihumboldt.hale.ui.views.mapping.MappingView)1 IViewPart (org.eclipse.ui.IViewPart)1 IViewReference (org.eclipse.ui.IViewReference)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 PartInitException (org.eclipse.ui.PartInitException)1 PropertySheet (org.eclipse.ui.views.properties.PropertySheet)1