]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/PrimitiveQueryUpdater.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.browsing.ui / src / org / simantics / browsing / ui / PrimitiveQueryUpdater.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.browsing.ui;\r
13 \r
14 import org.simantics.browsing.ui.NodeContext.PrimitiveQueryKey;\r
15 import org.simantics.browsing.ui.exception.NoDataSourceException;\r
16 \r
17 /**\r
18  * \r
19  */\r
20 public interface PrimitiveQueryUpdater {\r
21 \r
22     /**\r
23      * A unique object representing a certain exploring context. This must be\r
24      * different for separate graph explorer instances.\r
25      * \r
26      * @return an object representing the current exploring context\r
27      */\r
28     Object getExplorerContext();\r
29 \r
30     /**\r
31      * @param <T>\r
32      * @param clazz\r
33      * @return <code>null</code> if no data source is available\r
34      */\r
35     <T> DataSource<T> tryGetDataSource(Class<T> clazz);\r
36 \r
37     /**\r
38      * @param <T>\r
39      * @param clazz\r
40      * @return a data source of the requested type.\r
41      * @throws NoDataSourceException if data source was not found\r
42      */\r
43     <T> DataSource<T> getDataSource(Class<T> clazz) throws NoDataSourceException;\r
44 \r
45     /**\r
46      * @param <T>\r
47      * @param context\r
48      * @param key\r
49      * @param newResult\r
50      */\r
51     <T> void scheduleReplace(NodeContext context, PrimitiveQueryKey<T> key, T newResult);\r
52     // <T> void scheduleClear(INodeContext context, PrimitiveQueryKey<T> key);\r
53 \r
54     /**\r
55      * Tells whether this primitive query updater is disposed or not. Don't use\r
56      * the updater after it is disposed. Disposal always happens in the UI\r
57      * thread.\r
58      * \r
59      * @return <code>true</code> if disposed\r
60      */\r
61     boolean isDisposed();\r
62     boolean isShown(NodeContext context);\r
63     \r
64     void incRef(NodeContext context);\r
65     void decRef(NodeContext context);\r
66 \r
67 }