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