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