]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ISymbolItem.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / symbollibrary / ISymbolItem.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.diagram.symbollibrary;
13
14 import org.eclipse.core.runtime.IAdaptable;
15 import org.simantics.db.procedure.Listener;
16 import org.simantics.g2d.element.ElementClass;
17 import org.simantics.g2d.element.handler.StaticSymbol;
18 import org.simantics.utils.datastructures.cache.ProvisionException;
19 import org.simantics.utils.datastructures.hints.IHintContext.Key;
20 import org.simantics.utils.datastructures.hints.IHintContext.KeyOf;
21 import org.simantics.utils.datastructures.hints.IHintObservable;
22
23 /**
24  * Represents a single symbol group element.
25  * 
26  * <p>
27  * Implementations must override equals/hashCode.
28  * </p>
29  * 
30  * @author Tuukka Lehtonen
31  */
32 public interface ISymbolItem extends IAdaptable {
33
34     /**
35      * @return get the symbol group which this symbol item is a part of
36      */
37     ISymbolGroup getGroup();
38
39     /**
40      * @return the name of this symbol item to be shown to the user
41      */
42     String getName();
43
44     /**
45      * @return a more verbose description of the item, for tooltips etc.
46      */
47     String getDescription();
48
49     /**
50      * @param hints external hints for element class loading or
51      *        <code>null</code> if no hints need to be provided
52      * @return an {@link ElementClass} that must contain at least a
53      *         {@link StaticSymbol} handler
54      * @throws ProvisionException if the {@link ElementClass} cannot be
55      *         retrieved for some reason
56      */
57     ElementClass getElementClass(IHintObservable hints) throws ProvisionException;
58
59     /**
60      * Pass a database listener in {@link #getElementClass(IHintObservable)}
61      * hint observable argument using this key to start listening to the changes
62      * in the element class result.
63      */
64     public static final Key KEY_ELEMENT_CLASS_LISTENER = new KeyOf(Listener.class, "ELEMENT_CLASS_LISTENER");
65
66 }