]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - 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
diff --git a/bundles/org.simantics.selectionview/src/org/simantics/selectionview/SelectionProcessor.java b/bundles/org.simantics.selectionview/src/org/simantics/selectionview/SelectionProcessor.java
new file mode 100644 (file)
index 0000000..10f3563
--- /dev/null
@@ -0,0 +1,51 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.selectionview;\r
+\r
+import java.util.Collection;\r
+\r
+/**\r
+ * A selection processor is an interface for encapsulating the conversion from a\r
+ * UI selection into a collection of input objects. Minimally a selection\r
+ * processor must simply transfer the incoming selection's contents into a\r
+ * collection. The point of having this interface is to allow contribution-based\r
+ * preprocessing of UI selections into proper domain-specific model objects that\r
+ * the domain-specific UI components can take as their inputs.\r
+ * \r
+ * <p>\r
+ * This interface is used in conjunction with UI components that are meant to\r
+ * react to external inputs/UI selections. A tabbed selection view is an example\r
+ * of such a UI component. One or more tabs are created for each preprocessed\r
+ * input object. A selection processor in a tabbed property table is the party\r
+ * that decides how to process/adapt a new workbench selection before sending it\r
+ * on to property contributors for resolving all potential property tab\r
+ * contributors.\r
+ * \r
+ * @author Tuukka Lehtonen\r
+ * \r
+ * @param <S>\r
+ * @param <B>\r
+ */\r
+public interface SelectionProcessor<S, B> {\r
+\r
+    /**\r
+     * @param selection the incoming selection to process\r
+     * @param backend for providing back-end access to the processor\r
+     * @return an ordered set of\r
+     *         <code>org.simantics.browsing.ui.swt.ComparableTabContributor</code>\r
+     *         instances representing the property tabs to be contributed to the\r
+     *         selection view. The processor must not return <code>null</code>,\r
+     *         return an empty collection instead.\r
+     */\r
+    Collection<?> process(S selection, B backend);\r
+\r
+}\r