]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/SelectionDataResolver.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.browsing.ui / src / org / simantics / browsing / ui / SelectionDataResolver.java
diff --git a/bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/SelectionDataResolver.java b/bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/SelectionDataResolver.java
new file mode 100644 (file)
index 0000000..0d5bd32
--- /dev/null
@@ -0,0 +1,46 @@
+/*******************************************************************************\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.browsing.ui;\r
+\r
+\r
+\r
+\r
+/**\r
+ * This is an interface for resolvers whose purpose is to adapt data stored in\r
+ * Eclipse workbench's {@link ISelection} instances into the input data objects\r
+ * that are stored within GraphExplorer's {@link NodeContext} instances.\r
+ * \r
+ * <p>\r
+ * This interface is needed to externalize the logic of converting external\r
+ * Workbench selections into GraphExplorer selections, so that GraphExplorer\r
+ * itself can stay generic.\r
+ * </p>\r
+ * \r
+ * @author Tuukka Lehtonen\r
+ */\r
+public interface SelectionDataResolver {\r
+\r
+    /**\r
+     * Converts the specified selection element into the real data object contained by\r
+     * the selection to allow the GraphExplorer to generically look for those\r
+     * data objects within the input objects stored by {@link NodeContext}'s\r
+     * (see {@link BuiltinKeys#INPUT} and\r
+     * {@link NodeContext#getConstant(org.simantics.browsing.ui.NodeContext.ConstantKey)}\r
+     * ).\r
+     * \r
+     * @param selection a workbench selection\r
+     * @return an array of data objects resolved from the specified selection or\r
+     *         <code>null</code> if nothing could be resolved.\r
+     */\r
+    Object resolve(Object selectionElement);\r
+\r
+}\r