1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.selectionview;
14 import java.util.Collection;
17 * A selection processor is an interface for encapsulating the conversion from a
18 * UI selection into a collection of input objects. Minimally a selection
19 * processor must simply transfer the incoming selection's contents into a
20 * collection. The point of having this interface is to allow contribution-based
21 * preprocessing of UI selections into proper domain-specific model objects that
22 * the domain-specific UI components can take as their inputs.
25 * This interface is used in conjunction with UI components that are meant to
26 * react to external inputs/UI selections. A tabbed selection view is an example
27 * of such a UI component. One or more tabs are created for each preprocessed
28 * input object. A selection processor in a tabbed property table is the party
29 * that decides how to process/adapt a new workbench selection before sending it
30 * on to property contributors for resolving all potential property tab
33 * @author Tuukka Lehtonen
38 public interface SelectionProcessor<S, B> {
41 * @param selection the incoming selection to process
42 * @param backend for providing back-end access to the processor
43 * @return an ordered set of
44 * <code>org.simantics.browsing.ui.swt.ComparableTabContributor</code>
45 * instances representing the property tabs to be contributed to the
46 * selection view. The processor must not return <code>null</code>,
47 * return an empty collection instead.
49 Collection<?> process(S selection, B backend);