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