]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/content/ComparableContextFactory.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.browsing.ui / src / org / simantics / browsing / ui / content / ComparableContextFactory.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.content;
13
14 import org.simantics.browsing.ui.NodeContext;
15 import org.simantics.browsing.ui.NodeQueryManager;
16
17 /**
18  * This interface can be used to determine a sorting order for the children of a
19  * certain node. A single ComparableContextFactory is always used for the
20  * children of a single parent node, i.e. a single sorting algorithm will always
21  * be used to sort the children.
22  * 
23  * @author Antti Villberg
24  */
25 public interface ComparableContextFactory {
26
27     /**
28      * Constructs {@link ComparableContext} instances from an array of
29      * {@link NodeContext}s. The input array will be in the order in which the
30      * viewpoint contributions happened to produce the {@link NodeContext}s in.
31      * 
32      * @param manager manager for performing the necessary queries to resolve
33      *        the sorting order
34      * @param parent the parent node of the children. May be used to carry
35      *        constant data to guide the sorting process or just simply ignored.
36      * @param children the set of child nodes to make into
37      *        {@link ComparableContext} instances
38      * @return the specified {@link NodeContext}s wrapped into
39      *         {@link ComparableContext}s or <code>null</code> if no sorting is
40      *         to be performed. The result array should be of the same size as
41      *         the input array.
42      */
43     ComparableContext[] create(NodeQueryManager manager, NodeContext parent, NodeContext[] children);
44
45 }